📄 qsqlrecord.3qt
字号:
'\" t.TH QSqlRecord 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQSqlRecord \- Encapsulates a database record, i.e. a set of database fields.PP\fC#include <qsqlrecord.h>\fR.PPInherited by QSqlCursor and QSqlIndex..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQSqlRecord\fR ()".br.ti -1c.BI "\fBQSqlRecord\fR ( const QSqlRecord & other )".br.ti -1c.BI "QSqlRecord & \fBoperator=\fR ( const QSqlRecord & other )".br.ti -1c.BI "virtual \fB~QSqlRecord\fR ()".br.ti -1c.BI "virtual QVariant \fBvalue\fR ( int i ) const".br.ti -1c.BI "virtual QVariant \fBvalue\fR ( const QString & name ) const".br.ti -1c.BI "virtual void \fBsetValue\fR ( int i, const QVariant & val )".br.ti -1c.BI "virtual void \fBsetValue\fR ( const QString & name, const QVariant & val )".br.ti -1c.BI "bool \fBisGenerated\fR ( int i ) const".br.ti -1c.BI "bool \fBisGenerated\fR ( const QString & name ) const".br.ti -1c.BI "virtual void \fBsetGenerated\fR ( const QString & name, bool generated )".br.ti -1c.BI "virtual void \fBsetGenerated\fR ( int i, bool generated )".br.ti -1c.BI "virtual void \fBsetNull\fR ( int i )".br.ti -1c.BI "virtual void \fBsetNull\fR ( const QString & name )".br.ti -1c.BI "bool \fBisNull\fR ( int i )".br.ti -1c.BI "bool \fBisNull\fR ( const QString & name )".br.ti -1c.BI "int \fBposition\fR ( const QString & name ) const".br.ti -1c.BI "QString \fBfieldName\fR ( int i ) const".br.ti -1c.BI "QSqlField * \fBfield\fR ( int i )".br.ti -1c.BI "QSqlField * \fBfield\fR ( const QString & name )".br.ti -1c.BI "const QSqlField * \fBfield\fR ( int i ) const".br.ti -1c.BI "const QSqlField * \fBfield\fR ( const QString & name ) const".br.ti -1c.BI "virtual void \fBappend\fR ( const QSqlField & field )".br.ti -1c.BI "virtual void \fBinsert\fR ( int pos, const QSqlField & field )".br.ti -1c.BI "virtual void \fBremove\fR ( int pos )".br.ti -1c.BI "bool \fBisEmpty\fR () const".br.ti -1c.BI "bool \fBcontains\fR ( const QString & name ) const".br.ti -1c.BI "virtual void \fBclear\fR ()".br.ti -1c.BI "virtual void \fBclearValues\fR ( bool nullify = FALSE )".br.ti -1c.BI "uint \fBcount\fR () const".br.ti -1c.BI "virtual QString \fBtoString\fR ( const QString & prefix = QString::null, const QString & sep = "","" ) const".br.ti -1c.BI "virtual QStringList \fBtoStringList\fR ( const QString & prefix = QString::null ) const".br.in -1c.SH DESCRIPTIONThe QSqlRecord class encapsulates a database record, i.e. a set of database fields..PPThe QSqlRecord class encapsulates the functionality and characteristics of a database record (usually a table or view within the database). QSqlRecords support adding and removing fields as well as setting and retrieving field values..PPQSqlRecord is implicitly shared. This means you can make copies of the record in time O(1). If multiple QSqlRecord instances share the same data and one is modifying the record's data then this modifying instance makes a copy and modifies its private copy - thus it does not affect other instances..PPSee also Database Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QSqlRecord::QSqlRecord ()"Constructs an empty record..SH "QSqlRecord::QSqlRecord ( const QSqlRecord & other )"Constructs a copy of \fIother\fR..SH "QSqlRecord::~QSqlRecord ()\fC [virtual]\fR"Destroys the object and frees any allocated resources..SH "void QSqlRecord::append ( const QSqlField & field )\fC [virtual]\fR"Append a copy of field \fIfield\fR to the end of the record..PPReimplemented in QSqlIndex..SH "void QSqlRecord::clear ()\fC [virtual]\fR"Removes all fields from the record..PPSee also clearValues()..PPReimplemented in QSqlCursor..SH "void QSqlRecord::clearValues ( bool nullify = FALSE )\fC [virtual]\fR"Clears the value of all fields in the record. If \fInullify\fR is TRUE, (it's default is FALSE), each field is set to null..SH "bool QSqlRecord::contains ( const QString & name ) const"Returns TRUE if there is a field in the record called \fIname\fR, otherwise returns FALSE..SH "uint QSqlRecord::count () const"Returns the number of fields in the record..SH "QSqlField * QSqlRecord::field ( int i )"Returns a pointer to the field at position \fIi\fR within the record, or 0 if it cannot be found..SH "QSqlField * QSqlRecord::field ( const QString & name )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a pointer to the field with name \fIname\fR within the record, or 0 if it cannot be found. Field names are not case-sensitive..SH "const QSqlField * QSqlRecord::field ( int i ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..SH "const QSqlField * QSqlRecord::field ( const QString & name ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a pointer to the field with name \fIname\fR within the record, or 0 if it cannot be found. Field names are not case-sensitive..SH "QString QSqlRecord::fieldName ( int i ) const"Returns the name of the field at position \fIi\fR. If the field does not exist, QString::null is returned..SH "void QSqlRecord::insert ( int pos, const QSqlField & field )\fC [virtual]\fR"Insert a copy of \fIfield\fR at position \fIpos\fR. If a field already exists at \fIpos\fR, it is removed..SH "bool QSqlRecord::isEmpty () const"Returns TRUE if there are no fields in the record, otherwise returns FALSE..SH "bool QSqlRecord::isGenerated ( const QString & name ) const"Returns TRUE if the field \fIname\fR is to be generated (the default), otherwise returns FALSE. If the field does not exist, FALSE is returned..PPSee also setGenerated()..SH "bool QSqlRecord::isGenerated ( int i ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns TRUE if the field with the index \fIi\fR is to be generated (the default), otherwise returns FALSE. If the field does not exist, FALSE is returned..PPSee also setGenerated()..SH "bool QSqlRecord::isNull ( const QString & name )"Returns TRUE if the field \fIname\fR is currently null, otherwise returns FALSE. If the field \fIname\fR doesn't exist the return value is TRUE..PPSee also position()..SH "bool QSqlRecord::isNull ( int i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns TRUE if the field \fIi\fR is currently null, otherwise returns FALSE. If the index \fIi\fR doesn't exist the return value is TRUE..PPSee also fieldName()..SH "QSqlRecord & QSqlRecord::operator= ( const QSqlRecord & other )"Sets the record equal to \fIother\fR..SH "int QSqlRecord::position ( const QString & name ) const"Returns the position of the field named \fIname\fR 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..SH "void QSqlRecord::remove ( int pos )\fC [virtual]\fR"Removes the field at \fIpos\fR. If \fIpos\fR does not exist, nothing happens..PPReimplemented in QSqlCursor..SH "void QSqlRecord::setGenerated ( const QString & name, bool generated )\fC [virtual]\fR"Sets the generated flag for the field \fIname\fR to \fIgenerated\fR. If the field does not exist, nothing happens. Only fields that have \fIgenerated\fR set to TRUE are included in the SQL that is generated, e.g. by QSqlCursor..PPSee also isGenerated()..PPReimplemented in QSqlCursor..SH "void QSqlRecord::setGenerated ( int i, bool generated )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the generated flag for the field \fIi\fR to \fIgenerated\fR..PPSee also isGenerated()..PPReimplemented in QSqlCursor..SH "void QSqlRecord::setNull ( int i )\fC [virtual]\fR"Sets the value of field \fIi\fR to NULL. If the field does not exist, nothing happens..SH "void QSqlRecord::setNull ( const QString & name )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the value of field \fIname\fR to NULL. If the field does not exist, nothing happens..SH "void QSqlRecord::setValue ( int i, const QVariant & val )\fC [virtual]\fR"Sets the value of the field at position \fIi\fR to \fIval\fR. If the field does not exist, nothing happens..PPExamples:.)l sql/overview/extract/main.cpp, sql/overview/insert/main.cpp, sql/overview/insert2/main.cpp, sql/overview/order2/main.cpp, sql/overview/subclass5/main.cpp, sql/overview/update/main.cpp and sql/sqltable/main.cpp..SH "void QSqlRecord::setValue ( const QString & name, const QVariant & val )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the value of field \fIname\fR to \fIval\fR. If the field does not exist, nothing happens..SH "QString QSqlRecord::toString ( const QString & prefix = QString::null, const QString & sep = "," ) const\fC [virtual]\fR"Returns a list of all the record's field names as a string separated by \fIsep\fR..PPNote that fields which are not generated are \fInot\fR included (see isGenerated() ). The returned string is suitable, for example, for generating SQL SELECT statements. If a \fIprefix\fR is specified, e.g. a table name, all fields are prefixed in the form:.PP"\fIprefix\fR. <fieldname>".SH "QStringList QSqlRecord::toStringList ( const QString & prefix = QString::null ) const\fC [virtual]\fR"Returns a list of all the record's field names, each having the prefix \fIprefix\fR..PPNote that fields which have generated set to FALSE are \fInot\fR included. (See isGenerated() ). If \fIprefix\fR is supplied, e.g. a table name, all fields are prefixed in the form:.PP"\fIprefix\fR. <fieldname>".SH "QVariant QSqlRecord::value ( int i ) const\fC [virtual]\fR"Returns the value of the field located at position \fIi\fR in the record. If field \fIi\fR does not exist the resultant behaviour is undefined..PPThis function should be used with QSqlQuerys. When working with a QSqlCursor the value(const QString&) overload which uses field names is more appropriate..PPExample: sql/overview/update/main.cpp..SH "QVariant QSqlRecord::value ( const QString & name ) const\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the value of the field named \fIname\fR in the record. If field \fIname\fR does not exist the resultant behaviour is undefined..PP.SH "SEE ALSO".BR http://doc.trolltech.com/qsqlrecord.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qsqlrecord.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -