Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/sql/mymoneydbdriver.cpp
Show All 11 Lines | |||||
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * | ||
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * | ||
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * | ||
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * | ||
16 | * * | 16 | * * | ||
17 | ***************************************************************************/ | 17 | ***************************************************************************/ | ||
18 | 18 | | |||
19 | #include "mymoneydbdriver.h" | 19 | #include "mymoneydbdriver.h" | ||
20 | #include "config-kmymoney.h" | ||||
20 | 21 | | |||
21 | // ---------------------------------------------------------------------------- | 22 | // ---------------------------------------------------------------------------- | ||
22 | // QT Includes | 23 | // QT Includes | ||
23 | #include <QSqlQuery> | 24 | #include <QSqlQuery> | ||
24 | #include <QVariant> | 25 | #include <QVariant> | ||
25 | 26 | | |||
26 | // ---------------------------------------------------------------------------- | 27 | // ---------------------------------------------------------------------------- | ||
27 | // KDE Includes | 28 | // KDE Includes | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | 144 | { | |||
145 | 146 | | |||
146 | map["QDB2"] = QString("IBM DB2"); | 147 | map["QDB2"] = QString("IBM DB2"); | ||
147 | map["QIBASE"] = QString("Borland Interbase"); | 148 | map["QIBASE"] = QString("Borland Interbase"); | ||
148 | map["QMYSQL"] = QString("MySQL"); | 149 | map["QMYSQL"] = QString("MySQL"); | ||
149 | map["QOCI"] = QString("Oracle Call Interface"); | 150 | map["QOCI"] = QString("Oracle Call Interface"); | ||
150 | map["QODBC"] = QString("Open Database Connectivity"); | 151 | map["QODBC"] = QString("Open Database Connectivity"); | ||
151 | map["QPSQL"] = QString("PostgreSQL v7.3 and up"); | 152 | map["QPSQL"] = QString("PostgreSQL v7.3 and up"); | ||
152 | map["QTDS"] = QString("Sybase Adaptive Server and Microsoft SQL Server"); | 153 | map["QTDS"] = QString("Sybase Adaptive Server and Microsoft SQL Server"); | ||
153 | map["QSQLITE"] = QString("SQLite Version 3"); | 154 | #ifndef ENABLE_SQLCIPHER | ||
154 | map["SQLCIPHER"] = QString("SQLCipher Version 3 (encrypted SQLite)"); | 155 | map["QSQLITE"] = QString("SQLite Version 3"); // QSQLITE is overridden with QSQLCIPHER and won't work properly, so disable it | ||
156 | #else | ||||
157 | map["QSQLCIPHER"] = QString("SQLCipher Version 3 (encrypted SQLite)"); | ||||
158 | #endif | ||||
155 | return map; | 159 | return map; | ||
156 | } | 160 | } | ||
157 | 161 | | |||
158 | //********************* The factory ********************* | 162 | //********************* The factory ********************* | ||
159 | QExplicitlySharedDataPointer<MyMoneyDbDriver> MyMoneyDbDriver::create(const QString& type) | 163 | QExplicitlySharedDataPointer<MyMoneyDbDriver> MyMoneyDbDriver::create(const QString& type) | ||
160 | { | 164 | { | ||
161 | if (type == "QDB2") | 165 | if (type == "QDB2") | ||
162 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyDb2Driver()); | 166 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyDb2Driver()); | ||
163 | else if (type == "QIBASE") | 167 | else if (type == "QIBASE") | ||
164 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyInterbaseDriver()); | 168 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyInterbaseDriver()); | ||
165 | else if (type == "QMYSQL") | 169 | else if (type == "QMYSQL") | ||
166 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyMysqlDriver()); | 170 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyMysqlDriver()); | ||
167 | else if (type == "QOCI") | 171 | else if (type == "QOCI") | ||
168 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyOracleDriver()); | 172 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyOracleDriver()); | ||
169 | else if (type == "QODBC") | 173 | else if (type == "QODBC") | ||
170 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyODBCDriver()); | 174 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyODBCDriver()); | ||
171 | else if (type == "QPSQL") | 175 | else if (type == "QPSQL") | ||
172 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyPostgresqlDriver()); | 176 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneyPostgresqlDriver()); | ||
173 | else if (type == "QTDS") | 177 | else if (type == "QTDS") | ||
174 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySybaseDriver()); | 178 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySybaseDriver()); | ||
175 | else if (type == "QSQLITE") | 179 | else if (type == "QSQLITE") | ||
176 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySqlite3Driver()); | 180 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySqlite3Driver()); | ||
177 | else if (type == "SQLCIPHER") | 181 | else if (type == "QSQLCIPHER") | ||
178 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySqlCipher3Driver()); | 182 | return QExplicitlySharedDataPointer<MyMoneyDbDriver> (new MyMoneySqlCipher3Driver()); | ||
179 | else throw MYMONEYEXCEPTION_CSTRING("Unknown database driver type."); | 183 | else throw MYMONEYEXCEPTION_CSTRING("Unknown database driver type."); | ||
180 | } | 184 | } | ||
181 | 185 | | |||
182 | MyMoneyDbDriver::MyMoneyDbDriver() | 186 | MyMoneyDbDriver::MyMoneyDbDriver() | ||
183 | { | 187 | { | ||
184 | } | 188 | } | ||
185 | 189 | | |||
▲ Show 20 Lines • Show All 521 Lines • Show Last 20 Lines |