QSqlDatabase
Section: Misc. Reference Manual Pages (3qt)
Updated: 2 February 2007
Index
Return to Main Contents
NAME
QSqlDatabase - Used to create SQL database connections and to provide transaction handling
SYNOPSIS
#include <qsqldatabase.h>
Inherits QObject.
Public Members
~QSqlDatabase ()
bool open ()
bool open ( const QString & user, const QString & password )
void close ()
bool isOpen () const
bool isOpenError () const
QStringList tables () const
QStringList tables ( QSql::TableType type ) const
QSqlIndex primaryIndex ( const QString & tablename ) const
QSqlRecord record ( const QString & tablename ) const
QSqlRecord record ( const QSqlQuery & query ) const
QSqlRecordInfo recordInfo ( const QString & tablename ) const
QSqlRecordInfo recordInfo ( const QSqlQuery & query ) const
QSqlQuery exec ( const QString & query = QString::null ) const
QSqlError lastError () const
bool transaction ()
bool commit ()
bool rollback ()
virtual void setDatabaseName ( const QString & name )
virtual void setUserName ( const QString & name )
virtual void setPassword ( const QString & password )
virtual void setHostName ( const QString & host )
virtual void setPort ( int p )
void setConnectOptions ( const QString & options = QString::null )
QString databaseName () const
QString userName () const
QString password () const
QString hostName () const
QString driverName () const
int port () const
QString connectOptions () const
QSqlDriver * driver () const
Static Public Members
QSqlDatabase * addDatabase ( const QString & type, const QString & connectionName = defaultConnection )
QSqlDatabase * addDatabase ( QSqlDriver * driver, const QString & connectionName = defaultConnection )
QSqlDatabase * database ( const QString & connectionName = defaultConnection, bool open = TRUE )
void removeDatabase ( const QString & connectionName )
void removeDatabase ( QSqlDatabase * db )
bool contains ( const QString & connectionName = defaultConnection )
QStringList drivers ()
void registerSqlDriver ( const QString & name, const QSqlDriverCreatorBase * creator )
bool isDriverAvailable ( const QString & name )
Properties
QString connectOptions - the database connect options
QString databaseName - the name of the database
QString hostName - the host name where the database resides
QString password - the password used to connect to the database
int port - the port used to connect to the database
QString userName - the user name connected to the database
Protected Members
QSqlDatabase ( const QString & type, const QString & name, QObject * parent = 0, const char * objname = 0 )
QSqlDatabase ( QSqlDriver