-rw-r--r-- | libopie2/opiedb/opiedb.pro | 51 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 69 |
2 files changed, 84 insertions, 36 deletions
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index d869e6f..249d8b5 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -1,23 +1,22 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | #CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | CONFIG += qt warn_on release | ||
4 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
5 | HEADERS = osqlbackend.h \ | 4 | HEADERS = osqlbackend.h \ |
6 | osqldriver.h \ | 5 | osqldriver.h \ |
7 | osqlerror.h \ | 6 | osqlerror.h \ |
8 | osqlmanager.h \ | 7 | osqlmanager.h \ |
9 | osqlquery.h \ | 8 | osqlquery.h \ |
10 | osqlresult.h \ | 9 | osqlresult.h \ |
11 | osqltable.h \ | 10 | osqltable.h \ |
12 | osqlbackendmanager.h \ | 11 | osqlbackendmanager.h \ |
13 | osqlitedriver.h | 12 | osqlitedriver.h |
14 | SOURCES = osqlbackend.cpp \ | 13 | SOURCES = osqlbackend.cpp \ |
15 | osqldriver.cpp \ | 14 | osqldriver.cpp \ |
16 | osqlerror.cpp \ | 15 | osqlerror.cpp \ |
17 | osqlmanager.cpp \ | 16 | osqlmanager.cpp \ |
18 | osqlquery.cpp \ | 17 | osqlquery.cpp \ |
19 | osqlresult.cpp \ | 18 | osqlresult.cpp \ |
20 | osqltable.cpp \ | 19 | osqltable.cpp \ |
21 | osqlbackendmanager.cpp \ | 20 | osqlbackendmanager.cpp \ |
22 | osqlitedriver.cpp | 21 | osqlitedriver.cpp |
23 | INTERFACES = | 22 | INTERFACES = |
@@ -25,9 +24,5 @@ TARGET = opiedb2 | |||
25 | VERSION = 1.8.2 | 24 | VERSION = 1.8.2 |
26 | INCLUDEPATH += $(OPIEDIR)/include | 25 | INCLUDEPATH = $(OPIEDIR)/include |
27 | DEPENDPATH += $(OPIEDIR)/include | 26 | DEPENDPATH = $(OPIEDIR)/include |
28 | 27 | LIBS += -lsqlite -lqpe | |
29 | MOC_DIR = moc | ||
30 | OBJECTS_DIR = obj | ||
31 | |||
32 | LIBS += -lsqlite -lqpe | ||
33 | 28 | ||
@@ -38,3 +33,3 @@ LIBS += -lsqlite -lqpe | |||
38 | contains( platform, x11 ) { | 33 | contains( platform, x11 ) { |
39 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 34 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
40 | } | 35 | } |
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index 99fd218..b857534 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp | |||
@@ -1,2 +1,30 @@ | |||
1 | #include <stdlib.h> | 1 | /* |
2 | This file is part of the Opie Project | ||
3 | |||
4 | =. | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | |||
29 | */ | ||
2 | 30 | ||
@@ -6,3 +34,7 @@ | |||
6 | 34 | ||
7 | // fromLocal8Bit() does not work as expected. Thus it | 35 | #include <opie2/odebug.h> |
36 | |||
37 | #include <stdlib.h> | ||
38 | |||
39 | // fromLocal8Bit() does not work as expected. Thus it | ||
8 | // is replaced by fromLatin1() (eilers) | 40 | // is replaced by fromLatin1() (eilers) |
@@ -19,2 +51,3 @@ namespace { | |||
19 | 51 | ||
52 | |||
20 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) | 53 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) |
@@ -24,2 +57,4 @@ OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) | |||
24 | } | 57 | } |
58 | |||
59 | |||
25 | OSQLiteDriver::~OSQLiteDriver() { | 60 | OSQLiteDriver::~OSQLiteDriver() { |
@@ -28,2 +63,3 @@ OSQLiteDriver::~OSQLiteDriver() { | |||
28 | 63 | ||
64 | |||
29 | QString OSQLiteDriver::id()const { | 65 | QString OSQLiteDriver::id()const { |
@@ -33,4 +69,7 @@ QString OSQLiteDriver::id()const { | |||
33 | void OSQLiteDriver::setUserName( const QString& ) {} | 69 | void OSQLiteDriver::setUserName( const QString& ) {} |
70 | |||
71 | |||
34 | void OSQLiteDriver::setPassword( const QString& ) {} | 72 | void OSQLiteDriver::setPassword( const QString& ) {} |
35 | 73 | ||
74 | |||
36 | void OSQLiteDriver::setUrl( const QString& url ) { | 75 | void OSQLiteDriver::setUrl( const QString& url ) { |
@@ -38,4 +77,8 @@ void OSQLiteDriver::setUrl( const QString& url ) { | |||
38 | } | 77 | } |
78 | |||
79 | |||
39 | void OSQLiteDriver::setOptions( const QStringList& ) { | 80 | void OSQLiteDriver::setOptions( const QStringList& ) { |
40 | } | 81 | } |
82 | |||
83 | |||
41 | /* | 84 | /* |
@@ -46,3 +89,3 @@ bool OSQLiteDriver::open() { | |||
46 | char *error; | 89 | char *error; |
47 | qWarning("about to open"); | 90 | odebug << "OSQLiteDriver::open: about to open" << oendl; |
48 | m_sqlite = sqlite_open(m_url.local8Bit(), | 91 | m_sqlite = sqlite_open(m_url.local8Bit(), |
@@ -54,3 +97,3 @@ bool OSQLiteDriver::open() { | |||
54 | // FIXME set the last error | 97 | // FIXME set the last error |
55 | qWarning("error:%s", error ); | 98 | owarn << "OSQLiteDriver::open: " << error << oendl; |
56 | free( error ); | 99 | free( error ); |
@@ -60,2 +103,4 @@ bool OSQLiteDriver::open() { | |||
60 | } | 103 | } |
104 | |||
105 | |||
61 | /* close the db | 106 | /* close the db |
@@ -70,2 +115,4 @@ bool OSQLiteDriver::close() { | |||
70 | } | 115 | } |
116 | |||
117 | |||
71 | /* Query */ | 118 | /* Query */ |
@@ -82,3 +129,3 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | |||
82 | if ( sqlite_exec(m_sqlite, qu->query(),&call_back, &query, &err) > 0 ) { | 129 | if ( sqlite_exec(m_sqlite, qu->query(),&call_back, &query, &err) > 0 ) { |
83 | qWarning("Error while executing"); | 130 | owarn << "OSQLiteDriver::query: Error while executing" << oendl; |
84 | free(err ); | 131 | free(err ); |
@@ -86,3 +133,3 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | |||
86 | } | 133 | } |
87 | // qWarning("Item count is %d", query.items.count() ); | 134 | |
88 | OSQLResult result(OSQLResult::Success, | 135 | OSQLResult result(OSQLResult::Success, |
@@ -92,2 +139,4 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | |||
92 | } | 139 | } |
140 | |||
141 | |||
93 | OSQLTable::ValueList OSQLiteDriver::tables() const { | 142 | OSQLTable::ValueList OSQLiteDriver::tables() const { |
@@ -95,2 +144,4 @@ OSQLTable::ValueList OSQLiteDriver::tables() const { | |||
95 | } | 144 | } |
145 | |||
146 | |||
96 | OSQLError OSQLiteDriver::lastError() { | 147 | OSQLError OSQLiteDriver::lastError() { |
@@ -99,2 +150,4 @@ OSQLError OSQLiteDriver::lastError() { | |||
99 | }; | 150 | }; |
151 | |||
152 | |||
100 | /* handle a callback add the row to the global | 153 | /* handle a callback add the row to the global |
@@ -105,2 +158,4 @@ int OSQLiteDriver::handleCallBack( int, char**, char** ) { | |||
105 | } | 158 | } |
159 | |||
160 | |||
106 | /* callback_handler add the values to the list*/ | 161 | /* callback_handler add the values to the list*/ |
@@ -108,3 +163,2 @@ int OSQLiteDriver::call_back( void* voi, int argc, | |||
108 | char** argv, char** columns) { | 163 | char** argv, char** columns) { |
109 | // qWarning("Callback with %d items", argc ); | ||
110 | Query* qu = (Query*)voi; | 164 | Query* qu = (Query*)voi; |
@@ -115,3 +169,2 @@ int OSQLiteDriver::call_back( void* voi, int argc, | |||
115 | for (int i = 0; i < argc; i++ ) { | 169 | for (int i = 0; i < argc; i++ ) { |
116 | //qWarning("%s|%s", columns[i], argv[i] ); | ||
117 | 170 | ||