Guest User

erro

a guest
Oct 2nd, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.65 KB | None | 0 0
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  4. ** Contact: http://www.qt-project.org/legal
  5. **
  6. ** This file is part of the QtSql module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:LGPL$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and Digia.  For licensing terms and
  14. ** conditions see http://qt.digia.com/licensing.  For further information
  15. ** use the contact form at http://qt.digia.com/contact-us.
  16. **
  17. ** GNU Lesser General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU Lesser
  19. ** General Public License version 2.1 as published by the Free Software
  20. ** Foundation and appearing in the file LICENSE.LGPL included in the
  21. ** packaging of this file.  Please review the following information to
  22. ** ensure the GNU Lesser General Public License version 2.1 requirements
  23. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  24. **
  25. ** In addition, as a special exception, Digia gives you certain additional
  26. ** rights.  These rights are described in the Digia Qt LGPL Exception
  27. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  28. **
  29. ** GNU General Public License Usage
  30. ** Alternatively, this file may be used under the terms of the GNU
  31. ** General Public License version 3.0 as published by the Free Software
  32. ** Foundation and appearing in the file LICENSE.GPL included in the
  33. ** packaging of this file.  Please review the following information to
  34. ** ensure the GNU General Public License version 3.0 requirements will be
  35. ** met: http://www.gnu.org/copyleft/gpl.html.
  36. **
  37. **
  38. ** $QT_END_LICENSE$
  39. **
  40. ****************************************************************************/
  41.  
  42. #ifndef QSQL_MYSQL_H
  43. #define QSQL_MYSQL_H
  44.  
  45. //
  46. //  W A R N I N G
  47. //  -------------
  48. //
  49. // This file is not part of the Qt API.  It exists purely as an
  50. // implementation detail.  This header file may change from version to
  51. // version without notice, or even be removed.
  52. //
  53. // We mean it.
  54. //
  55.  
  56. #include <QtSql/qsqldriver.h>
  57. #include <QtSql/qsqlresult.h>
  58.  
  59. #if defined (Q_OS_WIN32)
  60. #include <QtCore/qt_windows.h>
  61. #endif
  62.  
  63. #include <mysql.h>
  64.  
  65. #ifdef QT_PLUGIN
  66. #define Q_EXPORT_SQLDRIVER_MYSQL
  67. #else
  68. #define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT
  69. #endif
  70.  
  71. QT_BEGIN_NAMESPACE
  72.  
  73. class QMYSQLDriverPrivate;
  74. class QMYSQLResultPrivate;
  75. class QMYSQLDriver;
  76. class QSqlRecordInfo;
  77.  
  78. class QMYSQLResult : public QSqlResult
  79. {
  80.     friend class QMYSQLDriver;
  81.     friend class QMYSQLResultPrivate;
  82. public:
  83.     explicit QMYSQLResult(const QMYSQLDriver* db);
  84.     ~QMYSQLResult();
  85.  
  86.     QVariant handle() const;
  87. protected:
  88.     void cleanup();
  89.     bool fetch(int i);
  90.     bool fetchNext();
  91.     bool fetchLast();
  92.     bool fetchFirst();
  93.     QVariant data(int field);
  94.     bool isNull(int field);
  95.     bool reset (const QString& query);
  96.     int size();
  97.     int numRowsAffected();
  98.     QVariant lastInsertId() const;
  99.     QSqlRecord record() const;
  100.     void virtual_hook(int id, void *data);
  101.     bool nextResult();
  102.  
  103. #if MYSQL_VERSION_ID >= 40108
  104.     bool prepare(const QString& stmt);
  105.     bool exec();
  106. #endif
  107. private:
  108.     QMYSQLResultPrivate* d;
  109. };
  110.  
  111. class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
  112. {
  113.     friend class QMYSQLResult;
  114.     Q_DECLARE_PRIVATE(QMYSQLDriver)
  115.     Q_OBJECT
  116. public:
  117.     explicit QMYSQLDriver(QObject *parent=0);
  118.     explicit QMYSQLDriver(MYSQL *con, QObject * parent=0);
  119.     ~QMYSQLDriver();
  120.     bool hasFeature(DriverFeature f) const;
  121.     bool open(const QString & db,
  122.                const QString & user,
  123.                const QString & password,
  124.                const QString & host,
  125.                int port,
  126.                const QString& connOpts);
  127.     void close();
  128.     QSqlResult *createResult() const;
  129.     QStringList tables(QSql::TableType) const;
  130.     QSqlIndex primaryIndex(const QString& tablename) const;
  131.     QSqlRecord record(const QString& tablename) const;
  132.     QString formatValue(const QSqlField &field,
  133.                                      bool trimStrings) const;
  134.     QVariant handle() const;
  135.     QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
  136.  
  137.     bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const;
  138.  
  139. protected:
  140.     bool beginTransaction();
  141.     bool commitTransaction();
  142.     bool rollbackTransaction();
  143. private:
  144.     void init();
  145. };
  146.  
  147. QT_END_NAMESPACE
  148.  
  149. #endif // QSQL_MYSQL_H
Advertisement
Add Comment
Please, Sign In to add comment