Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

S_type structures

 

S_type structures are generated (by multiincluding process) from .sch files that describe the database schema. Each TABLE or TYPE of .sch has correspending S_type structure. This structure has member variables corresponding to database columns, with the same names and types. 'BOOL' columns are represented as CHAR(1) in database, but as 'bool' C++ type in S_type). ARRAY columns are represented as fixed C++ arrays. If TABLE or TYPE has any base TYPEs or TABLEs, S_type structure contains them as well.

 

Public Member List

 

static const char TableName[]

The name of table or type.

 


 

static const SqlSet& ColumnSet()

The complete set of columns as SqlSet.

 


 

static SqlSet ColumnSet(const String& prefix)

The complete set of columns as SqlSet, all columns prefixed with prefix.

 


 

static SqlSet Of(SqlId table)

The complete set of columns as SqlSet, all columns expressed as part of table (TABLE.COLUMN notation).

 


 

static const Vector<SqlId>& GetColumnIds()

Returns all columns.

 


 

void Clear()

Sets all member variables to Null.

 


 

void FieldLayout(FieldOperator& f)

Calls FieldOpertator::Field(const char *name, Ref f) and Table(const char *name) methods of f to provide a visitor pattern for S_type.

 


 

operator Fields()

Returns callback(this, &S_type::FieldLayout). This method provides unified access to all S_types, which is then used in Sql::Fetch.

 


 

bool operator==(const S_type& xconst

Returns true if all fields are the same.

 


 

bool operator!=(const S_type& xconst

Same as !operator==(x).

 


 

String ToString() const

Converts S_type to (multiline) text, mostly for debugging purposes.

 


 

static int GetCount()

Returns a number of columns of this S_type.

 


 

static SqlId GetId(int i)

Returns a column ID for column at i.

 


 

static int GetIndex(const String& id)

static int GetIndex(const SqlId& id)

Returns the index of column id or negative number if not found.

 


 

static int GetWidth(int i)

Returns the width of column (usually text) as defined in the schema. If column does not have width, returns 0.

 


 

static int GetWidth(const SqlId& id)

Returns the width of column (usually text) as defined in the schema.If id is not in S_type, returns 0.

 


 

Ref GetRef(int i)

Returns a reference to column at i.

 


 

Ref GetRef(const SqlId& id)

Returns a reference to column id or void reference if not in S_type.

 


 

Value Get(const SqlId& idconst

Returns a value of column id or void Value if not in S_type.

 


 

Value Get(int iconst

Returns a value of column at i.

 


 

ValueMap Get() const

Returns a map of column names to column values.

 


 

void Set(int i, const Value& v)

Sets column at i to v. Type of v must be convertible to the column.

 


 

void Set(const SqlId& id, const Value& v)

If id is in S_type, sets its value to v, otherwise does nothing.

 


 

void Set(const ValueMap& m)

Keys in m found as column ids in S_type as assigned to respective values. Keys not found are ignored, columns not present in m are left unchanged.

 


 

S_type()

Sets all columns to Null.

 


 

S_type(const ValueMap& m)

Keys in m found as column ids in S_type as assigned to respective values. Keys not found are ignored, columns not present in m are set to Null. Overal effect is the same as using the default constructor and then Set(m).

 

Last edit by cxl on 10/08/2015. Do you want to contribute?. T++