Eneboo - Documentación para desarrolladores
src/qt/src/sql/drivers/mysql/qsql_mysql.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 **
00003 ** Definition of MySQL driver classes
00004 **
00005 ** Created : 001103
00006 **
00007 ** Copyright (C) 1992-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 QSQL_MYSQL_H
00038 #define QSQL_MYSQL_H
00039 
00040 #include <qsqldriver.h>
00041 #include <qsqlresult.h>
00042 #include <qsqlfield.h>
00043 #include <qsqlindex.h>
00044 
00045 #if defined (Q_OS_WIN32)
00046 #include <qt_windows.h>
00047 #endif
00048 
00049 #include <mysql.h>
00050 
00051 #ifdef QT_PLUGIN
00052 #define Q_EXPORT_SQLDRIVER_MYSQL
00053 #else
00054 #define Q_EXPORT_SQLDRIVER_MYSQL Q_EXPORT
00055 #endif
00056 
00057 class QMYSQLDriverPrivate;
00058 class QMYSQLResultPrivate;
00059 class QMYSQLDriver;
00060 class QSqlRecordInfo;
00061 
00062 class QMYSQLResult : public QSqlResult
00063 {
00064     friend class QMYSQLDriver;
00065 public:
00066     QMYSQLResult( const QMYSQLDriver* db );
00067     ~QMYSQLResult();
00068 
00069     MYSQL_RES* result();
00070 protected:
00071     void                cleanup();
00072     bool                fetch( int i );
00073     bool                fetchNext();
00074     bool                fetchLast();
00075     bool                fetchFirst();
00076     QVariant            data( int field );
00077     bool                isNull( int field );
00078     bool                reset ( const QString& query );
00079     int                 size();
00080     int                 numRowsAffected();
00081 private:
00082     QMYSQLResultPrivate* d;
00083 };
00084 
00085 class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
00086 {
00087 Q_OBJECT
00088 
00089     friend class QMYSQLResult;
00090 public:
00091     QMYSQLDriver( QObject * parent=0, const char * name=0 );
00092     QMYSQLDriver( MYSQL * con, QObject * parent=0, const char * name=0 );
00093     ~QMYSQLDriver();
00094     bool                hasFeature( DriverFeature f ) const;
00095     bool                open( const QString & db,
00096                               const QString & user = QString::null,
00097                               const QString & password = QString::null,
00098                               const QString & host = QString::null,
00099                               int port = -1 );
00100     void                close();
00101     QSqlQuery           createQuery() const;
00102     QStringList         tables( const QString& user ) const;
00103     QSqlIndex           primaryIndex( const QString& tablename ) const;
00104     QSqlRecord          record( const QString& tablename ) const;
00105     QSqlRecord          record( const QSqlQuery& query ) const;
00106     QSqlRecordInfo      recordInfo( const QString& tablename ) const;
00107     QSqlRecordInfo      recordInfo( const QSqlQuery& query ) const;
00108     QString             formatValue( const QSqlField* field,
00109                                      bool trimStrings ) const;
00110     MYSQL*              mysql();
00111     // ### remove me for 4.0
00112     bool open( const QString& db,
00113                const QString& user,
00114                const QString& password,
00115                const QString& host,
00116                int port,
00117                const QString& connOpts );
00118     
00119 protected:
00120     bool                beginTransaction();
00121     bool                commitTransaction();
00122     bool                rollbackTransaction();
00123 private:
00124     void                init();
00125     QMYSQLDriverPrivate* d;
00126 };
00127 
00128 
00129 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'