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
00046 properties["client_library_version"] = "";
00047 propertyCaptions["client_library_version"] =
00048 i18n("Client library version");
00049
00050 properties["default_server_encoding"] = "";
00051 propertyCaptions["default_server_encoding"] =
00052 i18n("Default character encoding on server");
00053 }
00054
00055 void DriverPrivate::initInternalProperties()
00056 {
00057 properties["is_file_database"] = QVariant(isFileDriver, 1);
00058 propertyCaptions["is_file_database"] = i18n("File-based database driver");
00059 if (isFileDriver) {
00060 properties["file_database_mimetype"] = fileDBDriverMimeType;
00061 propertyCaptions["file_database_mimetype"] = i18n("File-based database's MIME type");
00062 }
00063
00064 #if 0
00065 QString str;
00066 if (features & Driver::SingleTransactions)
00067 str = i18n("Single transactions");
00068 else if (features & Driver::MultipleTransactions)
00069 str = i18n("Multiple transactions");
00070 else if (features & Driver::NestedTransactions)
00071 str = i18n("Nested transactions");
00072 else if (features & Driver::IgnoreTransactions)
00073 str = i18n("Ignored");
00074 else
00075 str = i18n("None");
00076 #endif
00077
00078
00079 properties["transaction_single"] = QVariant(features & Driver::SingleTransactions, 1);
00080 propertyCaptions["transaction_single"] = i18n("Single transactions support");
00081 properties["transaction_multiple"] = QVariant(features & Driver::MultipleTransactions, 1);
00082 propertyCaptions["transaction_multiple"] = i18n("Multiple transactions support");
00083 properties["transaction_nested"] = QVariant(features & Driver::NestedTransactions, 1);
00084 propertyCaptions["transaction_nested"] = i18n("Nested transactions support");
00085
00086 properties["kexidb_driver_version"] =
00087 QString("%1.%2").arg(versionMajor()).arg(versionMinor());
00088 propertyCaptions["kexidb_driver_version"] =
00089 i18n("KexiDB driver version");
00090 }
00091
00092 DriverPrivate::~DriverPrivate() {
00093 delete driverSQLDict;
00094 }
00095
00096
00097 void DriverPrivate::initKexiKeywords() {
00098
00099
00100
00101
00102 if(!kexiSQLDict) {
00103 kexiSQLDict = new QAsciiDict<bool>(79, false, false);
00104 initKeywords(kexiSQLKeywords, *kexiSQLDict);
00105 }
00106 }
00107
00108 void DriverPrivate::initDriverKeywords(const char* keywords[], int hashSize) {
00109 driverSQLDict = new QAsciiDict<bool>(hashSize, false, false);
00110 initKeywords(keywords, *driverSQLDict);
00111 }
00112
00113 void DriverPrivate::initKeywords(const char* keywords[],
00114 QAsciiDict<bool>& dict) {
00115 for(int i = 0; keywords[i] != 0; i++) {
00116 dict.insert(keywords[i], &_dummy);
00117 }
00118 }
00119
|