summaryrefslogtreecommitdiff
path: root/libopie2/opiedb/osqlmanager.cpp
authorzecke <zecke>2004-03-13 19:51:45 (UTC)
committer zecke <zecke>2004-03-13 19:51:45 (UTC)
commit6d08277737e22b7a1527124623f3571969073ddf (patch) (unidiff)
tree4129e674e21df767b31299e873dd44e33a308e1b /libopie2/opiedb/osqlmanager.cpp
parent8e28911f7199f4450ac5eef09482069f9b9caea2 (diff)
downloadopie-6d08277737e22b7a1527124623f3571969073ddf.zip
opie-6d08277737e22b7a1527124623f3571969073ddf.tar.gz
opie-6d08277737e22b7a1527124623f3571969073ddf.tar.bz2
Move XML class to internal PIM
Add namespaces!!! Opie::Core and Opie::Core::Private Opie::Net and Opie::Net::Private Opie::Ui and Opie::Ui::Private Opie::MM and Opie::MM::Private Opie::DB and Opie::DB::Private PIM classes are not yet converted because we will do other work on it as well
Diffstat (limited to 'libopie2/opiedb/osqlmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiedb/osqlmanager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie2/opiedb/osqlmanager.cpp b/libopie2/opiedb/osqlmanager.cpp
index 766ebe1..990d258 100644
--- a/libopie2/opiedb/osqlmanager.cpp
+++ b/libopie2/opiedb/osqlmanager.cpp
@@ -1,69 +1,71 @@
1 1
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4#include "osqlmanager.h" 4#include "osqlmanager.h"
5#include "osqlbackendmanager.h" 5#include "osqlbackendmanager.h"
6#include "osqlitedriver.h" 6#include "osqlitedriver.h"
7 7
8using namespace Opie::DB;
9
8OSQLManager::OSQLManager() { 10OSQLManager::OSQLManager() {
9} 11}
10OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { 12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() {
11 m_list.clear(); 13 m_list.clear();
12 QString opie = QString::fromLatin1( getenv("OPIEDIR") ); 14 QString opie = QString::fromLatin1( getenv("OPIEDIR") );
13 QString qpe = QString::fromLatin1( getenv("QPEDIR") ); 15 QString qpe = QString::fromLatin1( getenv("QPEDIR") );
14 16
15 if ( !m_path.contains(opie) && !opie.isEmpty() ) 17 if ( !m_path.contains(opie) && !opie.isEmpty() )
16 m_path << opie; 18 m_path << opie;
17 if ( !m_path.contains(qpe) && !qpe.isEmpty() ) 19 if ( !m_path.contains(qpe) && !qpe.isEmpty() )
18 m_path << qpe; 20 m_path << qpe;
19 21
20 OSQLBackEndManager mng( m_path ); 22 OSQLBackEndManager mng( m_path );
21 m_list = mng.scan(); 23 m_list = mng.scan();
22 m_list += builtIn(); 24 m_list += builtIn();
23 25
24 return m_list; 26 return m_list;
25} 27}
26/* 28/*
27 * loading dso's is currently not enabled due problems with QLibrary 29 * loading dso's is currently not enabled due problems with QLibrary
28 * beeing in libqpe and not libqte 30 * beeing in libqpe and not libqte
29 */ 31 */
30OSQLDriver* OSQLManager::load( const QString& name ) { 32OSQLDriver* OSQLManager::load( const QString& name ) {
31 OSQLDriver* driver = 0l; 33 OSQLDriver* driver = 0l;
32 34
33 if ( name == "SQLite" ) { 35 if ( name == "SQLite" ) {
34 driver = new OSQLiteDriver(); 36 driver = new Opie::DB::Private::OSQLiteDriver;
35 } 37 }
36 return driver; 38 return driver;
37} 39}
38/* 40/*
39 * same as above 41 * same as above
40 */ 42 */
41OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { 43OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) {
42 OSQLDriver *driver = 0l; 44 OSQLDriver *driver = 0l;
43 if ( end.library() == "builtin" && 45 if ( end.library() == "builtin" &&
44 end.name() == "SQLite" ) 46 end.name() == "SQLite" )
45 driver = new OSQLiteDriver(); 47 driver = new Opie::DB::Private::OSQLiteDriver;
46 48
47 return driver; 49 return driver;
48} 50}
49/* 51/*
50 * let's find the a default with the highes preference 52 * let's find the a default with the highes preference
51 */ 53 */
52OSQLDriver* OSQLManager::standard() { 54OSQLDriver* OSQLManager::standard() {
53 OSQLDriver* driver =0l; 55 OSQLDriver* driver =0l;
54 if ( m_list.isEmpty() ) queryBackEnd(); 56 if ( m_list.isEmpty() ) queryBackEnd();
55 OSQLBackEnd::ValueList::Iterator it; 57 OSQLBackEnd::ValueList::Iterator it;
56 OSQLBackEnd back; 58 OSQLBackEnd back;
57 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 59 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
58 if ( (*it).isDefault() && 60 if ( (*it).isDefault() &&
59 back.preference() < (*it).preference() ) { 61 back.preference() < (*it).preference() ) {
60 back = (*it); 62 back = (*it);
61 } 63 }
62 } 64 }
63 driver = load( back ); 65 driver = load( back );
64 return driver; 66 return driver;
65} 67}
66void OSQLManager::registerPath( const QString& path ) { 68void OSQLManager::registerPath( const QString& path ) {
67 m_path << path; 69 m_path << path;
68} 70}
69bool OSQLManager::unregisterPath( const QString& path ) { 71bool OSQLManager::unregisterPath( const QString& path ) {