summaryrefslogtreecommitdiff
path: root/libsql/osqlmanager.cpp
authormickeyl <mickeyl>2003-08-10 15:42:26 (UTC)
committer mickeyl <mickeyl>2003-08-10 15:42:26 (UTC)
commit90dbd3e9e7139c1280e71f9c77ed4362b8d0f367 (patch) (unidiff)
tree22f0947337ea9b21a1d8f56d04ce3292c9d6f19e /libsql/osqlmanager.cpp
parent616e919ff6aea6a30e18edb37128c229e806beae (diff)
downloadopie-90dbd3e9e7139c1280e71f9c77ed4362b8d0f367.zip
opie-90dbd3e9e7139c1280e71f9c77ed4362b8d0f367.tar.gz
opie-90dbd3e9e7139c1280e71f9c77ed4362b8d0f367.tar.bz2
libsql is now a part of libopie2
Diffstat (limited to 'libsql/osqlmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libsql/osqlmanager.cpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/libsql/osqlmanager.cpp b/libsql/osqlmanager.cpp
deleted file mode 100644
index b0fea04..0000000
--- a/libsql/osqlmanager.cpp
+++ b/dev/null
@@ -1,83 +0,0 @@
1
2#include <stdlib.h>
3
4#include "osqlbackend.h"
5#include "osqldriver.h"
6#include "osqlmanager.h"
7#include "osqlbackendmanager.h"
8#include "osqlitedriver.h"
9
10OSQLManager::OSQLManager() {
11}
12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() {
13 m_list.clear();
14 QString opie = QString::fromLatin1( getenv("OPIEDIR") );
15 QString qpe = QString::fromLatin1( getenv("QPEDIR") );
16
17 if ( !m_path.contains(opie) && !opie.isEmpty() )
18 m_path << opie;
19 if ( !m_path.contains(qpe) && !qpe.isEmpty() )
20 m_path << qpe;
21
22 OSQLBackEndManager mng( m_path );
23 m_list = mng.scan();
24 m_list += builtIn();
25
26 return m_list;
27}
28/*
29 * loading dso's is currently not enabled due problems with QLibrary
30 * beeing in libqpe and not libqte
31 */
32OSQLDriver* OSQLManager::load( const QString& name ) {
33 OSQLDriver* driver = 0l;
34
35 if ( name == "SQLite" ) {
36 driver = new OSQLiteDriver();
37 }
38 return driver;
39}
40/*
41 * same as above
42 */
43OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) {
44 OSQLDriver *driver = 0l;
45 if ( end.library() == "builtin" &&
46 end.name() == "SQLite" )
47 driver = new OSQLiteDriver();
48
49 return driver;
50}
51/*
52 * let's find the a default with the highes preference
53 */
54OSQLDriver* OSQLManager::standard() {
55 OSQLDriver* driver =0l;
56 if ( m_list.isEmpty() ) queryBackEnd();
57 OSQLBackEnd::ValueList::Iterator it;
58 OSQLBackEnd back;
59 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
60 if ( (*it).isDefault() &&
61 back.preference() < (*it).preference() ) {
62 back = (*it);
63 }
64 }
65 driver = load( back );
66 return driver;
67}
68void OSQLManager::registerPath( const QString& path ) {
69 m_path << path;
70}
71bool OSQLManager::unregisterPath( const QString& path ) {
72 m_path.remove( path );
73 return true;
74}
75OSQLBackEnd::ValueList OSQLManager::builtIn()const {
76 OSQLBackEnd::ValueList list;
77 // create the OSQLiteBackend
78 OSQLBackEnd back("SQLite","Opie e.V.","GPL", "builtin" );
79 back.setDefault( true );
80 back.setPreference( 50 );
81 list.append( back );
82 return list;
83}