QSqlRecord(3qt)
QSqlRecord π
okay bestie, this is the QSqlRecord(3qt) page from the Qt 3 docs β it lives in the Qt 3qt manual and it's genuinely one of the most useful little classes in the whole SQL corner of Qt. buckle up π
β¨ NAME β¨
QSqlRecord β encapsulates a database record, i.e. a set of database fields ποΈπ
β¨ SYNOPSIS β¨
#include <qsqlrecord.h>
Inherited by QSqlCursor and QSqlIndex.
π«Ά Public Members
QSqlRecord ()
QSqlRecord ( const QSqlRecord & other )
QSqlRecord & operator= ( const QSqlRecord & other )
virtual ~QSqlRecord ()
virtual QVariant value ( int i ) const
virtual QVariant value ( const QString & name ) const
virtual void setValue ( int i, const QVariant & val )
virtual void setValue ( const QString & name, const QVariant & val )
bool isGenerated ( int i ) const
bool isGenerated ( const QString & name ) const
virtual void setGenerated ( const QString & name, bool generated )
virtual void setGenerated ( int i, bool generated )
virtual void setNull ( int i )
virtual void setNull ( const QString & name )
bool isNull ( int i ) const
bool isNull ( const QString & name ) const
int position ( const QString & name ) const
QString fieldName ( int i ) const
QSqlField * field ( int i )
QSqlField * field ( const QString & name )
const QSqlField * field ( int i ) const
const QSqlField * field ( const QString & name ) const
virtual void append ( const QSqlField & field )
virtual void insert ( int pos, const QSqlField & field )
virtual void remove ( int pos )
bool isEmpty () const
bool contains ( const QString & name ) const
virtual void clear ()
virtual void clearValues ( bool nullify = FALSE )
uint count () const
virtual QString toString ( const QString & prefix = QString::null, const
QString & sep = "," ) const
virtual QStringList toStringList ( const QString & prefix =
QString::null ) const
β¨ DESCRIPTION β¨
The QSqlRecord class encapsulates a database record, i.e. a set of database fields. fr fr that's the whole vibe π
So like β QSqlRecord wraps up all the functionality and characteristics of a database record (usually a table or view inside the database). QSqlRecords are out here supporting adding and removing fields, plus setting and retrieving field values. lowkey does everything π¦
QSqlRecord is implicitly shared. This means you can make copies of the record in time O(1) β no cap, it's that fast. And if multiple QSqlRecord instances share the same data and one of them starts modifying the record's data, then that modifying instance makes a copy and modifies its private copy β so it does not affect the other instances. main character energy, honestly π
See also QSqlRecordInfo and Database Classes.
β¨ MEMBER FUNCTION DOCUMENTATION β¨
πΈ QSqlRecord::QSqlRecord ()
Constructs an empty record. blank slate, empty canvas, we love a fresh start β¨
πΈ QSqlRecord::QSqlRecord ( const QSqlRecord & other )
Constructs a copy of other. twin moment π
πΈ QSqlRecord::~QSqlRecord () [virtual]
Destroys the object and frees any allocated resources. she's done, she's resting π
πΈ void QSqlRecord::append ( const QSqlField & field ) [virtual]
Append a copy of field field to the end of the record. yes bestie, a copy β go to the back of the line π
Reimplemented in QSqlIndex.
πΈ void QSqlRecord::clear () [virtual]
Removes all the record's fields. every single one. gone. π§Ή
See also clearValues().
Reimplemented in QSqlCursor.
πΈ void QSqlRecord::clearValues ( bool nullify = FALSE ) [virtual]
Clears the value of all fields in the record. If nullify is TRUE, (the default is FALSE), each field is set to NULL. so like, values wiped, but the fields themselves are still standing π«Ά
πΈ bool QSqlRecord::contains ( const QString & name ) const
Returns TRUE if there is a field in the record called name; otherwise returns FALSE. is she there or is she not π
πΈ uint QSqlRecord::count () const
Returns the number of fields in the record. headcount time π’
πΈ QSqlField * QSqlRecord::field ( int i )
Returns the field at position i within the record, or 0 if it cannot be found. and if she's not found, you get a 0, not a crash, we love that for us π
πΈ QSqlField * QSqlRecord::field ( const QString & name )
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the field called name within the record, or 0 if it cannot be found. Field names are not case-sensitive. iykyk π
πΈ const QSqlField * QSqlRecord::field ( int i ) const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
πΈ const QSqlField * QSqlRecord::field ( const QString & name ) const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the field called name within the record, or 0 if it cannot be found. Field names are not case-sensitive.
πΈ QString QSqlRecord::fieldName ( int i ) const
Returns the name of the field at position i. If the field does not exist, QString::null is returned. ghosted π«₯
πΈ void QSqlRecord::insert ( int pos, const QSqlField & field ) [virtual]
Insert a copy of field at position pos. If a field already exists at pos, it is removed. okay so she's cutting the line and kicking the old one out π
πΈ bool QSqlRecord::isEmpty () const
Returns TRUE if there are no fields in the record; otherwise returns FALSE.
πΈ bool QSqlRecord::isGenerated ( const QString & name ) const
Returns TRUE if the record has a field called name and this field is to be generated (the default); otherwise returns FALSE. β¨generated by defaultβ¨
See also setGenerated().
πΈ bool QSqlRecord::isGenerated ( int i ) const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns TRUE if the record has a field at position i and this field is to be generated (the default); otherwise returns FALSE.
See also setGenerated().
πΈ bool QSqlRecord::isNull ( const QString & name ) const
Returns TRUE if the field called name is NULL or if there is no field called name; otherwise returns FALSE. so "doesn't exist" and "is null" both count as TRUE here, bestie, don't get caught out π
See also position().
πΈ bool QSqlRecord::isNull ( int i ) const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns TRUE if the field i is NULL or if there is no field at position i; otherwise returns FALSE.
See also fieldName().
πΈ QSqlRecord & QSqlRecord::operator= ( const QSqlRecord & other )
Sets the record equal to other. becoming her, respectfully π
πΈ int QSqlRecord::position ( const QString & name ) const
Returns the position of the field called name 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. no duplicates drama, first come first served π
πΈ void QSqlRecord::remove ( int pos ) [virtual]
Removes the field at pos. If pos does not exist, nothing happens. no error, no drama, just nothing. iconic π¦
Reimplemented in QSqlCursor.
πΈ void QSqlRecord::setGenerated ( const QString & name, bool generated ) [virtual]
Sets the generated flag for the field called name to generated. If the field does not exist, nothing happens. Only fields that have generated set to TRUE are included in the SQL that is generated, e.g. by QSqlCursor. so this flag literally decides who makes the cut in the SQL π₯
See also isGenerated().
Reimplemented in QSqlCursor.
πΈ void QSqlRecord::setGenerated ( int i, bool generated ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Sets the generated flag for the field i to generated.
See also isGenerated().
Reimplemented in QSqlCursor.
πΈ void QSqlRecord::setNull ( int i ) [virtual]
Sets the value of field i to NULL. If the field does not exist, nothing happens.
πΈ void QSqlRecord::setNull ( const QString & name ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Sets the value of the field called name to NULL. If the field does not exist, nothing happens.
πΈ void QSqlRecord::setValue ( int i, const QVariant & val ) [virtual]
Sets the value of the field at position i to val. If the field does not exist, nothing happens.
Examples:
πΈ void QSqlRecord::setValue ( const QString & name, const QVariant & val ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Sets the value of the field called name to val. If the field does not exist, nothing happens.
πΈ QString QSqlRecord::toString ( const QString & prefix = QString::null, const QString & sep = "," ) const [virtual]
Returns a list of all the record's field names as a string separated by sep. π
Note that fields which are not generated are not included (see isGenerated()). The returned string is suitable, for example, for generating SQL SELECT statements. If a prefix is specified, e.g. a table name, all fields are prefixed in the form: prefix.<fieldname> π
πΈ QStringList QSqlRecord::toStringList ( const QString & prefix = QString::null ) const [virtual]
Returns a list of all the record's field names, each having the prefix prefix.
Note that fields which have generated set to FALSE are not included. (See isGenerated()). If prefix is supplied, e.g. a table name, all fields are prefixed in the form: prefix.<fieldname> β¨
πΈ QVariant QSqlRecord::value ( int i ) const [virtual]
Returns the value of the field located at position i in the record.
β οΈ If field i does not exist the resultant behaviour is undefined. like, genuinely undefined, do not test her π
This function should be used with QSqlQuerys. When working with a QSqlCursor the value(const QString&) overload which uses field names is more appropriate.
Example: sql/overview/update/main.cpp.
πΈ QVariant QSqlRecord::value ( const QString & name ) const [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the value of the field called name in the record.
β οΈ If field name does not exist the resultant behaviour is undefined. same warning, same energy π
β¨ SEE ALSO β¨
β¨ COPYRIGHT β¨
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. π
β¨ AUTHOR β¨
Generated automatically from the source code. (yes bestie, a robot wrote this, and she ate π€π )
β¨ BUGS β¨
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsqlrecord.3qt) and the Qt version (3.3.8). π
and that's the whole page, bestie!! π this lil' beauty dropped from Trolltech AS on 2 February 2007, and it's the QSqlRecord(3qt) manual β go forth and query, you absolute icon πβ¨π¦
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms