author | mickeyl <mickeyl> | 2005-01-29 14:09:25 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-29 14:09:25 (UTC) |
commit | 7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02 (patch) (unidiff) | |
tree | 5b38b6eb9d8430b0a96a2e156995bb421cc1a570 /examples/opiedb | |
parent | 0db5704f66f0d08f9928f749774ee0f37bb0250d (diff) | |
download | opie-7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02.zip opie-7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02.tar.gz opie-7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02.tar.bz2 |
examples start to appear here
-rw-r--r-- | examples/opiedb/.cvsignore | 6 | ||||
-rw-r--r-- | examples/opiedb/opiedb.pro | 3 | ||||
-rw-r--r-- | examples/opiedb/sqltest/.cvsignore | 7 | ||||
-rw-r--r-- | examples/opiedb/sqltest/main.cpp | 62 | ||||
-rw-r--r-- | examples/opiedb/sqltest/spaltenweise.cpp | 43 | ||||
-rw-r--r-- | examples/opiedb/sqltest/spaltenweise.pro | 13 | ||||
-rw-r--r-- | examples/opiedb/sqltest/sqltest.pro | 17 | ||||
-rw-r--r-- | examples/opiedb/sqltest/test.osql | 4 | ||||
-rw-r--r-- | examples/opiedb/sqltest/test2.osql | 5 | ||||
-rw-r--r-- | examples/opiedb/sqltest/zeilenweise.cpp | 86 | ||||
-rw-r--r-- | examples/opiedb/sqltest/zeilenweise.pro | 13 |
11 files changed, 259 insertions, 0 deletions
diff --git a/examples/opiedb/.cvsignore b/examples/opiedb/.cvsignore new file mode 100644 index 0000000..972e959 --- a/dev/null +++ b/examples/opiedb/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | obj | ||
diff --git a/examples/opiedb/opiedb.pro b/examples/opiedb/opiedb.pro new file mode 100644 index 0000000..85fa6db --- a/dev/null +++ b/examples/opiedb/opiedb.pro | |||
@@ -0,0 +1,3 @@ | |||
1 | TEMPLATE = subdirs | ||
2 | SUBDIRS = sqltest | ||
3 | |||
diff --git a/examples/opiedb/sqltest/.cvsignore b/examples/opiedb/sqltest/.cvsignore new file mode 100644 index 0000000..3290247 --- a/dev/null +++ b/examples/opiedb/sqltest/.cvsignore | |||
@@ -0,0 +1,7 @@ | |||
1 | sqltest | ||
2 | Makefile* | ||
3 | moc* | ||
4 | *moc | ||
5 | *.o | ||
6 | ~* | ||
7 | obj | ||
diff --git a/examples/opiedb/sqltest/main.cpp b/examples/opiedb/sqltest/main.cpp new file mode 100644 index 0000000..f4338e9 --- a/dev/null +++ b/examples/opiedb/sqltest/main.cpp | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | =. This file is part of the Opie Project | ||
3 | .=l. Copyright (C) 2004 Opie Team <opie-devel@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | /* OPIE */ | ||
30 | #include <opie2/osqlmanager.h> | ||
31 | #include <opie2/osqlquery.h> | ||
32 | #include <opie2/osqldriver.h> | ||
33 | #include <opie2/osqlresult.h> | ||
34 | #include <opie2/odebug.h> | ||
35 | |||
36 | #include <qpe/qpeapplication.h> | ||
37 | |||
38 | /* QT */ | ||
39 | #include <qdir.h> | ||
40 | |||
41 | using namespace Opie::DB; | ||
42 | int main( int argc, char* argv[] ) { | ||
43 | |||
44 | QPEApplication app( argc, argv ); | ||
45 | OSQLManager man; | ||
46 | man.registerPath( QDir::currentDirPath() ); | ||
47 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
48 | |||
49 | OSQLDriver *driver = man.standard(); | ||
50 | owarn << "testmain" + driver->id() << oendl; | ||
51 | driver->setUrl("/home/ich/test2vhgytry"); | ||
52 | if ( driver->open() ) { | ||
53 | owarn << "could open" << oendl; | ||
54 | }else | ||
55 | owarn << "wasn't able to open" << oendl; | ||
56 | OSQLRawQuery raw("select * from t2" ); | ||
57 | OSQLResult res = driver->query( &raw ); | ||
58 | |||
59 | OSQLRawQuery raw2( "insert into t2 VALUES(ROWID,'Meine Mutter') "); | ||
60 | res = driver->query(&raw2); | ||
61 | |||
62 | }; | ||
diff --git a/examples/opiedb/sqltest/spaltenweise.cpp b/examples/opiedb/sqltest/spaltenweise.cpp new file mode 100644 index 0000000..c11724c --- a/dev/null +++ b/examples/opiedb/sqltest/spaltenweise.cpp | |||
@@ -0,0 +1,43 @@ | |||
1 | #include <qdir.h> | ||
2 | |||
3 | #include <qpe/qpeapplication.h> | ||
4 | #include <opie2/osqlmanager.h> | ||
5 | #include <opie2/osqlquery.h> | ||
6 | #include <opie2/osqldriver.h> | ||
7 | #include <opie2/osqlresult.h> | ||
8 | |||
9 | using namespace Opie::DB; | ||
10 | |||
11 | int main( int argc, char* argv[] ) { | ||
12 | |||
13 | QPEApplication app( argc, argv ); | ||
14 | OSQLManager man; | ||
15 | man.registerPath( QDir::currentDirPath() ); | ||
16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
17 | |||
18 | OSQLDriver *driver = man.standard(); | ||
19 | owarn << "testmain" + driver->id() << oendl; | ||
20 | driver->setUrl("/home/ich/spaltenweise"); | ||
21 | if ( driver->open() ) { | ||
22 | owarn << "could open" << oendl; | ||
23 | }else | ||
24 | owarn << "wasn't able to open" << oendl; | ||
25 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" | ||
26 | "uid,categories,completed," | ||
27 | "progress,summary,HasDate," | ||
28 | "DateDay,DateMonth,DateYear," | ||
29 | "priority,description)" ); | ||
30 | |||
31 | OSQLResult res = driver->query( raw ); | ||
32 | delete raw; | ||
33 | for (int i = 0; i< 10000; i++ ) { | ||
34 | int uid = i; | ||
35 | OSQLRawQuery raw("insert into todolist VALUES("+ | ||
36 | QString::number(uid)+ ",'-122324;-12132',1,100,"+ | ||
37 | "'Summary234-"+QString::number(uid)+"',1,5,8,2002,1,"+ | ||
38 | "'Description\n12344')"); | ||
39 | OSQLResult res = driver->query( &raw ); | ||
40 | |||
41 | } | ||
42 | return 0; | ||
43 | }; | ||
diff --git a/examples/opiedb/sqltest/spaltenweise.pro b/examples/opiedb/sqltest/spaltenweise.pro new file mode 100644 index 0000000..0335d16 --- a/dev/null +++ b/examples/opiedb/sqltest/spaltenweise.pro | |||
@@ -0,0 +1,13 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = spaltenweise.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiedb2 | ||
8 | TARGET = spaltenweise | ||
9 | |||
10 | |||
11 | |||
12 | |||
13 | include( $(OPIEDIR)/include.pro ) | ||
diff --git a/examples/opiedb/sqltest/sqltest.pro b/examples/opiedb/sqltest/sqltest.pro new file mode 100644 index 0000000..a4eee6b --- a/dev/null +++ b/examples/opiedb/sqltest/sqltest.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = main.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiedb2 -lsqlite3 | ||
8 | TARGET = sqltest | ||
9 | |||
10 | include( $(OPIEDIR)/include.pro ) | ||
11 | |||
12 | !isEmpty( LIBSQLITE_INC_DIR ) { | ||
13 | INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH | ||
14 | } | ||
15 | !isEmpty( LIBSQLITE_LIB_DIR ) { | ||
16 | LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS | ||
17 | } | ||
diff --git a/examples/opiedb/sqltest/test.osql b/examples/opiedb/sqltest/test.osql new file mode 100644 index 0000000..340e4f2 --- a/dev/null +++ b/examples/opiedb/sqltest/test.osql | |||
@@ -0,0 +1,4 @@ | |||
1 | Name = Test1 | ||
2 | Vendor = Zecke | ||
3 | License = ZPL | ||
4 | Preference = 15 | ||
diff --git a/examples/opiedb/sqltest/test2.osql b/examples/opiedb/sqltest/test2.osql new file mode 100644 index 0000000..952c99b --- a/dev/null +++ b/examples/opiedb/sqltest/test2.osql | |||
@@ -0,0 +1,5 @@ | |||
1 | Name = Test2 | ||
2 | Vendor = Schaf | ||
3 | License = SPL | ||
4 | Preference = 15 | ||
5 | Default = 0 | ||
diff --git a/examples/opiedb/sqltest/zeilenweise.cpp b/examples/opiedb/sqltest/zeilenweise.cpp new file mode 100644 index 0000000..126e797 --- a/dev/null +++ b/examples/opiedb/sqltest/zeilenweise.cpp | |||
@@ -0,0 +1,86 @@ | |||
1 | #include <qdir.h> | ||
2 | |||
3 | #include <qpe/qpeapplication.h> | ||
4 | #include <opie2/osqlmanager.h> | ||
5 | #include <opie2/osqlquery.h> | ||
6 | #include <opie2/osqldriver.h> | ||
7 | #include <opie2/osqlresult.h> | ||
8 | |||
9 | using namespace Opie::DB; | ||
10 | |||
11 | int main( int argc, char* argv[] ) { | ||
12 | |||
13 | QPEApplication app( argc, argv ); | ||
14 | OSQLManager man; | ||
15 | man.registerPath( QDir::currentDirPath() ); | ||
16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | ||
17 | |||
18 | OSQLDriver *driver = man.standard(); | ||
19 | owarn << "testmain" + driver->id() << oendl; | ||
20 | driver->setUrl("/home/ich/zeilenweise"); | ||
21 | if ( driver->open() ) { | ||
22 | owarn << "could open" << oendl; | ||
23 | }else | ||
24 | owarn << "wasn't able to open" << oendl; | ||
25 | OSQLRawQuery raw2("BEGIN TRANSACTION"); | ||
26 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(uid,key,value)"); | ||
27 | OSQLResult res = driver->query( &raw2 ); | ||
28 | res = driver->query( raw ); | ||
29 | delete raw; | ||
30 | for (int i = 0; i< 10000; i++ ) { | ||
31 | int uid = i; | ||
32 | OSQLRawQuery *raw; | ||
33 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid)+",'Categories',"+"'-122324;-12132')"); | ||
34 | OSQLResult res = driver->query(raw ); | ||
35 | delete raw; | ||
36 | |||
37 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid) + | ||
38 | ",'Completed',1)" ); | ||
39 | res = driver->query(raw ); | ||
40 | delete raw; | ||
41 | |||
42 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
43 | QString::number(uid)+",'Progress',100)" ); | ||
44 | res = driver->query( raw ); | ||
45 | delete raw; | ||
46 | |||
47 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
48 | QString::number(uid)+",'Summary',"+ | ||
49 | "'Summary234-"+ QString::number(uid) + "')"); | ||
50 | res = driver->query( raw ); | ||
51 | delete raw; | ||
52 | |||
53 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
54 | QString::number(uid)+",'HasDate',1)"); | ||
55 | res = driver->query( raw ); | ||
56 | delete raw; | ||
57 | |||
58 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
59 | QString::number(uid)+",'DateDay',5)"); | ||
60 | res = driver->query( raw ); | ||
61 | delete raw; | ||
62 | |||
63 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
64 | QString::number(uid)+",'DateMonth',8)"); | ||
65 | res = driver->query( raw ); | ||
66 | delete raw; | ||
67 | |||
68 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
69 | QString::number(uid)+",'DateYear',2002)"); | ||
70 | res = driver->query( raw ); | ||
71 | delete raw; | ||
72 | |||
73 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
74 | QString::number(uid)+",'Priority',1)"); | ||
75 | res = driver->query( raw ); | ||
76 | delete raw; | ||
77 | |||
78 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | ||
79 | QString::number(uid)+",'Description','" + | ||
80 | QString::number(uid) + "Description\n12344')"); | ||
81 | res = driver->query( raw ); | ||
82 | delete raw; | ||
83 | } | ||
84 | OSQLRawQuery raw3("COMMIT"); | ||
85 | res = driver->query(&raw3 ); | ||
86 | }; | ||
diff --git a/examples/opiedb/sqltest/zeilenweise.pro b/examples/opiedb/sqltest/zeilenweise.pro new file mode 100644 index 0000000..1fa17cd --- a/dev/null +++ b/examples/opiedb/sqltest/zeilenweise.pro | |||
@@ -0,0 +1,13 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = zeilenweise.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH+= $(OPIEDIR)/include | ||
7 | LIBS += -lqpe -lopiedb2 | ||
8 | TARGET = zeilenweise | ||
9 | |||
10 | |||
11 | |||
12 | |||
13 | include( $(OPIEDIR)/include.pro ) | ||