QSqlField Class Reference |
Constant | Value | Description |
---|---|---|
QSqlField::Required | 1 | The field must be specified when inserting records. |
QSqlField::Optional | 0 | The fields doesn't have to be specified when inserting records. |
QSqlField::Unknown | -1 | The database driver couldn't determine whether the field is required or optional. |
See also requiredStatus().
Constructs an empty field called fieldName of variant type type.
See also setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(), setGenerated(), and setReadOnly().
Constructs a copy of other.
Destroys the object and frees any allocated resources.
Clears the value of the field and sets it to NULL. If the field is read-only, nothing happens.
See also setValue(), isReadOnly(), and requiredStatus().
Returns the field's default value (which may be NULL).
See also setDefaultValue(), type(), requiredStatus(), length(), precision(), and isGenerated().
Returns true if the value is auto-generated by the database, for example auto-increment primary key values.
See also setAutoValue().
Returns true if the field is generated; otherwise returns false.
See also setGenerated(), type(), requiredStatus(), length(), precision(), and defaultValue().
Returns true if the field's value is NULL; otherwise returns false.
See also value().
Returns true if the field's value is read-only; otherwise returns false.
See also setReadOnly(), type(), requiredStatus(), length(), precision(), defaultValue(), and isGenerated().
Returns true if the field's variant type is valid; otherwise returns false.
Returns the field's length.
See also setLength(), type(), requiredStatus(), precision(), defaultValue(), and isGenerated().
Returns the name of the field.
See also setName().
Returns the field's precision; this is only meaningful for numeric types.
See also setPrecision(), type(), requiredStatus(), length(), defaultValue(), and isGenerated().
Returns true if this is a required field; otherwise returns false. An INSERT will fail if a required field does not have a value.
See also setRequiredStatus(), type(), length(), precision(), defaultValue(), and isGenerated().
Marks the field as an auto-generated value if autoVal is true.
See also isAutoValue().
Sets the default value used for this field to value.
See also defaultValue(), value(), setType(), setRequiredStatus(), setLength(), setPrecision(), setGenerated(), and setReadOnly().
Sets the generated state. If gen is false, no SQL will be generated for this field; otherwise, Qt classes such as QSqlQueryModel and QSqlTableModel will generate SQL for this field.
See also isGenerated(), setType(), setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(), and setReadOnly().
Sets the field's length to fieldLength. For strings this is the maximum number of characters the string can hold; the meaning varies for other types.
See also length(), setType(), setRequiredStatus(), setPrecision(), setDefaultValue(), setGenerated(), and setReadOnly().
Sets the name of the field to name.
See also name().
Sets the field's precision. This only affects numeric fields.
See also precision(), setType(), setRequiredStatus(), setLength(), setDefaultValue(), setGenerated(), and setReadOnly().
Sets the read only flag of the field's value to readOnly. A read-only field cannot have its value set with setValue() and cannot be cleared to NULL with clear().
See also isReadOnly().
Sets the required status of this field to Required if required is true; otherwise sets it to Optional.
See also setRequiredStatus() and requiredStatus().
Sets the required status of this field to required.
See also requiredStatus(), setType(), setLength(), setPrecision(), setDefaultValue(), setGenerated(), and setReadOnly().
Set's the field's variant type to type.
See also type(), setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(), setGenerated(), and setReadOnly().
Sets the value of the field to value. If the field is read-only (isReadOnly() returns true), nothing happens.
If the data type of value differs from the field's current data type, an attempt is made to cast it to the proper type. This preserves the data type of the field in the case of assignment, e.g. a QString to an integer data type.
To set the value to NULL, use clear().
See also value(), isReadOnly(), and defaultValue().
Returns the field's type as stored in the database. Note that the actual value might have a different type, Numerical values that are too large to store in a long int or double are usually stored as strings to prevent precision loss.
See also setType().
Returns the value of the field as a QVariant.
Use isNull() to check if the field's value is NULL.
See also setValue().
Returns true if the field is unequal to other; otherwise returns false.
Sets the field equal to other.
Returns true if the field is equal to other; otherwise returns false.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.1 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com