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.
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.
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.
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& x) const
Returns true if all fields are the same.
bool operator!=(const S_type& x) const
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& id) const
Returns a value of column id or void Value if not in S_type.
Value Get(int i) const
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.
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).