DbStruct Pile   version 0.0.1
This pile contains classes that can be used to
DbColumn Class Reference

The columnure of a database. More...

#include <dbcolumn.h>

+ Inheritance diagram for DbColumn:

Classes

union  ColFormat
 

Public Types

enum  ForeignBehaviour { FB_CHOOSE, FB_CHOOSE_ADD }
 
enum  DataType {
  DTY_INVALID = -1, DTY_BIGINT, DTY_BINARY, DTY_BIT,
  DTY_TRISTATE, DTY_CHAR, DTY_DATE, DTY_DATETIME,
  DTY_DATETIME2, DTY_DATETIMEOFFSET, DTY_DECIMAL, DTY_DECIMALSCALE,
  DTY_FLOAT, DTY_HIERARCHYID, DTY_IMAGE, DTY_INTEGER,
  DTY_MONEY, DTY_NCHAR, DTY_NTEXT, DTY_NUMERIC,
  DTY_NUMERICSCALE, DTY_NVARCHAR, DTY_REAL, DTY_ROWVERSION,
  DTY_SMALLDATETIME, DTY_SMALLINT, DTY_SMALLMONEY, DTY_SQL,
  DTY_TEXT, DTY_TIME, DTY_TINYINT, DTY_UNIQUEIDENTIFIER,
  DTY_VARBINARY, DTY_VARCHAR, DTY_XML, DTY_CALLBACK,
  DTY_MAX
}
 
enum  BoolFormat {
  BF_Y_UPPER, BF_T_UPPER, BF_YES_CAMEL, BF_YES_LOWER,
  BF_YES_UPPER, BF_ON_CAMEL, BF_ON_LOWER, BF_ON_UPPER,
  BF_TRUE_CAMEL, BF_TRUE_LOWER, BF_TRUE_UPPER, BF_STRING_ON
}
 
typedef QVariant(* Callback) (const DbTaew &table, const DbColumn &colorig, const QSqlRecord &rec, int role, void *user_data)
 Callback used to retreive the value for a DTY_CALLBACK column.
 
- Public Types inherited from DbObject
enum  Type {
  DBO_INVALID = -1, DBO_STRUCT, DBO_COLUMN, DBO_RECORD,
  DBO_TABLE, DBO_SUBSET, DBO_CPLX_VIEW, DBO_CUSTOM,
  DBO_MAX
}
 The types of objects that use this class as a base. More...
 

Public Member Functions

 DbColumn ()
 Default constructor. More...
 
 DbColumn (const QString &col_name, int col_id, int real_col_id, int length, const QString &col_label, DataType datatype, bool nulls, bool autoincrement, const QString &default_value, const QString &format, bool read_only, int virtrefcol, const QString &foreign_table, const QString &foreign_key, const QString &foreign_ref, ForeignBehaviour foreign_behaviour)
 Default constructor.
 
virtual ~DbColumn ()
 Destructor. More...
 
virtual Type type () const
 The type of this object.
 
bool isForeignKey () const
 Tell if this column has a foreign key.
 
bool isVirtual () const
 Tell if this column is a virtual one.
 
bool isDynamic () const
 Tell if this column is a virtual one.
 
QVariant kbData (const DbTaew &table, const QSqlRecord &rec, int role=Qt::DisplayRole, void *user_data=NULL) const
 Retreive the data using the callback. More...
 
QVariant formattedData (const QVariant &original_value) const
 
- Public Member Functions inherited from DbObject
 DbObject ()
 Default constructor. More...
 
virtual ~DbObject ()
 Destructor. More...
 
DbStructMetaasStruct ()
 Get this instance as a DbStruct.
 
DbColumnasColumn ()
 Get this instance as a DbColumn.
 
DbRecordasRecord ()
 Get this instance as a DbRecord.
 
DbTableasTable ()
 Get this instance as a DbTable.
 
DbViewasView ()
 Get this instance as a DbView.
 
bool isStruct ()
 Tell if this instance is a DbStruct.
 
bool isColumn ()
 Tell if this instance is a DbColumn.
 
bool isRecord ()
 Tell if this instance is a DbRecord.
 
bool isTable ()
 Tell if this instance is a DbTable.
 
bool isView ()
 Tell if this instance is a DbView.
 
bool isCustom ()
 Tell if this instance is a custom one.
 

Public Attributes

QString col_name_
 
int col_id_
 
int real_col_id_
 
int length_
 
QString col_label_
 
DataType datatype_
 
bool nulls_
 
bool autoincrement_
 
QString default_value_
 
bool read_only_
 
int virtrefcol_
 
QString foreign_table_
 
QString foreign_key_
 
QString foreign_ref_
 
ForeignBehaviour foreign_behaviour_
 
QString original_format_
 
ColFormat format_
 
QChar fill_char_
 
char nr_format_
 
int precision_
 

Detailed Description

The columnure of a database.

Detailed description.

Member Enumeration Documentation

Enumerator
DTY_INVALID 

invalid data type

DTY_CALLBACK 

dynamically computed value or retrieved from database

DTY_MAX 

first invalid value

Enumerator
FB_CHOOSE 

the user can choose values from the other table

FB_CHOOSE_ADD 

the user can choose values from or add values to the other table

Constructor & Destructor Documentation

DbColumn::DbColumn ( )

Default constructor.

Detailed description for .

DbColumn::~DbColumn ( )
virtual

Destructor.

Detailed description for decolumnor.

Member Function Documentation

QVariant DbColumn::kbData ( const DbTaew table,
const QSqlRecord &  rec,
int  role = Qt::DisplayRole,
void *  user_data = NULL 
) const

Retreive the data using the callback.

If the callback was not set QVariant() is returned.

Parameters
tableThe table where this column belongs.
recThe record for which data is being requested.
roleRequested role.
user_dataOpaque data passed along to the callback.
Returns
The data for this record and column.

Member Data Documentation

QChar DbColumn::fill_char_

character used for padding, if any

ForeignBehaviour DbColumn::foreign_behaviour_

how are we going to interact with foreign table

QString DbColumn::foreign_key_

Name of the column in the referenced table

QString DbColumn::foreign_ref_

The columns that should replace this column

QString DbColumn::foreign_table_

The table that this column references

ColFormat DbColumn::format_

column format (depends on datatype

char DbColumn::nr_format_

number format (e, E, f, g, G)

QString DbColumn::original_format_

actual format passed to the constructor

int DbColumn::precision_

number of significant digits for real numbers, base for integers


The documentation for this class was generated from the following files: