summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2003-12-20 17:24:21 (UTC)
committer mickeyl <mickeyl>2003-12-20 17:24:21 (UTC)
commitdd5c40a4fa4d73ca1f5234502c7ba67675c5b7f9 (patch) (unidiff)
tree9711dbc6de8605887fd1a0062c5fbf17c6207398 /libopie2
parent33dfe08454a70d3f9dd6dd154385c40adf6df918 (diff)
downloadopie-dd5c40a4fa4d73ca1f5234502c7ba67675c5b7f9.zip
opie-dd5c40a4fa4d73ca1f5234502c7ba67675c5b7f9.tar.gz
opie-dd5c40a4fa4d73ca1f5234502c7ba67675c5b7f9.tar.bz2
use odebug classes
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiedb/opiedb.pro11
-rw-r--r--libopie2/opiedb/osqlitedriver.cpp67
2 files changed, 63 insertions, 15 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,4 +1,3 @@
1TEMPLATE = lib 1TEMPLATE = lib
2#CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3CONFIG += qt warn_on release
4DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
@@ -25,8 +24,4 @@ TARGET = opiedb2
25VERSION = 1.8.2 24VERSION = 1.8.2
26INCLUDEPATH += $(OPIEDIR)/include 25INCLUDEPATH = $(OPIEDIR)/include
27DEPENDPATH += $(OPIEDIR)/include 26DEPENDPATH = $(OPIEDIR)/include
28
29MOC_DIR = moc
30OBJECTS_DIR = obj
31
32LIBS += -lsqlite -lqpe 27LIBS += -lsqlite -lqpe
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,2 +34,6 @@
6 34
35#include <opie2/odebug.h>
36
37#include <stdlib.h>
38
7// fromLocal8Bit() does not work as expected. Thus it 39// fromLocal8Bit() does not work as expected. Thus it
@@ -19,2 +51,3 @@ namespace {
19 51
52
20OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) 53OSQLiteDriver::OSQLiteDriver( QLibrary *lib )
@@ -24,2 +57,4 @@ OSQLiteDriver::OSQLiteDriver( QLibrary *lib )
24} 57}
58
59
25OSQLiteDriver::~OSQLiteDriver() { 60OSQLiteDriver::~OSQLiteDriver() {
@@ -28,2 +63,3 @@ OSQLiteDriver::~OSQLiteDriver() {
28 63
64
29QString OSQLiteDriver::id()const { 65QString OSQLiteDriver::id()const {
@@ -33,4 +69,7 @@ QString OSQLiteDriver::id()const {
33void OSQLiteDriver::setUserName( const QString& ) {} 69void OSQLiteDriver::setUserName( const QString& ) {}
70
71
34void OSQLiteDriver::setPassword( const QString& ) {} 72void OSQLiteDriver::setPassword( const QString& ) {}
35 73
74
36void OSQLiteDriver::setUrl( const QString& url ) { 75void OSQLiteDriver::setUrl( const QString& url ) {
@@ -38,4 +77,8 @@ void OSQLiteDriver::setUrl( const QString& url ) {
38} 77}
78
79
39void OSQLiteDriver::setOptions( const QStringList& ) { 80void 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
93OSQLTable::ValueList OSQLiteDriver::tables() const { 142OSQLTable::ValueList OSQLiteDriver::tables() const {
@@ -95,2 +144,4 @@ OSQLTable::ValueList OSQLiteDriver::tables() const {
95} 144}
145
146
96OSQLError OSQLiteDriver::lastError() { 147OSQLError 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