The QSqlFieldInfo class stores meta data associated with a SQL field.
Más...
#include <qsqlfield.h>
Lista de todos los miembros.
Métodos públicos |
| QSqlFieldInfo (const QString &name=QString::null, QVariant::Type typ=QVariant::Invalid, int required=-1, int len=-1, int prec=-1, const QVariant &defValue=QVariant(), int sqlType=0, bool generated=TRUE, bool trim=FALSE, bool calculated=FALSE) |
| QSqlFieldInfo (const QSqlFieldInfo &other) |
| QSqlFieldInfo (const QSqlField &other, bool generated=TRUE) |
virtual | ~QSqlFieldInfo () |
QSqlFieldInfo & | operator= (const QSqlFieldInfo &other) |
bool | operator== (const QSqlFieldInfo &f) const |
QSqlField | toField () const |
int | isRequired () const |
QVariant::Type | type () const |
int | length () const |
int | precision () const |
QVariant | defaultValue () const |
QString | name () const |
int | typeID () const |
bool | isGenerated () const |
bool | isTrim () const |
bool | isCalculated () const |
virtual void | setTrim (bool trim) |
virtual void | setGenerated (bool gen) |
virtual void | setCalculated (bool calc) |
| QSqlFieldInfo (const QString &name=QString::null, QVariant::Type typ=QVariant::Invalid, int required=-1, int len=-1, int prec=-1, const QVariant &defValue=QVariant(), int sqlType=0, bool generated=TRUE, bool trim=FALSE, bool calculated=FALSE) |
| QSqlFieldInfo (const QSqlFieldInfo &other) |
| QSqlFieldInfo (const QSqlField &other, bool generated=TRUE) |
virtual | ~QSqlFieldInfo () |
QSqlFieldInfo & | operator= (const QSqlFieldInfo &other) |
bool | operator== (const QSqlFieldInfo &f) const |
QSqlField | toField () const |
int | isRequired () const |
QVariant::Type | type () const |
int | length () const |
int | precision () const |
QVariant | defaultValue () const |
QString | name () const |
int | typeID () const |
bool | isGenerated () const |
bool | isTrim () const |
bool | isCalculated () const |
virtual void | setTrim (bool trim) |
virtual void | setGenerated (bool gen) |
virtual void | setCalculated (bool calc) |
Descripción detallada
The QSqlFieldInfo class stores meta data associated with a SQL field.
sql
QSqlFieldInfo objects only store meta data; field values are stored in QSqlField objects.
All values must be set in the constructor, and may be retrieved using isRequired(), type(), length(), precision(), defaultValue(), name(), isGenerated() and typeID().
Documentación del constructor y destructor
Constructs a QSqlFieldInfo with the following parameters: name the name of the field. typ the field's type in a QVariant. required greater than 0 if the field is required, 0 if its value can be NULL and less than 0 if it cannot be determined whether the field is required or not. len the length of the field. Note that for non-character types some databases return either the length in bytes or the number of digits. -1 signifies that the length cannot be determined. prec the precision of the field, or -1 if the field has no precision or it cannot be determined. defValue the default value that is inserted into the table if none is specified by the user. QVariant() if there is no default value or it cannot be determined. typeID the internal typeID of the database system (only useful for low-level programming). 0 if unknown. generated TRUE indicates that this field should be included in auto-generated SQL statments, e.g. in QSqlCursor. trim TRUE indicates that widgets should remove trailing whitespace from character fields. This does not affect the field value but only its representation inside widgets. calculated TRUE indicates that the value of this field is calculated. The value of calculated fields can by modified by subclassing QSqlCursor and overriding QSqlCursor::calculateField().
Constructs a copy of other.
QSqlFieldInfo::QSqlFieldInfo |
( |
const QSqlField & |
other, |
|
|
bool |
generated = TRUE |
|
) |
| |
Creates a QSqlFieldInfo object with the type and the name of the QSqlField other. If generated is TRUE this field will be included in auto-generated SQL statments, e.g. in QSqlCursor.
QSqlFieldInfo::~QSqlFieldInfo |
( |
| ) |
[virtual] |
Destroys the object and frees any allocated resources.
QSqlFieldInfo::QSqlFieldInfo |
( |
const QSqlField & |
other, |
|
|
bool |
generated = TRUE |
|
) |
| |
virtual QSqlFieldInfo::~QSqlFieldInfo |
( |
| ) |
[virtual] |
Documentación de las funciones miembro
QVariant QSqlFieldInfo::defaultValue |
( |
| ) |
const |
Returns the field's default value or an empty QVariant if the field has no default value or the value couldn't be determined. The default value is the value inserted in the database when it is not explicitly specified by the user.
QVariant QSqlFieldInfo::defaultValue |
( |
| ) |
const |
bool QSqlFieldInfo::isCalculated |
( |
| ) |
const |
Returns TRUE if the field is calculated; otherwise returns FALSE.
- Ver también:
- setCalculated()
bool QSqlFieldInfo::isCalculated |
( |
| ) |
const |
bool QSqlFieldInfo::isGenerated |
( |
| ) |
const |
Returns TRUE if the field should be included in auto-generated SQL statments, e.g. in QSqlCursor; otherwise returns FALSE.
- Ver también:
- setGenerated()
bool QSqlFieldInfo::isGenerated |
( |
| ) |
const |
int QSqlFieldInfo::isRequired |
( |
| ) |
const |
Returns a value greater than 0 if the field is required (NULL values are not allowed), 0 if it isn't required (NULL values are allowed) or less than 0 if it cannot be determined whether the field is required or not.
int QSqlFieldInfo::isRequired |
( |
| ) |
const |
bool QSqlFieldInfo::isTrim |
( |
| ) |
const |
Returns TRUE if trailing whitespace should be removed from character fields; otherwise returns FALSE.
- Ver también:
- setTrim()
bool QSqlFieldInfo::isTrim |
( |
| ) |
const |
int QSqlFieldInfo::length |
( |
| ) |
const |
int QSqlFieldInfo::length |
( |
void |
| ) |
const |
Returns the field's length. For fields storing text the return value is the maximum number of characters the field can hold. For non-character fields some database systems return the number of bytes needed or the number of digits allowed. If the length cannot be determined -1 is returned.
QString QSqlFieldInfo::name |
( |
| ) |
const |
Returns the name of the field in the SQL table.
QString QSqlFieldInfo::name |
( |
| ) |
const |
Assigns other to this field info and returns a reference to it.
Returns TRUE if this fieldinfo is equal to f; otherwise returns FALSE.
Two field infos are considered equal if all their attributes match.
int QSqlFieldInfo::precision |
( |
| ) |
const |
int QSqlFieldInfo::precision |
( |
| ) |
const |
Returns the field's precision or -1 if the field has no precision or it cannot be determined.
void QSqlFieldInfo::setCalculated |
( |
bool |
calc | ) |
[virtual] |
virtual void QSqlFieldInfo::setCalculated |
( |
bool |
calc | ) |
[virtual] |
virtual void QSqlFieldInfo::setGenerated |
( |
bool |
gen | ) |
[virtual] |
void QSqlFieldInfo::setGenerated |
( |
bool |
gen | ) |
[virtual] |
gen set to FALSE indicates that this field should not appear in auto-generated SQL statements (for example in QSqlCursor).
- Ver también:
- isGenerated()
void QSqlFieldInfo::setTrim |
( |
bool |
trim | ) |
[virtual] |
If trim is TRUE widgets should remove trailing whitespace from character fields. This does not affect the field value but only its representation inside widgets.
- Ver también:
- isTrim()
virtual void QSqlFieldInfo::setTrim |
( |
bool |
trim | ) |
[virtual] |
int QSqlFieldInfo::typeID |
( |
| ) |
const |
int QSqlFieldInfo::typeID |
( |
| ) |
const |
Returns the internal type identifier as returned from the database system. The return value is 0 if the type is unknown.
- Atención:
- This information is only useful for low-level database programming and is not database independent.
La documentación para esta clase fue generada a partir de los siguientes ficheros: