author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtSql module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QSQL_TDS_H |
|
43 |
#define QSQL_TDS_H |
|
44 |
||
45 |
#include <QtSql/qsqlresult.h> |
|
46 |
#include <QtSql/qsqldriver.h> |
|
47 |
#include <QtSql/private/qsqlcachedresult_p.h> |
|
48 |
||
49 |
#ifdef Q_OS_WIN32 |
|
50 |
#define WIN32_LEAN_AND_MEAN |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
51 |
#ifndef Q_USE_SYBASE |
0 | 52 |
#define DBNTWIN32 // indicates 32bit windows dblib |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
53 |
#endif |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
54 |
#include <winsock2.h> |
0 | 55 |
#include <QtCore/qt_windows.h> |
56 |
#include <sqlfront.h> |
|
57 |
#include <sqldb.h> |
|
58 |
#define CS_PUBLIC |
|
59 |
#else |
|
60 |
#include <sybfront.h> |
|
61 |
#include <sybdb.h> |
|
62 |
#endif //Q_OS_WIN32 |
|
63 |
||
64 |
#ifdef QT_PLUGIN |
|
65 |
#define Q_EXPORT_SQLDRIVER_TDS |
|
66 |
#else |
|
67 |
#define Q_EXPORT_SQLDRIVER_TDS Q_SQL_EXPORT |
|
68 |
#endif |
|
69 |
||
70 |
QT_BEGIN_HEADER |
|
71 |
||
72 |
QT_BEGIN_NAMESPACE |
|
73 |
||
74 |
class QTDSDriverPrivate; |
|
75 |
class QTDSResultPrivate; |
|
76 |
class QTDSDriver; |
|
77 |
||
78 |
class QTDSResult : public QSqlCachedResult |
|
79 |
{ |
|
80 |
public: |
|
81 |
explicit QTDSResult(const QTDSDriver* db); |
|
82 |
~QTDSResult(); |
|
83 |
QVariant handle() const; |
|
84 |
||
85 |
protected: |
|
86 |
void cleanup(); |
|
87 |
bool reset (const QString& query); |
|
88 |
int size(); |
|
89 |
int numRowsAffected(); |
|
90 |
bool gotoNext(QSqlCachedResult::ValueCache &values, int index); |
|
91 |
QSqlRecord record() const; |
|
92 |
||
93 |
private: |
|
94 |
QTDSResultPrivate* d; |
|
95 |
}; |
|
96 |
||
97 |
class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver |
|
98 |
{ |
|
99 |
Q_OBJECT |
|
100 |
friend class QTDSResult; |
|
101 |
public: |
|
102 |
explicit QTDSDriver(QObject* parent = 0); |
|
103 |
QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0); |
|
104 |
~QTDSDriver(); |
|
105 |
bool hasFeature(DriverFeature f) const; |
|
106 |
bool open(const QString & db, |
|
107 |
const QString & user, |
|
108 |
const QString & password, |
|
109 |
const QString & host, |
|
110 |
int port, |
|
111 |
const QString& connOpts); |
|
112 |
void close(); |
|
113 |
QStringList tables(QSql::TableType) const; |
|
114 |
QSqlResult *createResult() const; |
|
115 |
QSqlRecord record(const QString& tablename) const; |
|
116 |
QSqlIndex primaryIndex(const QString& tablename) const; |
|
117 |
||
118 |
QString formatValue(const QSqlField &field, |
|
119 |
bool trimStrings) const; |
|
120 |
QVariant handle() const; |
|
121 |
||
122 |
QString escapeIdentifier(const QString &identifier, IdentifierType type) const; |
|
123 |
||
124 |
protected: |
|
125 |
bool beginTransaction(); |
|
126 |
bool commitTransaction(); |
|
127 |
bool rollbackTransaction(); |
|
128 |
private: |
|
129 |
void init(); |
|
130 |
QTDSDriverPrivate *d; |
|
131 |
}; |
|
132 |
||
133 |
QT_END_NAMESPACE |
|
134 |
||
135 |
QT_END_HEADER |
|
136 |
||
137 |
#endif // QSQL_TDS_H |