author | zecke <zecke> | 2002-08-27 20:17:50 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-08-27 20:17:50 (UTC) |
commit | 86352e32f449ecf00de254674b7dcac72bc34a14 (patch) (unidiff) | |
tree | b5803b69ca00dceea1e2a76a5eee390f0748f27e /libsql/test | |
parent | 1398b50ffc193bc9ab69ebe198aeda847c39516e (diff) | |
download | opie-86352e32f449ecf00de254674b7dcac72bc34a14.zip opie-86352e32f449ecf00de254674b7dcac72bc34a14.tar.gz opie-86352e32f449ecf00de254674b7dcac72bc34a14.tar.bz2 |
Initial check in of the light wrapper library
around normal SQL
The first driver implementation is a SQLite version
-rw-r--r-- | libsql/test/main.cpp | 29 | ||||
-rw-r--r-- | libsql/test/spaltenweise.cpp | 41 | ||||
-rw-r--r-- | libsql/test/spaltenweise.pro | 9 | ||||
-rw-r--r-- | libsql/test/test.osql | 4 | ||||
-rw-r--r-- | libsql/test/test.pro | 9 | ||||
-rw-r--r-- | libsql/test/test2.osql | 5 | ||||
-rw-r--r-- | libsql/test/zeilenweise.cpp | 84 | ||||
-rw-r--r-- | libsql/test/zeilenweise.pro | 9 |
8 files changed, 190 insertions, 0 deletions
diff --git a/libsql/test/main.cpp b/libsql/test/main.cpp new file mode 100644 index 0000000..9b35ff3 --- a/dev/null +++ b/libsql/test/main.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <qdir.h> | ||
2 | |||
3 | #include <qpe/qpeapplication.h> | ||
4 | #include "../osqlmanager.h" | ||
5 | #include "../osqlquery.h" | ||
6 | #include "../osqldriver.h" | ||
7 | #include "../osqlresult.h" | ||
8 | |||
9 | int main( int argc, char* argv[] ) { | ||
10 | |||
11 | QPEApplication app( argc, argv ); | ||
12 | OSQLManager man; | ||
13 | man.registerPath( QDir::currentDirPath() ); | ||
14 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
15 | |||
16 | OSQLDriver *driver = man.standard(); | ||
17 | qWarning("testmain" + driver->id() ); | ||
18 | driver->setUrl("/home/ich/test2vhgytry"); | ||
19 | if ( driver->open() ) { | ||
20 | qWarning("could open"); | ||
21 | }else | ||
22 | qWarning("wasn't able to open"); | ||
23 | OSQLRawQuery raw("select * from t2" ); | ||
24 | OSQLResult res = driver->query( &raw ); | ||
25 | |||
26 | OSQLRawQuery raw2( "insert into t2 VALUES(ROWID,'Meine Mutter') "); | ||
27 | res = driver->query(&raw2); | ||
28 | |||
29 | }; | ||
diff --git a/libsql/test/spaltenweise.cpp b/libsql/test/spaltenweise.cpp new file mode 100644 index 0000000..8790cdd --- a/dev/null +++ b/libsql/test/spaltenweise.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | #include <qdir.h> | ||
2 | |||
3 | #include <qpe/qpeapplication.h> | ||
4 | #include "../osqlmanager.h" | ||
5 | #include "../osqlquery.h" | ||
6 | #include "../osqldriver.h" | ||
7 | #include "../osqlresult.h" | ||
8 | |||
9 | int main( int argc, char* argv[] ) { | ||
10 | |||
11 | QPEApplication app( argc, argv ); | ||
12 | OSQLManager man; | ||
13 | man.registerPath( QDir::currentDirPath() ); | ||
14 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
15 | |||
16 | OSQLDriver *driver = man.standard(); | ||
17 | qWarning("testmain" + driver->id() ); | ||
18 | driver->setUrl("/home/ich/spaltenweise"); | ||
19 | if ( driver->open() ) { | ||
20 | qWarning("could open"); | ||
21 | }else | ||
22 | qWarning("wasn't able to open"); | ||
23 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" | ||
24 | "uid,categories,completed," | ||
25 | "progress,summary,HasDate," | ||
26 | "DateDay,DateMonth,DateYear," | ||
27 | "priority,description)" ); | ||
28 | |||
29 | OSQLResult res = driver->query( raw ); | ||
30 | delete raw; | ||
31 | for (int i = 0; i< 10000; i++ ) { | ||
32 | int uid = i; | ||
33 | OSQLRawQuery raw("insert into todolist VALUES("+ | ||
34 | QString::number(uid)+ ",'-122324;-12132',1,100,"+ | ||
35 | "'Summary234-"+QString::number(uid)+"',1,5,8,2002,1,"+ | ||
36 | "'Description\n12344')"); | ||
37 | OSQLResult res = driver->query( &raw ); | ||
38 | |||
39 | } | ||
40 | return 0; | ||
41 | }; | ||
diff --git a/libsql/test/spaltenweise.pro b/libsql/test/spaltenweise.pro new file mode 100644 index 0000000..5b881c0 --- a/dev/null +++ b/libsql/test/spaltenweise.pro | |||
@@ -0,0 +1,9 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = | ||
4 | SOURCES = spaltenweise.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiesql | ||
8 | TARGET = spaltenweise | ||
9 | |||
diff --git a/libsql/test/test.osql b/libsql/test/test.osql new file mode 100644 index 0000000..340e4f2 --- a/dev/null +++ b/libsql/test/test.osql | |||
@@ -0,0 +1,4 @@ | |||
1 | Name = Test1 | ||
2 | Vendor = Zecke | ||
3 | License = ZPL | ||
4 | Preference = 15 | ||
diff --git a/libsql/test/test.pro b/libsql/test/test.pro new file mode 100644 index 0000000..188c367 --- a/dev/null +++ b/libsql/test/test.pro | |||
@@ -0,0 +1,9 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = | ||
4 | SOURCES = main.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiesql | ||
8 | TARGET = sqltest | ||
9 | |||
diff --git a/libsql/test/test2.osql b/libsql/test/test2.osql new file mode 100644 index 0000000..952c99b --- a/dev/null +++ b/libsql/test/test2.osql | |||
@@ -0,0 +1,5 @@ | |||
1 | Name = Test2 | ||
2 | Vendor = Schaf | ||
3 | License = SPL | ||
4 | Preference = 15 | ||
5 | Default = 0 | ||
diff --git a/libsql/test/zeilenweise.cpp b/libsql/test/zeilenweise.cpp new file mode 100644 index 0000000..e538c9f --- a/dev/null +++ b/libsql/test/zeilenweise.cpp | |||
@@ -0,0 +1,84 @@ | |||
1 | #include <qdir.h> | ||
2 | |||
3 | #include <qpe/qpeapplication.h> | ||
4 | #include "../osqlmanager.h" | ||
5 | #include "../osqlquery.h" | ||
6 | #include "../osqldriver.h" | ||
7 | #include "../osqlresult.h" | ||
8 | |||
9 | int main( int argc, char* argv[] ) { | ||
10 | |||
11 | QPEApplication app( argc, argv ); | ||
12 | OSQLManager man; | ||
13 | man.registerPath( QDir::currentDirPath() ); | ||
14 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
15 | |||
16 | OSQLDriver *driver = man.standard(); | ||
17 | qWarning("testmain" + driver->id() ); | ||
18 | driver->setUrl("/home/ich/zeilenweise"); | ||
19 | if ( driver->open() ) { | ||
20 | qWarning("could open"); | ||
21 | }else | ||
22 | qWarning("wasn't able to open"); | ||
23 | OSQLRawQuery raw2("BEGIN TRANSACTION"); | ||
24 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(uid,key,value)"); | ||
25 | OSQLResult res = driver->query( &raw2 ); | ||
26 | res = driver->query( raw ); | ||
27 | delete raw; | ||
28 | for (int i = 0; i< 10000; i++ ) { | ||
29 | int uid = i; | ||
30 | OSQLRawQuery *raw; | ||
31 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid)+",'Categories',"+"'-122324;-12132')"); | ||
32 | OSQLResult res = driver->query(raw ); | ||
33 | delete raw; | ||
34 | |||
35 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid) + | ||
36 | ",'Completed',1)" ); | ||
37 | res = driver->query(raw ); | ||
38 | delete raw; | ||
39 | |||
40 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
41 | QString::number(uid)+",'Progress',100)" ); | ||
42 | res = driver->query( raw ); | ||
43 | delete raw; | ||
44 | |||
45 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
46 | QString::number(uid)+",'Summary',"+ | ||
47 | "'Summary234-"+ QString::number(uid) + "')"); | ||
48 | res = driver->query( raw ); | ||
49 | delete raw; | ||
50 | |||
51 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
52 | QString::number(uid)+",'HasDate',1)"); | ||
53 | res = driver->query( raw ); | ||
54 | delete raw; | ||
55 | |||
56 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
57 | QString::number(uid)+",'DateDay',5)"); | ||
58 | res = driver->query( raw ); | ||
59 | delete raw; | ||
60 | |||
61 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
62 | QString::number(uid)+",'DateMonth',8)"); | ||
63 | res = driver->query( raw ); | ||
64 | delete raw; | ||
65 | |||
66 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
67 | QString::number(uid)+",'DateYear',2002)"); | ||
68 | res = driver->query( raw ); | ||
69 | delete raw; | ||
70 | |||
71 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
72 | QString::number(uid)+",'Priority',1)"); | ||
73 | res = driver->query( raw ); | ||
74 | delete raw; | ||
75 | |||
76 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
77 | QString::number(uid)+",'Description','" + | ||
78 | QString::number(uid) + "Description\n12344')"); | ||
79 | res = driver->query( raw ); | ||
80 | delete raw; | ||
81 | } | ||
82 | OSQLRawQuery raw3("COMMIT"); | ||
83 | res = driver->query(&raw3 ); | ||
84 | }; | ||
diff --git a/libsql/test/zeilenweise.pro b/libsql/test/zeilenweise.pro new file mode 100644 index 0000000..516b7c0 --- a/dev/null +++ b/libsql/test/zeilenweise.pro | |||
@@ -0,0 +1,9 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = | ||
4 | SOURCES = zeilenweise.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiesql | ||
8 | TARGET = zeilenweise | ||
9 | |||