⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qsqldriver.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
字号:
'\" t.TH QSqlDriver 3qt "9 December 2002" "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 NAMEQSqlDriver \- Abstract base class for accessing SQL databases.SH SYNOPSIS\fC#include <qsqldriver.h>\fR.PPInherits QObject..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBDriverFeature\fR { Transactions, QuerySize, BLOB, Unicode, PreparedQueries, NamedPlaceholders, PositionalPlaceholders }".br.ti -1c.BI "\fBQSqlDriver\fR ( QObject * parent = 0, const char * name = 0 )".br.ti -1c.BI "\fB~QSqlDriver\fR ()".br.ti -1c.BI "bool \fBisOpen\fR () const".br.ti -1c.BI "bool \fBisOpenError\fR () const".br.ti -1c.BI "virtual bool \fBbeginTransaction\fR ()".br.ti -1c.BI "virtual bool \fBcommitTransaction\fR ()".br.ti -1c.BI "virtual bool \fBrollbackTransaction\fR ()".br.ti -1c.BI "virtual QStringList \fBtables\fR ( const QString & user ) const".br.ti -1c.BI "virtual QSqlIndex \fBprimaryIndex\fR ( const QString & tableName ) const".br.ti -1c.BI "virtual QSqlRecord \fBrecord\fR ( const QString & tableName ) const".br.ti -1c.BI "virtual QSqlRecord \fBrecord\fR ( const QSqlQuery & query ) const".br.ti -1c.BI "virtual QSqlRecordInfo \fBrecordInfo\fR ( const QString & tablename ) const".br.ti -1c.BI "virtual QSqlRecordInfo \fBrecordInfo\fR ( const QSqlQuery & query ) const".br.ti -1c.BI "virtual QString \fBnullText\fR () const".br.ti -1c.BI "virtual QString \fBformatValue\fR ( const QSqlField * field, bool trimStrings = FALSE ) const".br.ti -1c.BI "QSqlError \fBlastError\fR () const".br.ti -1c.BI "virtual bool \fBhasFeature\fR ( DriverFeature f ) const = 0".br.ti -1c.BI "virtual bool \fBopen\fR ( const QString & db, const QString & user = QString::null, const QString & password = QString::null, const QString & host = QString::null, int port = -1 ) = 0".br.ti -1c.BI "virtual void \fBclose\fR () = 0".br.ti -1c.BI "virtual QSqlQuery \fBcreateQuery\fR () const = 0".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBsetOpen\fR ( bool o )".br.ti -1c.BI "virtual void \fBsetOpenError\fR ( bool e )".br.ti -1c.BI "virtual void \fBsetLastError\fR ( const QSqlError & e )".br.in -1c.SH DESCRIPTIONThe QSqlDriver class is an abstract base class for accessing SQL databases..PPThis class should not be used directly. Use QSqlDatabase instead..PPSee also Database Classes..SS "Member Type Documentation".SH "QSqlDriver::DriverFeature"This enum contains a list of features a driver may support. Use hasFeature() to query whether a feature is supported or not..TP\fCQSqlDriver::Transactions\fR - whether the driver supports SQL transactions.TP\fCQSqlDriver::QuerySize\fR - whether the database is capable of reporting the size of a query. Note that some databases do not support returning the size (i.e. number of rows returned) of a query, in which case QSqlQuery::size() will return -1.TP\fCQSqlDriver::BLOB\fR - whether the driver supports Binary Large Object fields.TP\fCQSqlDriver::Unicode\fR - whether the driver supports Unicode strings if the database server does.TP\fCQSqlDriver::PreparedQueries\fR - whether the driver supports prepared query execution.TP\fCQSqlDriver::NamedPlaceholders\fR - whether the driver supports usage of named placeholders.TP\fCQSqlDriver::PositionalPlaceholders\fR - whether the driver supports usage of positional placeholders.PPMore information about supported features can be found in the Qt SQL driver documentation..PPSee also hasFeature()..SH MEMBER FUNCTION DOCUMENTATION.SH "QSqlDriver::QSqlDriver ( QObject * parent = 0, const char * name = 0 )"Default constructor. Creates a new driver with parent \fIparent\fR, called \fIname\fR..SH "QSqlDriver::~QSqlDriver ()"Destroys the object and frees any allocated resources..SH "bool QSqlDriver::beginTransaction ()\fC [virtual]\fR"Protected function which derived classes can reimplement to begin a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE..PPSee also commitTransaction() and rollbackTransaction()..SH "void QSqlDriver::close ()\fC [pure virtual]\fR"Derived classes must reimplement this abstract virtual function in order to close the database connection. Return TRUE on success, FALSE on failure..PPSee also setOpen()..SH "bool QSqlDriver::commitTransaction ()\fC [virtual]\fR"Protected function which derived classes can reimplement to commit a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE..PPSee also beginTransaction() and rollbackTransaction()..SH "QSqlQuery QSqlDriver::createQuery () const\fC [pure virtual]\fR"Creates an empty SQL result on the database. Derived classes must reimplement this function and return a QSqlQuery object appropriate for their database to the caller..SH "QString QSqlDriver::formatValue ( const QSqlField * field, bool trimStrings = FALSE ) const\fC [virtual]\fR"Returns a string representation of the \fIfield\fR value for the database. This is used, for example, when constructing INSERT and UPDATE statements..PPThe default implementation returns the value formatted as a string according to the following rules:.IP.TPIf \fIfield\fR is NULL, nullText() is returned..IP.TPIf \fIfield\fR is character data, the value is returned enclosed in single quotation marks, which is appropriate for many SQL databases. Any embedded single-quote characters are escaped (replaced with two single-quote characters). If \fItrimStrings\fR is TRUE (the default is FALSE), all trailing whitespace is trimmed from the field..IP.TPIf \fIfield\fR is date/time data, the value is formatted in ISO format and enclosed in single quotation marks. If the date/time data is invalid, nullText() is returned..IP.TPIf \fIfield\fR is bytearray data, and the driver can edit binary fields, the value is formatted as a hexadecimal string..IP.TPFor any other field type toString() will be called on its value and the result returned..IP.PPSee also QVariant::toString()..SH "bool QSqlDriver::hasFeature ( DriverFeature f ) const\fC [pure virtual]\fR"Returns TRUE if the driver supports feature \fIf\fR; otherwise returns FALSE..PPNote that some databases need to be open() before this can be determined..PPSee also DriverFeature..SH "bool QSqlDriver::isOpen () const"Returns TRUE if the database connection is open; otherwise returns FALSE..SH "bool QSqlDriver::isOpenError () const"Returns TRUE if the there was an error opening the database connection; otherwise returns FALSE..SH "QSqlError QSqlDriver::lastError () const"Returns a QSqlError object which contains information about the last error that occurred on the database..SH "QString QSqlDriver::nullText () const\fC [virtual]\fR"Returns a string representation of the NULL value for the database. This is used, for example, when constructing INSERT and UPDATE statements. The default implementation returns the string" NULL"..SH "bool QSqlDriver::open ( const QString & db, const QString & user = QString::null, const QString & password = QString::null, const QString & host = QString::null, int port = -1 )\fC [pure virtual]\fR"Derived classes must reimplement this abstract virtual function in order to open a database connection on database \fIdb\fR, using user name \fIuser\fR, password \fIpassword\fR, host \fIhost\fR and port \fIport\fR..PPThe function \fImust\fR return TRUE on success and FALSE on failure..PPSee also setOpen()..SH "QSqlIndex QSqlDriver::primaryIndex ( const QString & tableName ) const\fC [virtual]\fR"Returns the primary index for table \fItableName\fR. Returns an empty QSqlIndex if the table doesn't have a primary index. The default implementation returns an empty index..SH "QSqlRecord QSqlDriver::record ( const QString & tableName ) const\fC [virtual]\fR"Returns a QSqlRecord populated with the names of the fields in table \fItableName\fR. If no such table exists, an empty record is returned. The default implementation returns an empty record..SH "QSqlRecord QSqlDriver::record ( const QSqlQuery & query ) const\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a QSqlRecord populated with the names of the fields in the SQL \fIquery\fR. The default implementation returns an empty record..SH "QSqlRecordInfo QSqlDriver::recordInfo ( const QString & tablename ) const\fC [virtual]\fR"Returns a QSqlRecordInfo object with meta data about the table \fItablename\fR..SH "QSqlRecordInfo QSqlDriver::recordInfo ( const QSqlQuery & query ) const\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a QSqlRecordInfo object with meta data for the QSqlQuery \fIquery\fR. Note that this overloaded function may return less information than the recordInfo() function which takes the name of a table as parameter..SH "bool QSqlDriver::rollbackTransaction ()\fC [virtual]\fR"Protected function which derived classes can reimplement to rollback a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE..PPSee also beginTransaction() and commitTransaction()..SH "void QSqlDriver::setLastError ( const QSqlError & e )\fC [virtual protected]\fR"Protected function which allows derived classes to set the value of the last error, \fIe\fR, that occurred on the database..PPSee also lastError()..SH "void QSqlDriver::setOpen ( bool o )\fC [virtual protected]\fR"Protected function which sets the open state of the database to \fIo\fR. Derived classes can use this function to report the status of open()..PPSee also open() and setOpenError()..SH "void QSqlDriver::setOpenError ( bool e )\fC [virtual protected]\fR"Protected function which sets the open error state of the database to \fIe\fR. Derived classes can use this function to report the status of open(). Note that if \fIe\fR is TRUE the open state of the database is set to closed (i.e. isOpen() returns FALSE)..PPSee also open()..SH "QStringList QSqlDriver::tables ( const QString & user ) const\fC [virtual]\fR"Returns a list of tables in the database. The default implementation returns an empty list..PPCurrently the \fIuser\fR argument is unused..SH "SEE ALSO".BR http://doc.trolltech.com/qsqldriver.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 (qsqldriver.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -