kexi
driver_p.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <kdebug.h>
00022 #include <qdict.h>
00023 #include <qvaluevector.h>
00024 #include "driver_p.h"
00025
00026 using namespace KexiDB;
00027
00028 namespace KexiDB {
00029 QAsciiDict<bool>* DriverPrivate::kexiSQLDict = 0;
00030
00034 static bool _dummy;
00035 }
00036
00037
00038 DriverPrivate::DriverPrivate()
00039 : isFileDriver(false)
00040 , isDBOpenedAfterCreate(false)
00041 , features(Driver::NoFeatures)
00042 {
00043 kexiSQLDict = 0;
00044 driverSQLDict = 0;
00045 adminTools = 0;
00046
00047 properties["client_library_version"] = "";
00048 propertyCaptions["client_library_version"] =
00049 i18n("Client library version");
00050
00051 properties["default_server_encoding"] = "";
00052 propertyCaptions["default_server_encoding"] =
00053 i18n("Default character encoding on server");
00054 }
00055
00056 void DriverPrivate::initInternalProperties()
00057 {
00058 properties["is_file_database"] = QVariant(isFileDriver, 1);
00059 propertyCaptions["is_file_database"] = i18n("File-based database driver");
00060 if (isFileDriver) {
00061 properties["file_database_mimetype"] = fileDBDriverMimeType;
00062 propertyCaptions["file_database_mimetype"] = i18n("File-based database's MIME type");
00063 }
00064
00065 #if 0
00066 QString str;
00067 if (features & Driver::SingleTransactions)
00068 str = i18n("Single transactions");
00069 else if (features & Driver::MultipleTransactions)
00070 str = i18n("Multiple transactions");
00071 else if (features & Driver::NestedTransactions)
00072 str = i18n("Nested transactions");
00073 else if (features & Driver::IgnoreTransactions)
00074 str = i18n("Ignored");
00075 else
00076 str = i18n("None");
00077 #endif
00078
00079
00080 properties["transaction_single"] = QVariant(features & Driver::SingleTransactions, 1);
00081 propertyCaptions["transaction_single"] = i18n("Single transactions support");
00082 properties["transaction_multiple"] = QVariant(features & Driver::MultipleTransactions, 1);
00083 propertyCaptions["transaction_multiple"] = i18n("Multiple transactions support");
00084 properties["transaction_nested"] = QVariant(features & Driver::NestedTransactions, 1);
00085 propertyCaptions["transaction_nested"] = i18n("Nested transactions support");
00086
00087 properties["kexidb_driver_version"] =
00088 QString("%1.%2").arg(version().major).arg(version().minor);
00089 propertyCaptions["kexidb_driver_version"] =
00090 i18n("KexiDB driver version");
00091 }
00092
00093 DriverPrivate::~DriverPrivate()
00094 {
00095 delete driverSQLDict;
00096 delete adminTools;
00097 }
00098
00099
00100 void DriverPrivate::initKexiKeywords() {
00101
00102
00103
00104
00105 if(!kexiSQLDict) {
00106 kexiSQLDict = new QAsciiDict<bool>(79, false, false);
00107 initKeywords(kexiSQLKeywords, *kexiSQLDict);
00108 }
00109 }
00110
00111 void DriverPrivate::initDriverKeywords(const char* keywords[], int hashSize) {
00112 driverSQLDict = new QAsciiDict<bool>(hashSize, false, false);
00113 initKeywords(keywords, *driverSQLDict);
00114 }
00115
00116 void DriverPrivate::initKeywords(const char* keywords[],
00117 QAsciiDict<bool>& dict) {
00118 for(int i = 0; keywords[i] != 0; i++) {
00119 dict.insert(keywords[i], &_dummy);
00120 }
00121 }
00122
00123 AdminTools::Private::Private()
00124 {
00125 }
00126
00127 AdminTools::Private::~Private()
00128 {
00129 }
|