
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQSqlRecord class encapsulates a database record.More...
| Header: | #include <QSqlRecord> |
| Inherited By: |
| QSqlRecord() | |
| QSqlRecord(const QSqlRecord & other) | |
| ~QSqlRecord() | |
| void | append(const QSqlField & field) |
| void | clear() |
| void | clearValues() |
| bool | contains(const QString & name) const |
| int | count() const |
| QSqlField | field(int index) const |
| QSqlField | field(const QString & name) const |
| QString | fieldName(int index) const |
| int | indexOf(const QString & name) const |
| void | insert(int pos, const QSqlField & field) |
| bool | isEmpty() const |
| bool | isGenerated(const QString & name) const |
| bool | isGenerated(int index) const |
| bool | isNull(const QString & name) const |
| bool | isNull(int index) const |
| void | remove(int pos) |
| void | replace(int pos, const QSqlField & field) |
| void | setGenerated(const QString & name, bool generated) |
| void | setGenerated(int index, bool generated) |
| void | setNull(int index) |
| void | setNull(const QString & name) |
| void | setValue(int index, const QVariant & val) |
| void | setValue(const QString & name, const QVariant & val) |
| QVariant | value(int index) const |
| QVariant | value(const QString & name) const |
| bool | operator!=(const QSqlRecord & other) const |
| QSqlRecord & | operator=(const QSqlRecord & other) |
| bool | operator==(const QSqlRecord & other) const |
TheQSqlRecord class encapsulates a database record.
TheQSqlRecord class encapsulates the functionality and characteristics of a database record (usually a row in a table or view within the database).QSqlRecord supports adding and removing fields as well as setting and retrieving field values.
The values of a record's fields' can be set by name or position withsetValue(); if you want to set a field to null usesetNull(). To find the position of a field by name useindexOf(), and to find the name of a field at a particular position usefieldName(). Usefield() to retrieve aQSqlField object for a given field. Usecontains() to see if the record contains a particular field name.
When queries are generated to be executed on the database only those fields for whichisGenerated() is true are included in the generated SQL.
A record can have fields added withappend() orinsert(), replaced withreplace(), and removed withremove(). All the fields can be removed withclear(). The number of fields is given bycount(); all their values can be cleared (to null) usingclearValues().
See alsoQSqlField andQSqlQuery::record().
Constructs an empty record.
See alsoisEmpty(),append(), andinsert().
Constructs a copy ofother.
QSqlRecord isimplicitly shared. This means you can make copies of a record inconstant time.
Destroys the object and frees any allocated resources.
Append a copy of fieldfield to the end of the record.
See alsoinsert(),replace(), andremove().
Removes all the record's fields.
See alsoclearValues() andisEmpty().
Clears the value of all fields in the record and sets each field to null.
See alsosetValue().
Returns true if there is a field in the record calledname; otherwise returns false.
Returns the number of fields in the record.
See alsoisEmpty().
Returns the field at positionindex. If theindex is out of range, function returns a default-constructed value.
This is an overloaded function.
Returns the field calledname.
Returns the name of the field at positionindex. If the field does not exist, an empty string is returned.
See alsoindexOf().
Returns the position of the field calledname within the record, or -1 if it cannot be found. Field names are not case-sensitive. If more than one field matches, the first one is returned.
See alsofieldName().
Inserts the fieldfield at positionpos in the record.
See alsoappend(),replace(), andremove().
Returns true if there are no fields in the record; otherwise returns false.
See alsoappend(),insert(), andclear().
Returns true if the record has a field calledname and this field is to be generated (the default); otherwise returns false.
See alsosetGenerated().
This is an overloaded function.
Returns true if the record has a field at positionindex and this field is to be generated (the default); otherwise returns false.
See alsosetGenerated().
Returns true if the field calledname is null or if there is no field calledname; otherwise returns false.
See alsosetNull().
This is an overloaded function.
Returns true if the fieldindex is null or if there is no field at positionindex; otherwise returns false.
Removes the field at positionpos. Ifpos is out of range, nothing happens.
See alsoappend(),insert(), andreplace().
Replaces the field at positionpos with the givenfield. Ifpos is out of range, nothing happens.
See alsoappend(),insert(), andremove().
Sets the generated flag for the field calledname togenerated. If the field does not exist, nothing happens. Only fields that havegenerated set to true are included in the SQL that is generated byQSqlQueryModel for example.
See alsoisGenerated().
This is an overloaded function.
Sets the generated flag for the fieldindex togenerated.
See alsoisGenerated().
Sets the value of fieldindex to null. If the field does not exist, nothing happens.
See alsoisNull() andsetValue().
This is an overloaded function.
Sets the value of the field calledname to null. If the field does not exist, nothing happens.
Sets the value of the field at positionindex toval. If the field does not exist, nothing happens.
This is an overloaded function.
Sets the value of the field calledname toval. If the field does not exist, nothing happens.
Returns the value of the field located at positionindex in the record. Ifindex is out of bounds, an invalidQVariant is returned.
See alsosetValue(),fieldName(), andisNull().
This is an overloaded function.
Returns the value of the field calledname in the record. If fieldname does not exist an invalid variant is returned.
See alsoindexOf().
Returns true if this object is not identical toother; otherwise returns false.
See alsooperator==().
Sets the record equal toother.
QSqlRecord isimplicitly shared. This means you can make copies of a record inconstant time.
Returns true if this object is identical toother (i.e., has the same fields in the same order); otherwise returns false.
See alsooperator!=().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.