Eneboo - Documentación para desarrolladores
src/qt/src/sql/qsqldriver.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 **
00003 ** Definition of QSqlDriver class
00004 **
00005 ** Created : 2000-11-03
00006 **
00007 ** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
00008 **
00009 ** This file is part of the sql module of the Qt GUI Toolkit.
00010 **
00011 ** This file may be distributed under the terms of the Q Public License
00012 ** as defined by Trolltech ASA of Norway and appearing in the file
00013 ** LICENSE.QPL included in the packaging of this file.
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00021 ** file in accordance with the Qt Commercial License Agreement provided
00022 ** with the Software.
00023 **
00024 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00025 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00026 **
00027 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00028 **   information about Qt Commercial License Agreements.
00029 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00030 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00031 **
00032 ** Contact info@trolltech.com if any conditions of this licensing are
00033 ** not clear to you.
00034 **
00035 **********************************************************************/
00036 
00037 #ifndef QSQLDRIVER_H
00038 #define QSQLDRIVER_H
00039 
00040 #ifndef QT_H
00041 #include "qobject.h"
00042 #include "qptrdict.h"
00043 #include "qstring.h"
00044 #include "qsqlerror.h"
00045 #include "qsqlquery.h"
00046 #include "qsqlfield.h"
00047 #include "qsqlindex.h"
00048 #include "qstringlist.h"
00049 #include "qmap.h"
00050 #endif // QT_H
00051 
00052 #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
00053 #define QM_EXPORT_SQL
00054 #else
00055 #define QM_EXPORT_SQL Q_EXPORT
00056 #endif
00057 
00058 #ifndef QT_NO_SQL
00059 
00060 class QSqlDriverExtension;
00061 
00062 class QSqlDatabase;
00063 
00064 class QM_EXPORT_SQL QSqlDriver : public QObject
00065 {
00066     friend class QSqlDatabase;
00067     Q_OBJECT
00068 public:
00069     enum DriverFeature { Transactions, QuerySize, BLOB, Unicode, PreparedQueries,
00070                          NamedPlaceholders, PositionalPlaceholders };
00071 
00072     QSqlDriver( QObject * parent=0, const char * name=0 );
00073     ~QSqlDriver();
00074     bool                        isOpen() const;
00075     bool                        isOpenError() const;
00076 
00077     virtual bool                beginTransaction();
00078     virtual bool                commitTransaction();
00079     virtual bool                rollbackTransaction();
00080     virtual QStringList         tables( const QString& tableType ) const;
00081     virtual QSqlIndex           primaryIndex( const QString& tableName ) const;
00082     virtual QSqlRecord          record( const QString& tableName ) const;
00083     virtual QSqlRecord          record( const QSqlQuery& query ) const;
00084     virtual QSqlRecordInfo      recordInfo( const QString& tablename ) const;
00085     virtual QSqlRecordInfo      recordInfo( const QSqlQuery& query ) const;
00086     virtual QString             nullText() const;
00087     virtual QString             formatValue( const QSqlField* field, bool trimStrings = FALSE ) const;
00088     QSqlError                   lastError() const;
00089 
00090     virtual bool                hasFeature( DriverFeature f ) const = 0;
00091     virtual bool                open( const QString & db,
00092                                       const QString & user = QString::null,
00093                                       const QString & password = QString::null,
00094                                       const QString & host = QString::null,
00095                                       int port = -1 ) = 0;
00096     virtual void                close() = 0;
00097     virtual QSqlQuery           createQuery() const = 0;
00098 
00099     // ### remove for 4.0
00100     bool                        open( const QString& db,
00101                                       const QString& user,
00102                                       const QString& password,
00103                                       const QString& host,
00104                                       int port,
00105                                       const QString& connOpts );
00106 protected:
00107     virtual void                setOpen( bool o );
00108     virtual void                setOpenError( bool e );
00109     virtual void                setLastError( const QSqlError& e );
00110 private:
00111     // ### This class needs a d-pointer in 4.0.
00112     int                   dbState;
00113     QSqlError             error;
00114 #if defined(Q_DISABLE_COPY)
00115     QSqlDriver( const QSqlDriver & );
00116     QSqlDriver &operator=( const QSqlDriver & );
00117 #endif
00118 };
00119 
00120 #endif  // QT_NO_SQL
00121 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'