-rw-r--r-- | libopie2/opiedb/opiedb.pro | 3 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 22 |
2 files changed, 18 insertions, 7 deletions
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index 3612f0e..bf547ab 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -1,6 +1,7 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | #CONFIG += qt warn_on debug |
3 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/lib | 4 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = osqlbackend.h \ | 5 | HEADERS = osqlbackend.h \ |
5 | osqldriver.h \ | 6 | osqldriver.h \ |
6 | osqlerror.h \ | 7 | osqlerror.h \ |
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index 9214ad3..99fd218 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp | |||
@@ -3,8 +3,12 @@ | |||
3 | #include "osqlresult.h" | 3 | #include "osqlresult.h" |
4 | #include "osqlquery.h" | 4 | #include "osqlquery.h" |
5 | #include "osqlitedriver.h" | 5 | #include "osqlitedriver.h" |
6 | 6 | ||
7 | // fromLocal8Bit() does not work as expected. Thus it | ||
8 | // is replaced by fromLatin1() (eilers) | ||
9 | #define __BUGGY_LOCAL8BIT_ | ||
10 | |||
7 | 11 | ||
8 | namespace { | 12 | namespace { |
9 | struct Query { | 13 | struct Query { |
10 | OSQLError::ValueList errors; | 14 | OSQLError::ValueList errors; |
@@ -79,9 +83,9 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | |||
79 | qWarning("Error while executing"); | 83 | qWarning("Error while executing"); |
80 | free(err ); | 84 | free(err ); |
81 | // FixMe Errors | 85 | // FixMe Errors |
82 | } | 86 | } |
83 | qWarning("Item count is %d", query.items.count() ); | 87 | // qWarning("Item count is %d", query.items.count() ); |
84 | OSQLResult result(OSQLResult::Success, | 88 | OSQLResult result(OSQLResult::Success, |
85 | query.items, | 89 | query.items, |
86 | query.errors ); | 90 | query.errors ); |
87 | return result; | 91 | return result; |
@@ -101,20 +105,26 @@ int OSQLiteDriver::handleCallBack( int, char**, char** ) { | |||
101 | } | 105 | } |
102 | /* callback_handler add the values to the list*/ | 106 | /* callback_handler add the values to the list*/ |
103 | int OSQLiteDriver::call_back( void* voi, int argc, | 107 | int OSQLiteDriver::call_back( void* voi, int argc, |
104 | char** argv, char** columns) { | 108 | char** argv, char** columns) { |
105 | qWarning("Callback with %d items", argc ); | 109 | // qWarning("Callback with %d items", argc ); |
106 | Query* qu = (Query*)voi; | 110 | Query* qu = (Query*)voi; |
107 | 111 | ||
108 | //copy them over to a OSQLResultItem | 112 | //copy them over to a OSQLResultItem |
109 | QMap<QString, QString> tableString; | 113 | QMap<QString, QString> tableString; |
110 | QMap<int, QString> tableInt; | 114 | QMap<int, QString> tableInt; |
111 | for (int i = 0; i < argc; i++ ) { | 115 | for (int i = 0; i < argc; i++ ) { |
112 | qWarning("%s|%s", columns[i], argv[i] ); | 116 | //qWarning("%s|%s", columns[i], argv[i] ); |
113 | tableInt.insert( i, QString::fromLocal8Bit(argv[i] ) ); | ||
114 | tableString.insert( QString::fromLocal8Bit( columns[i]), | ||
115 | QString::fromLocal8Bit( argv[i] ) ); | ||
116 | 117 | ||
118 | #ifdef __BUGGY_LOCAL8BIT_ | ||
119 | tableInt.insert( i, QString::fromLatin1( argv[i] ) ); | ||
120 | tableString.insert( QString::fromLatin1( columns[i] ), | ||
121 | QString::fromLatin1( argv[i] ) ); | ||
122 | #else | ||
123 | tableInt.insert( i, QString::fromLocal8Bit( argv[i] ) ); | ||
124 | tableString.insert( QString::fromLocal8Bit( columns[i] ), | ||
125 | QString::fromLocal8Bit( argv[i] ) ); | ||
126 | #endif | ||
117 | } | 127 | } |
118 | OSQLResultItem item( tableString, tableInt ); | 128 | OSQLResultItem item( tableString, tableInt ); |
119 | qu->items.append( item ); | 129 | qu->items.append( item ); |
120 | 130 | ||