summaryrefslogtreecommitdiff
path: root/libopie2/opiedb
authorzecke <zecke>2004-04-04 21:27:42 (UTC)
committer zecke <zecke>2004-04-04 21:27:42 (UTC)
commitf664b509b5e622ab74560fb74093175e50b2790c (patch) (unidiff)
treed46acaa8dd49ab2de70aebcdcf57bce1276c6fd1 /libopie2/opiedb
parenteb2831b5c94c4c27b8282842c9709234f5365e01 (diff)
downloadopie-f664b509b5e622ab74560fb74093175e50b2790c.zip
opie-f664b509b5e622ab74560fb74093175e50b2790c.tar.gz
opie-f664b509b5e622ab74560fb74093175e50b2790c.tar.bz2
Opie::XYZ::Private -> Opie::XYZ::Internal
Diffstat (limited to 'libopie2/opiedb') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiedb/osqlitedriver.cpp2
-rw-r--r--libopie2/opiedb/osqlitedriver.h2
-rw-r--r--libopie2/opiedb/osqlmanager.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp
index 47bc250..2c53248 100644
--- a/libopie2/opiedb/osqlitedriver.cpp
+++ b/libopie2/opiedb/osqlitedriver.cpp
@@ -20,49 +20,49 @@
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include "osqlquery.h" 31#include "osqlquery.h"
32#include "osqlitedriver.h" 32#include "osqlitedriver.h"
33 33
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35 35
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38// fromLocal8Bit() does not work as expected. Thus it 38// fromLocal8Bit() does not work as expected. Thus it
39// is replaced by fromLatin1() (eilers) 39// is replaced by fromLatin1() (eilers)
40#define __BUGGY_LOCAL8BIT_ 40#define __BUGGY_LOCAL8BIT_
41 41
42 42
43using namespace Opie::DB; 43using namespace Opie::DB;
44using namespace Opie::DB::Private; 44using namespace Opie::DB::Internal;
45 45
46namespace { 46namespace {
47 struct Query { 47 struct Query {
48 OSQLError::ValueList errors; 48 OSQLError::ValueList errors;
49 OSQLResultItem::ValueList items; 49 OSQLResultItem::ValueList items;
50 OSQLiteDriver *driver; 50 OSQLiteDriver *driver;
51 }; 51 };
52} 52}
53 53
54 54
55OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) 55OSQLiteDriver::OSQLiteDriver( QLibrary *lib )
56 : OSQLDriver( lib ) 56 : OSQLDriver( lib )
57{ 57{
58 m_sqlite = 0l; 58 m_sqlite = 0l;
59} 59}
60 60
61 61
62OSQLiteDriver::~OSQLiteDriver() { 62OSQLiteDriver::~OSQLiteDriver() {
63 close(); 63 close();
64} 64}
65 65
66 66
67QString OSQLiteDriver::id()const { 67QString OSQLiteDriver::id()const {
68 return QString::fromLatin1("SQLite"); 68 return QString::fromLatin1("SQLite");
diff --git a/libopie2/opiedb/osqlitedriver.h b/libopie2/opiedb/osqlitedriver.h
index 3e1325b..9064e52 100644
--- a/libopie2/opiedb/osqlitedriver.h
+++ b/libopie2/opiedb/osqlitedriver.h
@@ -1,36 +1,36 @@
1#ifndef OSQL_LITE_DRIVER_H 1#ifndef OSQL_LITE_DRIVER_H
2#define OSQL_LITE_DRIVER_H 2#define OSQL_LITE_DRIVER_H
3 3
4#include <sqlite.h> 4#include <sqlite.h>
5 5
6#include "osqldriver.h" 6#include "osqldriver.h"
7#include "osqlerror.h" 7#include "osqlerror.h"
8#include "osqlresult.h" 8#include "osqlresult.h"
9 9
10namespace Opie { 10namespace Opie {
11namespace DB { 11namespace DB {
12namespace Private { 12namespace Internal {
13 13
14class OSQLiteDriver : public OSQLDriver { 14class OSQLiteDriver : public OSQLDriver {
15 Q_OBJECT 15 Q_OBJECT
16public: 16public:
17 OSQLiteDriver( QLibrary *lib = 0l ); 17 OSQLiteDriver( QLibrary *lib = 0l );
18 ~OSQLiteDriver(); 18 ~OSQLiteDriver();
19 QString id()const; 19 QString id()const;
20 void setUserName( const QString& ); 20 void setUserName( const QString& );
21 void setPassword( const QString& ); 21 void setPassword( const QString& );
22 void setUrl( const QString& url ); 22 void setUrl( const QString& url );
23 void setOptions( const QStringList& ); 23 void setOptions( const QStringList& );
24 bool open(); 24 bool open();
25 bool close(); 25 bool close();
26 OSQLError lastError(); 26 OSQLError lastError();
27 OSQLResult query( OSQLQuery* ); 27 OSQLResult query( OSQLQuery* );
28 OSQLTable::ValueList tables()const; 28 OSQLTable::ValueList tables()const;
29private: 29private:
30 OSQLError m_lastE; 30 OSQLError m_lastE;
31 OSQLResult m_result; 31 OSQLResult m_result;
32 OSQLResultItem m_items; 32 OSQLResultItem m_items;
33 int handleCallBack( int, char**, char** ); 33 int handleCallBack( int, char**, char** );
34 static int call_back( void*, int, char**, char** ); 34 static int call_back( void*, int, char**, char** );
35 QString m_url; 35 QString m_url;
36 sqlite *m_sqlite; 36 sqlite *m_sqlite;
diff --git a/libopie2/opiedb/osqlmanager.cpp b/libopie2/opiedb/osqlmanager.cpp
index 990d258..a6498df 100644
--- a/libopie2/opiedb/osqlmanager.cpp
+++ b/libopie2/opiedb/osqlmanager.cpp
@@ -12,60 +12,60 @@ OSQLManager::OSQLManager() {
12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { 12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() {
13 m_list.clear(); 13 m_list.clear();
14 QString opie = QString::fromLatin1( getenv("OPIEDIR") ); 14 QString opie = QString::fromLatin1( getenv("OPIEDIR") );
15 QString qpe = QString::fromLatin1( getenv("QPEDIR") ); 15 QString qpe = QString::fromLatin1( getenv("QPEDIR") );
16 16
17 if ( !m_path.contains(opie) && !opie.isEmpty() ) 17 if ( !m_path.contains(opie) && !opie.isEmpty() )
18 m_path << opie; 18 m_path << opie;
19 if ( !m_path.contains(qpe) && !qpe.isEmpty() ) 19 if ( !m_path.contains(qpe) && !qpe.isEmpty() )
20 m_path << qpe; 20 m_path << qpe;
21 21
22 OSQLBackEndManager mng( m_path ); 22 OSQLBackEndManager mng( m_path );
23 m_list = mng.scan(); 23 m_list = mng.scan();
24 m_list += builtIn(); 24 m_list += builtIn();
25 25
26 return m_list; 26 return m_list;
27} 27}
28/* 28/*
29 * loading dso's is currently not enabled due problems with QLibrary 29 * loading dso's is currently not enabled due problems with QLibrary
30 * beeing in libqpe and not libqte 30 * beeing in libqpe and not libqte
31 */ 31 */
32OSQLDriver* OSQLManager::load( const QString& name ) { 32OSQLDriver* OSQLManager::load( const QString& name ) {
33 OSQLDriver* driver = 0l; 33 OSQLDriver* driver = 0l;
34 34
35 if ( name == "SQLite" ) { 35 if ( name == "SQLite" ) {
36 driver = new Opie::DB::Private::OSQLiteDriver; 36 driver = new Opie::DB::Internal::OSQLiteDriver;
37 } 37 }
38 return driver; 38 return driver;
39} 39}
40/* 40/*
41 * same as above 41 * same as above
42 */ 42 */
43OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { 43OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) {
44 OSQLDriver *driver = 0l; 44 OSQLDriver *driver = 0l;
45 if ( end.library() == "builtin" && 45 if ( end.library() == "builtin" &&
46 end.name() == "SQLite" ) 46 end.name() == "SQLite" )
47 driver = new Opie::DB::Private::OSQLiteDriver; 47 driver = new Opie::DB::Internal::OSQLiteDriver;
48 48
49 return driver; 49 return driver;
50} 50}
51/* 51/*
52 * let's find the a default with the highes preference 52 * let's find the a default with the highes preference
53 */ 53 */
54OSQLDriver* OSQLManager::standard() { 54OSQLDriver* OSQLManager::standard() {
55 OSQLDriver* driver =0l; 55 OSQLDriver* driver =0l;
56 if ( m_list.isEmpty() ) queryBackEnd(); 56 if ( m_list.isEmpty() ) queryBackEnd();
57 OSQLBackEnd::ValueList::Iterator it; 57 OSQLBackEnd::ValueList::Iterator it;
58 OSQLBackEnd back; 58 OSQLBackEnd back;
59 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 59 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
60 if ( (*it).isDefault() && 60 if ( (*it).isDefault() &&
61 back.preference() < (*it).preference() ) { 61 back.preference() < (*it).preference() ) {
62 back = (*it); 62 back = (*it);
63 } 63 }
64 } 64 }
65 driver = load( back ); 65 driver = load( back );
66 return driver; 66 return driver;
67} 67}
68void OSQLManager::registerPath( const QString& path ) { 68void OSQLManager::registerPath( const QString& path ) {
69 m_path << path; 69 m_path << path;
70} 70}
71bool OSQLManager::unregisterPath( const QString& path ) { 71bool OSQLManager::unregisterPath( const QString& path ) {