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

📄 qsqldatabase.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
Returns TRUE if the list of database connections contains \fIconnectionName\fR; otherwise returns FALSE..SH "QSqlDatabase * QSqlDatabase::database ( const QString & connectionName = defaultConnection, bool open = TRUE )\fC [static]\fR"Returns the database connection called \fIconnectionName\fR. The database connection must have been previously added with addDatabase(). If \fIopen\fR is TRUE (the default) and the database connection is not already open it is opened now. If no \fIconnectionName\fR is specified the default connection is used. If \fIconnectionName\fR does not exist in the list of databases, 0 is returned. The pointer returned is owned by QSqlDatabase and should \fInot\fR be deleted..PPExamples:.)l sql/overview/basicbrowsing/main.cpp and sql/overview/create_connections/main.cpp..SH "QString QSqlDatabase::databaseName () const"Returns the name of the database. See the "databaseName" property for details..SH "QSqlDriver * QSqlDatabase::driver () const"Returns the database driver used to access the database connection..SH "QString QSqlDatabase::driverName () const"Returns the name of the driver used by the database connection..SH "QStringList QSqlDatabase::drivers ()\fC [static]\fR"Returns a list of all available database drivers..PPNote that if you want to iterate over the list, you should iterate over a copy, e.g..PP.nf.br    QStringList list = myDatabase.drivers();.br    QStringList::Iterator it = list.begin();.br    while( it != list.end() ) {.br        myProcessing( *it );.br        ++it;.br    }.br.fi.SH "QSqlQuery QSqlDatabase::exec ( const QString & query = QString::null ) const"Executes a SQL statement (e.g. an INSERT, UPDATE or DELETE statement) on the database, and returns a QSqlQuery object. Use lastError() to retrieve error information. If \fIquery\fR is QString::null, an empty, invalid query is returned and lastError() is not affected..PPSee also QSqlQuery and lastError()..SH "QString QSqlDatabase::hostName () const"Returns the host name where the database resides. See the "hostName" property for details..SH "bool QSqlDatabase::isOpen () const"Returns TRUE if the database connection is currently open; otherwise returns FALSE..SH "bool QSqlDatabase::isOpenError () const"Returns TRUE if there was an error opening the database connection; otherwise returns FALSE. Error information can be retrieved using the lastError() function..SH "QSqlError QSqlDatabase::lastError () const"Returns information about the last error that occurred on the database. See QSqlError for more information..PPExamples:.)l sql/overview/connection.cpp and sql/sqltable/main.cpp..SH "bool QSqlDatabase::open ()"Opens the database connection using the current connection values. Returns TRUE on success; otherwise returns FALSE. Error information can be retrieved using the lastError() function..PPSee also lastError()..PPExamples:.)l sql/overview/connect1/main.cpp, sql/overview/connection.cpp, and sql/sqltable/main.cpp..SH "bool QSqlDatabase::open ( const QString & user, const QString & password )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPOpens the database connection using \fIuser\fR name and \fIpassword\fR. Returns TRUE on success; otherwise returns FALSE. Error information can be retrieved using the lastError() function..PPSee also lastError()..SH "QString QSqlDatabase::password () const"Returns the password used to connect to the database. See the "password" property for details..SH "int QSqlDatabase::port () const"Returns the port used to connect to the database. See the "port" property for details..SH "QSqlIndex QSqlDatabase::primaryIndex ( const QString & tablename ) const"Returns the primary index for table \fItablename\fR. If no primary index exists an empty QSqlIndex will be returned..SH "QSqlRecord QSqlDatabase::record ( const QString & tablename ) const"Returns a QSqlRecord populated with the names of all the fields in the table (or view) named \fItablename\fR. The order in which the fields are returned is undefined. If no such table (or view) exists, an empty record is returned..PPSee also recordInfo()..SH "QSqlRecord QSqlDatabase::record ( const QSqlQuery & query ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a QSqlRecord populated with the names of all the fields used in the SQL \fIquery\fR. If the query is a "SELECT *" the order in which fields are returned is undefined..PPSee also recordInfo()..SH "QSqlRecordInfo QSqlDatabase::recordInfo ( const QString & tablename ) const"Returns a QSqlRecordInfo populated with meta data about the table or view \fItablename\fR. If no such table or view exists, an empty record is returned..PPSee also QSqlRecordInfo, QSqlFieldInfo, and record()..SH "QSqlRecordInfo QSqlDatabase::recordInfo ( const QSqlQuery & query ) const"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..PPSee also QSqlRecordInfo, QSqlFieldInfo, and record()..SH "void QSqlDatabase::removeDatabase ( const QString & connectionName )\fC [static]\fR"Removes the database connection \fIconnectionName\fR from the list of database connections..PP\fBWarning:\fR There should be no open queries on the database connection when this function is called, otherwise a resource leak will occur..SH "bool QSqlDatabase::rollback ()"Rolls a transaction back on the database if the driver supports transactions. Returns TRUE if the operation succeeded; otherwise returns FALSE..PPSee also QSqlDriver::hasFeature(), commit(), and transaction()..SH "void QSqlDatabase::setDatabaseName ( const QString & name )\fC [virtual]\fR"Sets the name of the database to \fIname\fR. See the "databaseName" property for details..SH "void QSqlDatabase::setHostName ( const QString & host )\fC [virtual]\fR"Sets the host name where the database resides to \fIhost\fR. See the "hostName" property for details..SH "void QSqlDatabase::setPassword ( const QString & password )\fC [virtual]\fR"Sets the password used to connect to the database to \fIpassword\fR. See the "password" property for details..SH "void QSqlDatabase::setPort ( int p )\fC [virtual]\fR"Sets the port used to connect to the database to \fIp\fR. See the "port" property for details..SH "void QSqlDatabase::setUserName ( const QString & name )\fC [virtual]\fR"Sets the user name connected to the database to \fIname\fR. See the "userName" property for details..SH "QStringList QSqlDatabase::tables () const"Returns a list of tables in the database..PPNote that if you want to iterate over the list, you should iterate over a copy, e.g..PP.nf.br    QStringList list = myDatabase.tables();.br    QStringList::Iterator it = list.begin();.br    while( it != list.end() ) {.br        myProcessing( *it );.br        ++it;.br    }.br.fi.SH "bool QSqlDatabase::transaction ()"Begins a transaction on the database if the driver supports transactions. Returns TRUE if the operation succeeded; otherwise returns FALSE..PPSee also QSqlDriver::hasFeature(), commit(), and rollback()..SH "QString QSqlDatabase::userName () const"Returns the user name connected to the database. See the "userName" property for details..SS "Property Documentation".SH "QString databaseName"This property holds the name of the database..PPNote that the database name is the TNS Service Name for the QOCI8 (Oracle) driver, and the DSN or DSN filename for the QODBC3 driver. If a DSN filename is used, the file have to have a .dsn extension..PPThere is no default value..PPSet this property's value with setDatabaseName() and get this property's value with databaseName()..SH "QString hostName"This property holds the host name where the database resides..PPThere is no default value..PPSet this property's value with setHostName() and get this property's value with hostName()..SH "QString password"This property holds the password used to connect to the database..PPThere is no default value..PPSet this property's value with setPassword() and get this property's value with password()..SH "int port"This property holds the port used to connect to the database..PPThere is no default value..PPSet this property's value with setPort() and get this property's value with port()..SH "QString userName"This property holds the user name connected to the database..PPThere is no default value..PPSet this property's value with setUserName() and get this property's value with userName()..SH "SEE ALSO".BR http://doc.trolltech.com/qsqldatabase.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 (qsqldatabase.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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