author | eilers <eilers> | 2004-10-27 14:28:16 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-10-27 14:28:16 (UTC) |
commit | 03adfc8b698fbed4b6f31c8320f510eb6da0d51d (patch) (unidiff) | |
tree | cb2faa9af5eedab6c816ca81433f457e8930cfc2 | |
parent | e44d35ca3fd26ef7a3184b07516f6535d8844a83 (diff) | |
download | opie-03adfc8b698fbed4b6f31c8320f510eb6da0d51d.zip opie-03adfc8b698fbed4b6f31c8320f510eb6da0d51d.tar.gz opie-03adfc8b698fbed4b6f31c8320f510eb6da0d51d.tar.bz2 |
Switching to sqlite3
Please read the following page for upgrade your old sqlite V2 database:
http://opie.handhelds.org/cgi-bin/moin.cgi/SqlBackends
-rw-r--r-- | Rules.make | 2 | ||||
-rw-r--r-- | dependencies.in | 2 | ||||
-rw-r--r-- | development/pim/dbpaper/intro.tex | 4 | ||||
-rw-r--r-- | libopie2/opiedb/config.in | 2 | ||||
-rw-r--r-- | libopie2/opiedb/libopiedb2.control | 4 | ||||
-rw-r--r-- | libopie2/opiedb/opiedb.pro | 2 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 98 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.h | 4 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 7 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimcontactfields.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtemplatebase.h | 6 |
11 files changed, 62 insertions, 71 deletions
@@ -216,102 +216,102 @@ $(OPIEDIR)/stamp-headers-x11 : | |||
216 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ | 216 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ |
217 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) | 217 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) |
218 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h | 218 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h |
219 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) | 219 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) |
220 | touch $@ | 220 | touch $@ |
221 | 221 | ||
222 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config | 222 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config |
223 | @-rm -f $@ | 223 | @-rm -f $@ |
224 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ | 224 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ |
225 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) | 225 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) |
226 | @touch $@ | 226 | @touch $@ |
227 | 227 | ||
228 | $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: | 228 | $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: |
229 | +$(call descend,$(shell dirname $@),$(shell basename $@)) | 229 | +$(call descend,$(shell dirname $@),$(shell basename $@)) |
230 | 230 | ||
231 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in | 231 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in |
232 | $(TOPDIR)/scripts/kconfig/mconf ./config.in | 232 | $(TOPDIR)/scripts/kconfig/mconf ./config.in |
233 | @touch ./.config.stamp | 233 | @touch ./.config.stamp |
234 | 234 | ||
235 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 235 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
236 | $(TOPDIR)/scripts/kconfig/qconf ./config.in | 236 | $(TOPDIR)/scripts/kconfig/qconf ./config.in |
237 | @touch .config.stamp | 237 | @touch .config.stamp |
238 | 238 | ||
239 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 239 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
240 | $(TOPDIR)/scripts/kconfig/gconf ./config.in | 240 | $(TOPDIR)/scripts/kconfig/gconf ./config.in |
241 | @touch .config.stamp | 241 | @touch .config.stamp |
242 | 242 | ||
243 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in | 243 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in |
244 | $(TOPDIR)/scripts/kconfig/conf ./config.in | 244 | $(TOPDIR)/scripts/kconfig/conf ./config.in |
245 | @touch .config.stamp | 245 | @touch .config.stamp |
246 | 246 | ||
247 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 247 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
248 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in | 248 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in |
249 | @touch .config.stamp | 249 | @touch .config.stamp |
250 | 250 | ||
251 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 251 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
252 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in | 252 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in |
253 | @touch .config.stamp | 253 | @touch .config.stamp |
254 | 254 | ||
255 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 255 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
256 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in | 256 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in |
257 | @touch .config.stamp | 257 | @touch .config.stamp |
258 | 258 | ||
259 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 259 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
260 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in | 260 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in |
261 | @touch .config.stamp | 261 | @touch .config.stamp |
262 | 262 | ||
263 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 263 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
264 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in | 264 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in |
265 | @touch .config.stamp | 265 | @touch .config.stamp |
266 | 266 | ||
267 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default | 267 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default |
268 | 268 | ||
269 | $(TOPDIR)/mkspecs/default : | 269 | $(TOPDIR)/mkspecs/default : |
270 | ln -sf linux-g++ $@ | 270 | ln -sf linux-g++ $@ |
271 | 271 | ||
272 | $(TOPDIR)/scripts/subst : force | 272 | $(TOPDIR)/scripts/subst : force |
273 | @( \ | 273 | @( \ |
274 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ | 274 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ |
275 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ | 275 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ |
276 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ | 276 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ |
277 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ | 277 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ |
278 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ | 278 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ |
279 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ | 279 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ |
280 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ | 280 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ |
281 | ) > $@ || ( rm -f $@; exit 1 ) | 281 | ) > $@ || ( rm -f $@; exit 1 ) |
282 | 282 | ||
283 | $(TOPDIR)/scripts/filesubst : force | 283 | $(TOPDIR)/scripts/filesubst : force |
284 | @( \ | 284 | @( \ |
285 | echo 's,\$$OPIEDIR/root/,/,g'; \ | 285 | echo 's,\$$OPIEDIR/root/,/,g'; \ |
286 | echo 's,$(OPIEDIR)/root/,/,g'; \ | 286 | echo 's,$(OPIEDIR)/root/,/,g'; \ |
287 | echo 's,\$$OPIEDIR,$(prefix),g'; \ | 287 | echo 's,\$$OPIEDIR,$(prefix),g'; \ |
288 | echo 's,$(OPIEDIR),$(prefix),g'; \ | 288 | echo 's,$(OPIEDIR),$(prefix),g'; \ |
289 | echo 's,\$$QTDIR,$(prefix),g'; \ | 289 | echo 's,\$$QTDIR,$(prefix),g'; \ |
290 | echo 's,$(QTDIR),$(prefix),g'; \ | 290 | echo 's,$(QTDIR),$(prefix),g'; \ |
291 | echo 's,^\(\./\)*root/,/,g'; \ | 291 | echo 's,^\(\./\)*root/,/,g'; \ |
292 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ | 292 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ |
293 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ | 293 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ |
294 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ | 294 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ |
295 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ | 295 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ |
296 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ | 296 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ |
297 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 297 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
298 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ | 298 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ |
299 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ | 299 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ |
300 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ | 300 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ |
301 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 301 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
302 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ | 302 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ |
303 | ) > $@ || ( rm -f $@; exit 1 ) | 303 | ) > $@ || ( rm -f $@; exit 1 ) |
304 | 304 | ||
305 | ## general rules ## | 305 | ## general rules ## |
306 | 306 | ||
307 | define descend | 307 | define descend |
308 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) | 308 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) |
309 | endef | 309 | endef |
310 | 310 | ||
311 | define makefilegen | 311 | define makefilegen |
312 | cd $(if $(1),$(dir $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(notdir $(1))) $(word 3,$(shell grep -m 1 "[[:space:]]$(patsubst %/Makefile,%,$(1))[[:space:]]" $(OPIEDIR)/packages)) | 312 | cd $(if $(1),$(dir $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(notdir $(1))) $(word 3,$(shell grep "[[:space:]]$(patsubst %/Makefile,%,$(1))[[:space:]]" $(OPIEDIR)/packages)) |
313 | endef | 313 | endef |
314 | 314 | ||
315 | define makecfg | 315 | define makecfg |
316 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) | 316 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) |
317 | endef | 317 | endef |
diff --git a/dependencies.in b/dependencies.in index 55b44e6..ce1ac96 100644 --- a/dependencies.in +++ b/dependencies.in | |||
@@ -1,84 +1,84 @@ | |||
1 | config LIBETPAN_DEP | 1 | config LIBETPAN_DEP |
2 | boolean "Have Libetpan >= 0.33pre" | 2 | boolean "Have Libetpan >= 0.33pre" |
3 | default "n" | 3 | default "n" |
4 | 4 | ||
5 | config LIBETPAN_LIB_DIR | 5 | config LIBETPAN_LIB_DIR |
6 | string "LIBETPAN library dir" | 6 | string "LIBETPAN library dir" |
7 | depends LIBETPAN_DEP | 7 | depends LIBETPAN_DEP |
8 | 8 | ||
9 | config LIBETPAN_INC_DIR | 9 | config LIBETPAN_INC_DIR |
10 | string "LIBETPAN include dir" | 10 | string "LIBETPAN include dir" |
11 | depends LIBETPAN_DEP | 11 | depends LIBETPAN_DEP |
12 | 12 | ||
13 | config LIBPCAP_DEP | 13 | config LIBPCAP_DEP |
14 | boolean "Have libpcap >= 0.7.2" | 14 | boolean "Have libpcap >= 0.7.2" |
15 | default "n" | 15 | default "n" |
16 | 16 | ||
17 | config LIBPCAP_LIB_DIR | 17 | config LIBPCAP_LIB_DIR |
18 | string "LIBPCAP library dir" | 18 | string "LIBPCAP library dir" |
19 | depends LIBPCAP_DEP | 19 | depends LIBPCAP_DEP |
20 | 20 | ||
21 | config LIBPCAP_INC_DIR | 21 | config LIBPCAP_INC_DIR |
22 | string "LIBPCAP include dir" | 22 | string "LIBPCAP include dir" |
23 | depends LIBPCAP_DEP | 23 | depends LIBPCAP_DEP |
24 | 24 | ||
25 | config LIBSQLITE_DEP | 25 | config LIBSQLITE_DEP |
26 | boolean "Have sqlite >= 2.8.6" | 26 | boolean "Have sqlite >= 3.0.7" |
27 | default n | 27 | default n |
28 | 28 | ||
29 | config LIBSQLITE_LIB_DIR | 29 | config LIBSQLITE_LIB_DIR |
30 | string "LIBSQLITE library dir" | 30 | string "LIBSQLITE library dir" |
31 | depends LIBSQLITE_DEP | 31 | depends LIBSQLITE_DEP |
32 | 32 | ||
33 | config LIBSQLITE_INC_DIR | 33 | config LIBSQLITE_INC_DIR |
34 | string "LIBSQLITE include dir" | 34 | string "LIBSQLITE include dir" |
35 | depends LIBSQLITE_DEP | 35 | depends LIBSQLITE_DEP |
36 | 36 | ||
37 | config LIBXINE_DEP | 37 | config LIBXINE_DEP |
38 | boolean "Have libxine >= 1.0rc6" | 38 | boolean "Have libxine >= 1.0rc6" |
39 | default "n" | 39 | default "n" |
40 | 40 | ||
41 | config LIBXINE_LIB_DIR | 41 | config LIBXINE_LIB_DIR |
42 | string "LIBXINE library dir" | 42 | string "LIBXINE library dir" |
43 | depends LIBXINE_DEP | 43 | depends LIBXINE_DEP |
44 | 44 | ||
45 | config LIBXINE_INC_DIR | 45 | config LIBXINE_INC_DIR |
46 | string "LIBXINE include dir" | 46 | string "LIBXINE include dir" |
47 | depends LIBXINE_DEP | 47 | depends LIBXINE_DEP |
48 | 48 | ||
49 | config LIBIPK_DEP | 49 | config LIBIPK_DEP |
50 | boolean "Have libipkg >= 0.99.120" | 50 | boolean "Have libipkg >= 0.99.120" |
51 | default "n" | 51 | default "n" |
52 | 52 | ||
53 | config LIBIPK_LIB_DIR | 53 | config LIBIPK_LIB_DIR |
54 | string "libipkg library dir" | 54 | string "libipkg library dir" |
55 | depends LIBIPK_DEP | 55 | depends LIBIPK_DEP |
56 | 56 | ||
57 | config LIBIPK_INC_DIR | 57 | config LIBIPK_INC_DIR |
58 | string "libipkg include dir" | 58 | string "libipkg include dir" |
59 | depends LIBIPK_DEP | 59 | depends LIBIPK_DEP |
60 | 60 | ||
61 | config LIBSDL_DEP | 61 | config LIBSDL_DEP |
62 | boolean "Have libsdl12 and sdlimage" | 62 | boolean "Have libsdl12 and sdlimage" |
63 | default "n" | 63 | default "n" |
64 | 64 | ||
65 | config LIBSDL_LIB_DIR | 65 | config LIBSDL_LIB_DIR |
66 | string "LIBSDL library dir" | 66 | string "LIBSDL library dir" |
67 | depends LIBSDL_DEP | 67 | depends LIBSDL_DEP |
68 | 68 | ||
69 | config LIBSDL_INC_DIR | 69 | config LIBSDL_INC_DIR |
70 | string "LIBSDL include dir" | 70 | string "LIBSDL include dir" |
71 | depends LIBSDL_DEP | 71 | depends LIBSDL_DEP |
72 | 72 | ||
73 | config LIBSWORD_DEP | 73 | config LIBSWORD_DEP |
74 | boolean "Have libsword > = 1.5.0" | 74 | boolean "Have libsword > = 1.5.0" |
75 | default "n" | 75 | default "n" |
76 | 76 | ||
77 | config LIBSWORD_LIB_DIR | 77 | config LIBSWORD_LIB_DIR |
78 | string "libsword library dir" | 78 | string "libsword library dir" |
79 | depends LIBSWORD_DEP | 79 | depends LIBSWORD_DEP |
80 | 80 | ||
81 | config LIBSWORD_INC_DIR | 81 | config LIBSWORD_INC_DIR |
82 | string "libsword include dir" | 82 | string "libsword include dir" |
83 | depends LIBSWORD_DEP | 83 | depends LIBSWORD_DEP |
84 | 84 | ||
diff --git a/development/pim/dbpaper/intro.tex b/development/pim/dbpaper/intro.tex index c456333..fd790d7 100644 --- a/development/pim/dbpaper/intro.tex +++ b/development/pim/dbpaper/intro.tex | |||
@@ -1,107 +1,107 @@ | |||
1 | \pagebreak | 1 | \pagebreak |
2 | \section{Introduction} | 2 | \section{Introduction} |
3 | 3 | ||
4 | \subsection{This document} | 4 | \subsection{This document} |
5 | 5 | ||
6 | Note: This paper is just a request for comment! Don't expect to find anything in the real implementation ! | 6 | Note: This paper is just a request for comment! Don't expect to find anything in the real implementation ! |
7 | \\ | 7 | \\ |
8 | This draft paper describes the database layout of the Opie PIM applications. | 8 | This draft paper describes the database layout of the Opie PIM applications. |
9 | Design goal is a fast and extendable layout on a sql database to support cross referencing. | 9 | Design goal is a fast and extendable layout on a sql database to support cross referencing. |
10 | 10 | ||
11 | 11 | ||
12 | \subsection{Copyright} | 12 | \subsection{Copyright} |
13 | 13 | ||
14 | Copyright notice | 14 | Copyright notice |
15 | \copyright 2002, Maximilian Rei{\ss} \& Stefan Eilers \& Holger Freyther | 15 | \copyright 2002-2004, Maximilian Rei{\ss} \& Stefan Eilers \& Holger Freyther |
16 | 16 | ||
17 | \pagebreak | 17 | \pagebreak |
18 | \section{Relations} | 18 | \section{Relations} |
19 | \subsection{About Cross Referencing and Horizontal Data Storage} | 19 | \subsection{About Cross Referencing and Horizontal Data Storage} |
20 | Before you read on, it may be helpful to get some information about the solution of ``horizontal'' data storage into the tables and cross referencing. | 20 | Before you read on, it may be helpful to get some information about the solution of ``horizontal'' data storage into the tables and cross referencing. |
21 | Some of the tables are just using 5 attributes: | 21 | Some of the tables are just using 5 attributes: |
22 | \begin{enumerate} | 22 | \begin{enumerate} |
23 | \item UID: This countains an unique ID for the complete entry. An entry may consist of multiple | 23 | \item UID: This countains an unique ID for the complete entry. An entry may consist of multiple |
24 | rows, seperated by ID. | 24 | rows, seperated by ID. |
25 | \item ID: This defines a number to seperate the rows of an entry. UID + ID must be unique for every entry. | 25 | \item ID: This defines a number to seperate the rows of an entry. UID + ID must be unique for every entry (primary key). |
26 | \item Type: Describes the type of this entry. | 26 | \item Type: Describes the type of this entry. |
27 | \item Priority: For instance: Your default email-address will get the priority 1 and the other 2.. . 0 means ``not defined''. | 27 | \item Priority: For instance: Your default email-address will get the priority 1 and the other 2.. . 0 means ``not defined''. |
28 | \item Value: The data which was described by ``Type'' is stored here. | 28 | \item Value: The data which was described by ``Type'' is stored here. |
29 | \end{enumerate} | 29 | \end{enumerate} |
30 | 30 | ||
31 | These kinds of tables are very flexible in what they may contain, due to the fact that the ``Type'' may be without any constraint. Therefore it is perfectly for storing personal information, which may change in the future, or should be increased. | 31 | These kinds of tables are very flexible in what they may contain, due to the fact that the ``Type'' may be without any constraint. Therefore it is perfectly for storing personal information, which may change in the future, or should be increased. |
32 | \\ | 32 | \\ |
33 | Let's see how such an entry may look like for the table ``ADDRESSBOOK'': | 33 | Let's see how such an entry may look like for the table ``ADDRESSBOOK'': |
34 | 34 | ||
35 | \begin{tabular}[ht]{|l|l|l|l|} | 35 | \begin{tabular}[ht]{|l|l|l|l|} |
36 | \hline | 36 | \hline |
37 | \underline{UID} & \underline{ID} & Type & Value\\ | 37 | \underline{UID} & \underline{ID} & Type & Value\\ |
38 | \hline | 38 | \hline |
39 | 1231& 00& Title& Herr\\ | 39 | 1231& 00& Title& Herr\\ |
40 | \hline | 40 | \hline |
41 | 1231& 01& FirstName& Stefan\\ | 41 | 1231& 01& FirstName& Stefan\\ |
42 | \hline | 42 | \hline |
43 | 1231& 02& LastName& Eilers\\ | 43 | 1231& 02& LastName& Eilers\\ |
44 | \hline | 44 | \hline |
45 | \end{tabular} | 45 | \end{tabular} |
46 | \\ | 46 | \\ |
47 | \\ | 47 | \\ |
48 | We need some additional information about this entry, which is stored into the table ``PERSONAL\_DATA'': | 48 | We need some additional information about this entry, which is stored into the table ``PERSONAL\_DATA'': |
49 | \\ | 49 | \\ |
50 | \\ | 50 | \\ |
51 | \begin{tabular}[ht]{|l|l|l|l|l|} | 51 | \begin{tabular}[ht]{|l|l|l|l|l|} |
52 | \hline | 52 | \hline |
53 | \underline{UID} & \underline{ID} & Type & Priority & Value\\ | 53 | \underline{UID} & \underline{ID} & Type & Priority & Value\\ |
54 | \hline | 54 | \hline |
55 | 2345& 00& Email& 1& eilers.stefan@epost.de\\ | 55 | 2345& 00& Email& 1& eilers.stefan@epost.de\\ |
56 | \hline | 56 | \hline |
57 | 2345& 01& Email& 2& eilers@sra.uni-hannover.de\\ | 57 | 2345& 01& Email& 2& eilers@sra.uni-hannover.de\\ |
58 | \hline | 58 | \hline |
59 | 2345& 02& WebPage& 1& www.sra.uni-hannover.de/$\sim$eilers/\\ | 59 | 2345& 02& WebPage& 1& www.sra.uni-hannover.de/$\sim$eilers/\\ |
60 | \hline | 60 | \hline |
61 | \end{tabular} | 61 | \end{tabular} |
62 | \\ | 62 | \\ |
63 | \\ | 63 | \\ |
64 | The last question is: How to get these information together? This is the job of the cross-referencing-table\footnote{We expecting that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''and ADDRESSBOOK with ``01''!}: | 64 | The last question is: How to get these information together? This is the job of the cross-referencing-table\footnote{We expecting that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''and ADDRESSBOOK with ``01''!}: |
65 | \\ | 65 | \\ |
66 | \\ | 66 | \\ |
67 | \begin{tabular}[ht]{|l|l|l|l|l|l|} | 67 | \begin{tabular}[ht]{|l|l|l|l|l|l|} |
68 | \hline | 68 | \hline |
69 | \underline{TID1} & \underline{UID1} & \underline{ID1} & \underline{TID2} & \underline{UID2} & \underline{ID2} \\ | 69 | \underline{TID1} & \underline{UID1} & \underline{ID1} & \underline{TID2} & \underline{UID2} & \underline{ID2} \\ |
70 | \hline | 70 | \hline |
71 | 01& 1231& (NULL) & 03& 2345& (NULL) \\ | 71 | 01& 1231& (NULL) & 03& 2345& (NULL) \\ |
72 | \hline | 72 | \hline |
73 | \end{tabular} | 73 | \end{tabular} |
74 | \\ | 74 | \\ |
75 | \\ | 75 | \\ |
76 | ID was left empty, due to the fact that we wanted to link the complete entry and not some rows of the entry. | 76 | ID was left empty, due to the fact that we wanted to link the complete entry and not some rows of the entry. |
77 | \\ | 77 | \\ |
78 | In some cases, it may be useful to reference in a much more smaller granularity than complete entries. What should we do, if we want to store the children of a person ? | 78 | In some cases, it may be useful to reference in a much more smaller granularity than complete entries. What should we do, if we want to store the children of a person ? |
79 | The easiest way is to store the children into the table ``PERSONAL\_DATA'':\footnote{We remember that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''!}, too.\\ | 79 | The easiest way is to store the children into the table ``PERSONAL\_DATA'':\footnote{We remember that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''!}, too.\\ |
80 | \\ | 80 | \\ |
81 | \begin{tabular}[ht]{|l|l|l|l|l|} | 81 | \begin{tabular}[ht]{|l|l|l|l|l|} |
82 | \hline | 82 | \hline |
83 | \underline{UID} & \underline{ID} & Type & Priority & Value\\ | 83 | \underline{UID} & \underline{ID} & Type & Priority & Value\\ |
84 | \hline | 84 | \hline |
85 | 2345& 11& Child & 0 & Amaly \\ | 85 | 2345& 11& Child & 0 & Amaly \\ |
86 | \hline | 86 | \hline |
87 | 2345& 12& Child & 0 & Karl \\ | 87 | 2345& 12& Child & 0 & Karl \\ |
88 | \hline | 88 | \hline |
89 | 2345& 13& Child & 0 & Clarissa\\ | 89 | 2345& 13& Child & 0 & Clarissa\\ |
90 | \hline | 90 | \hline |
91 | \end{tabular}\\ | 91 | \end{tabular}\\ |
92 | \\ | 92 | \\ |
93 | 93 | ||
94 | But what happens if you want to store additional information about the children, as there mobile phone numbers, etc? | 94 | But what happens if you want to store additional information about the children, as there mobile phone numbers, etc? |
95 | 95 | ||
96 | In this case we need an entry in addressbook and a reference to this entry. Lets expect ``Amaly'' was stored in the table ``ADDRESSBOOK'' with UID 9213 and Karl with UID 7654. A cross-reference will look like this:\\ | 96 | In this case we need an entry in addressbook and a reference to this entry. Lets expect ``Amaly'' was stored in the table ``ADDRESSBOOK'' with UID 9213 and Karl with UID 7654. A cross-reference will look like this:\\ |
97 | \\ | 97 | \\ |
98 | \begin{tabular}[ht]{|l|l|l|l|l|l|} | 98 | \begin{tabular}[ht]{|l|l|l|l|l|l|} |
99 | \hline | 99 | \hline |
100 | \underline{TID1} & \underline{UID1} & \underline{ID1} & \underline{TID2} & \underline{UID2} & \underline{ID2} \\ | 100 | \underline{TID1} & \underline{UID1} & \underline{ID1} & \underline{TID2} & \underline{UID2} & \underline{ID2} \\ |
101 | \hline | 101 | \hline |
102 | 03& 2345& 11& 01& 9213& (NULL) \\ | 102 | 03& 2345& 11& 01& 9213& (NULL) \\ |
103 | \hline | 103 | \hline |
104 | 03& 2345& 12& 01& 7654& (NULL) \\ | 104 | 03& 2345& 12& 01& 7654& (NULL) \\ |
105 | \hline | 105 | \hline |
106 | \end{tabular} | 106 | \end{tabular} |
107 | \\ | 107 | \\ |
diff --git a/libopie2/opiedb/config.in b/libopie2/opiedb/config.in index 4d85609..0d74887 100644 --- a/libopie2/opiedb/config.in +++ b/libopie2/opiedb/config.in | |||
@@ -1,7 +1,7 @@ | |||
1 | config LIBOPIE2DB | 1 | config LIBOPIE2DB |
2 | boolean "libopie2db (database related classes)" | 2 | boolean "libopie2db (database related classes)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBSQLITE_DEP | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBSQLITE_DEP |
5 | comment "libopie2db needs a libqpe, sqlite and libopie2core" | 5 | comment "libopie2db needs a libqpe, libsqlite3 and libopie2core" |
6 | depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBSQLITE_DEP) | 6 | depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBSQLITE_DEP) |
7 | 7 | ||
diff --git a/libopie2/opiedb/libopiedb2.control b/libopie2/opiedb/libopiedb2.control index 4859c46..29fae78 100644 --- a/libopie2/opiedb/libopiedb2.control +++ b/libopie2/opiedb/libopiedb2.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: libopiedb2 | 1 | Package: libopiedb2 |
2 | Files: lib/libopiedb2.so* | 2 | Files: lib/libopiedb2.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/system | 4 | Section: opie/system |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 1.8.2-$SUB_VERSION.2 | 7 | Version: 1.8.2-$SUB_VERSION.2 |
8 | Depends: libqpe1, libopiecore2 (1.8.2), libsqlite0 | sqlite | 8 | Depends: libqpe1, libopiecore2 (1.8.2), libsqlite3 | sqlite3 |
9 | Provides: libopiedb2 | 9 | Provides: libopiedb2 |
10 | Description: Opie library 2.0 DB | 10 | Description: Opie library 2.1 DB |
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index 8432674..f727995 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -1,43 +1,43 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = osqlbackend.h \ | 4 | HEADERS = osqlbackend.h \ |
5 | osqldriver.h \ | 5 | osqldriver.h \ |
6 | osqlerror.h \ | 6 | osqlerror.h \ |
7 | osqlmanager.h \ | 7 | osqlmanager.h \ |
8 | osqlquery.h \ | 8 | osqlquery.h \ |
9 | osqlresult.h \ | 9 | osqlresult.h \ |
10 | osqltable.h \ | 10 | osqltable.h \ |
11 | osqlbackendmanager.h \ | 11 | osqlbackendmanager.h \ |
12 | osqlitedriver.h | 12 | osqlitedriver.h |
13 | 13 | ||
14 | SOURCES = osqlbackend.cpp \ | 14 | SOURCES = osqlbackend.cpp \ |
15 | osqldriver.cpp \ | 15 | osqldriver.cpp \ |
16 | osqlerror.cpp \ | 16 | osqlerror.cpp \ |
17 | osqlmanager.cpp \ | 17 | osqlmanager.cpp \ |
18 | osqlquery.cpp \ | 18 | osqlquery.cpp \ |
19 | osqlresult.cpp \ | 19 | osqlresult.cpp \ |
20 | osqltable.cpp \ | 20 | osqltable.cpp \ |
21 | osqlbackendmanager.cpp \ | 21 | osqlbackendmanager.cpp \ |
22 | osqlitedriver.cpp | 22 | osqlitedriver.cpp |
23 | 23 | ||
24 | TARGET = opiedb2 | 24 | TARGET = opiedb2 |
25 | VERSION = 1.9.0 | 25 | VERSION = 1.9.0 |
26 | INCLUDEPATH = $(OPIEDIR)/include | 26 | INCLUDEPATH = $(OPIEDIR)/include |
27 | DEPENDPATH = $(OPIEDIR)/include | 27 | DEPENDPATH = $(OPIEDIR)/include |
28 | LIBS += -lopiecore2 -lqpe -lsqlite | 28 | LIBS += -lopiecore2 -lqpe -lsqlite3 |
29 | 29 | ||
30 | !contains( platform, x11 ) { | 30 | !contains( platform, x11 ) { |
31 | include ( $(OPIEDIR)/include.pro ) | 31 | include ( $(OPIEDIR)/include.pro ) |
32 | } | 32 | } |
33 | 33 | ||
34 | contains( platform, x11 ) { | 34 | contains( platform, x11 ) { |
35 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 35 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
36 | } | 36 | } |
37 | 37 | ||
38 | !isEmpty( LIBSQLITE_INC_DIR ) { | 38 | !isEmpty( LIBSQLITE_INC_DIR ) { |
39 | INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH | 39 | INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH |
40 | } | 40 | } |
41 | !isEmpty( LIBSQLITE_LIB_DIR ) { | 41 | !isEmpty( LIBSQLITE_LIB_DIR ) { |
42 | LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS | 42 | LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS |
43 | } | 43 | } |
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index c8b560f..816223e 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp | |||
@@ -10,219 +10,223 @@ | |||
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
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 | #include <stdio.h> | 37 | #include <stdio.h> |
38 | 38 | ||
39 | namespace Opie { | 39 | namespace Opie { |
40 | namespace DB { | 40 | namespace DB { |
41 | namespace Internal { | 41 | namespace Internal { |
42 | 42 | ||
43 | namespace { | 43 | namespace { |
44 | struct Query { | 44 | struct Query { |
45 | OSQLError::ValueList errors; | 45 | OSQLError::ValueList errors; |
46 | OSQLResultItem::ValueList items; | 46 | OSQLResultItem::ValueList items; |
47 | OSQLiteDriver *driver; | 47 | OSQLiteDriver *driver; |
48 | }; | 48 | }; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) | 52 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) |
53 | : OSQLDriver( lib ) | 53 | : OSQLDriver( lib ) |
54 | { | 54 | { |
55 | m_sqlite = 0l; | 55 | m_sqlite = 0l; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | OSQLiteDriver::~OSQLiteDriver() { | 59 | OSQLiteDriver::~OSQLiteDriver() { |
60 | close(); | 60 | close(); |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | QString OSQLiteDriver::id()const { | 64 | QString OSQLiteDriver::id()const { |
65 | return QString::fromLatin1("SQLite"); | 65 | return QString::fromLatin1("SQLite"); |
66 | } | 66 | } |
67 | 67 | ||
68 | void OSQLiteDriver::setUserName( const QString& ) {} | 68 | void OSQLiteDriver::setUserName( const QString& ) {} |
69 | 69 | ||
70 | 70 | ||
71 | void OSQLiteDriver::setPassword( const QString& ) {} | 71 | void OSQLiteDriver::setPassword( const QString& ) {} |
72 | 72 | ||
73 | 73 | ||
74 | void OSQLiteDriver::setUrl( const QString& url ) { | 74 | void OSQLiteDriver::setUrl( const QString& url ) { |
75 | m_url = url; | 75 | m_url = url; |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | void OSQLiteDriver::setOptions( const QStringList& ) { | 79 | void OSQLiteDriver::setOptions( const QStringList& ) { |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Functions to patch a regex search into sqlite | 83 | * Functions to patch a regex search into sqlite |
84 | */ | 84 | */ |
85 | int sqliteRlikeCompare(const char *zPattern, const char *zString, sqregex *reg){ | 85 | int sqliteRlikeCompare(const char *zPattern, const char *zString, sqregex *reg){ |
86 | int res; | 86 | int res; |
87 | if (reg->regex_raw == NULL || (strcmp (zPattern, reg->regex_raw) != 0)){ | 87 | if (reg->regex_raw == NULL || (strcmp (zPattern, reg->regex_raw) != 0)){ |
88 | if (reg->regex_raw != NULL) { | 88 | if (reg->regex_raw != NULL) { |
89 | free(reg->regex_raw); | 89 | free(reg->regex_raw); |
90 | regfree(®->regex_c); | 90 | regfree(®->regex_c); |
91 | } | 91 | } |
92 | reg->regex_raw = (char *)malloc(strlen(zPattern)+1); | 92 | reg->regex_raw = (char *)malloc(strlen(zPattern)+1); |
93 | strncpy(reg->regex_raw, zPattern, strlen(zPattern)+1); | 93 | strncpy(reg->regex_raw, zPattern, strlen(zPattern)+1); |
94 | res = regcomp(®->regex_c, zPattern, REG_EXTENDED); | 94 | res = regcomp(®->regex_c, zPattern, REG_EXTENDED); |
95 | if ( res != 0 ) { | 95 | if ( res != 0 ) { |
96 | printf("Regcomp failed with code %u on string %s\n",res,zPattern); | 96 | printf("Regcomp failed with code %u on string %s\n",res,zPattern); |
97 | free(reg->regex_raw); | 97 | free(reg->regex_raw); |
98 | reg->regex_raw=NULL; | 98 | reg->regex_raw=NULL; |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | res = (regexec(®->regex_c, zString, 0, NULL, 0)==0); | 102 | res = (regexec(®->regex_c, zString, 0, NULL, 0)==0); |
103 | return res; | 103 | return res; |
104 | } | 104 | } |
105 | 105 | ||
106 | void rlikeFunc(sqlite_func *context, int arg, const char **argv){ | 106 | void rlikeFunc( sqlite3_context* context, int count, sqlite3_value** values ){ |
107 | if( arg < 2 || argv[0]==0 || argv[1]==0 ){ | 107 | const unsigned char* argv0 = sqlite3_value_text( values[0] ); |
108 | printf("One of arguments Null!!\n"); | 108 | const unsigned char* argv1 = sqlite3_value_text( values[1] ); |
109 | return; | 109 | if( count < 2 || argv0 == 0 || argv1 == 0 ){ |
110 | qWarning( "One of arguments Null!!\n" ); | ||
111 | return; | ||
110 | } | 112 | } |
111 | sqlite_set_result_int(context, | 113 | sqlite3_result_int(context, sqliteRlikeCompare((const char*)argv0, |
112 | sqliteRlikeCompare((const char*)argv[0], | 114 | (const char*)argv1, |
113 | (const char*)argv[1], (sqregex *)sqlite_user_data(context) )); | 115 | (sqregex *) sqlite3_user_data( context ) )); |
114 | } | 116 | } |
115 | 117 | ||
116 | /* | 118 | /* |
117 | * try to open a db specified via setUrl | 119 | * try to open a db specified via setUrl |
118 | * and options | 120 | * and options |
119 | */ | 121 | */ |
120 | bool OSQLiteDriver::open() { | 122 | bool OSQLiteDriver::open() { |
121 | char *error; | ||
122 | |||
123 | odebug << "OSQLiteDriver::open: about to open" << oendl; | 123 | odebug << "OSQLiteDriver::open: about to open" << oendl; |
124 | m_sqlite = sqlite_open(m_url.local8Bit(), | 124 | |
125 | 0, | 125 | int error = sqlite3_open( m_url.utf8(), |
126 | &error ); | 126 | &m_sqlite ); |
127 | 127 | ||
128 | /* failed to open */ | 128 | /* failed to open */ |
129 | if (m_sqlite == 0l ) { | 129 | if ( error != SQLITE_OK ) { |
130 | // FIXME set the last error | 130 | // FIXME set the last error |
131 | owarn << "OSQLiteDriver::open: " << error << "" << oendl; | 131 | owarn << "OSQLiteDriver::open: " << error << "" << oendl; |
132 | free( error ); | 132 | sqlite3_close( m_sqlite ); |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | if (sqlite_create_function(m_sqlite,"rlike",2,rlikeFunc,&sqreg) != 0) | 135 | if ( sqlite3_create_function( m_sqlite, "rlike", 2, SQLITE_UTF8, &sqreg, rlikeFunc, NULL, NULL ) != SQLITE_OK ){ |
136 | odebug << "Unable to create user defined function!" << oendl; | 136 | odebug << "Unable to create user defined function!" << oendl; |
137 | if (sqlite_function_type(m_sqlite,"rlike",SQLITE_NUMERIC) != 0) | 137 | return false; |
138 | odebug << "Unable to set rlike function result type!" << oendl; | 138 | } |
139 | |||
139 | sqreg.regex_raw = NULL; | 140 | sqreg.regex_raw = NULL; |
141 | |||
140 | return true; | 142 | return true; |
141 | } | 143 | } |
142 | 144 | ||
143 | 145 | ||
144 | /* close the db | 146 | /* close the db |
145 | * sqlite closes them without | 147 | * sqlite closes them without |
146 | * telling failure or success | 148 | * telling failure or success |
147 | */ | 149 | */ |
148 | bool OSQLiteDriver::close() { | 150 | bool OSQLiteDriver::close() { |
149 | if (m_sqlite ) | 151 | if ( m_sqlite ){ |
150 | sqlite_close( m_sqlite ), m_sqlite=0l; | 152 | sqlite3_close( m_sqlite ); |
151 | if (sqreg.regex_raw != NULL){ | 153 | m_sqlite=0l; |
152 | odebug << "Freeing regex on close" << oendl; | 154 | } |
153 | free(sqreg.regex_raw); | 155 | if ( sqreg.regex_raw != NULL){ |
154 | sqreg.regex_raw=NULL; | 156 | odebug << "Freeing regex on close" << oendl; |
155 | regfree(&sqreg.regex_c); | 157 | free( sqreg.regex_raw ); |
156 | } | 158 | sqreg.regex_raw = NULL; |
157 | return true; | 159 | regfree( &sqreg.regex_c ); |
160 | } | ||
161 | return true; | ||
158 | } | 162 | } |
159 | 163 | ||
160 | 164 | ||
161 | /* Query */ | 165 | /* Query */ |
162 | OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | 166 | OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { |
163 | if ( !m_sqlite ) { | 167 | if ( !m_sqlite ) { |
164 | // FIXME set error code | 168 | // FIXME set error code |
165 | OSQLResult result( OSQLResult::Failure ); | 169 | OSQLResult result( OSQLResult::Failure ); |
166 | return result; | 170 | return result; |
167 | } | 171 | } |
168 | Query query; | 172 | Query query; |
169 | query.driver = this; | 173 | query.driver = this; |
170 | char *err; | 174 | char *err; |
171 | /* SQLITE_OK 0 if return code > 0 == failure */ | 175 | /* SQLITE_OK 0 if return code > 0 == failure */ |
172 | if ( sqlite_exec(m_sqlite, qu->query().utf8(),&call_back, &query, &err) > 0 ) { | 176 | if ( sqlite3_exec( m_sqlite, qu->query().utf8(), &call_back, &query, &err ) > SQLITE_OK ) { |
173 | owarn << "OSQLiteDriver::query: Error while executing " << err << "" << oendl; | 177 | owarn << "OSQLiteDriver::query: Error while executing " << err << "" << oendl; |
174 | free( err ); | 178 | free( err ); |
175 | // FixMe Errors | 179 | // FixMe Errors |
176 | } | 180 | } |
177 | 181 | ||
178 | OSQLResult result(OSQLResult::Success, | 182 | OSQLResult result(OSQLResult::Success, |
179 | query.items, | 183 | query.items, |
180 | query.errors ); | 184 | query.errors ); |
181 | return result; | 185 | return result; |
182 | } | 186 | } |
183 | 187 | ||
184 | 188 | ||
185 | OSQLTable::ValueList OSQLiteDriver::tables() const { | 189 | OSQLTable::ValueList OSQLiteDriver::tables() const { |
186 | return OSQLTable::ValueList(); | 190 | return OSQLTable::ValueList(); |
187 | } | 191 | } |
188 | 192 | ||
189 | 193 | ||
190 | OSQLError OSQLiteDriver::lastError() { | 194 | OSQLError OSQLiteDriver::lastError() { |
191 | OSQLError error; | 195 | OSQLError error; |
192 | return error; | 196 | return error; |
193 | }; | 197 | }; |
194 | 198 | ||
195 | 199 | ||
196 | /* handle a callback add the row to the global | 200 | /* handle a callback add the row to the global |
197 | * OSQLResultItem | 201 | * OSQLResultItem |
198 | */ | 202 | */ |
199 | int OSQLiteDriver::handleCallBack( int, char**, char** ) { | 203 | int OSQLiteDriver::handleCallBack( int, char**, char** ) { |
200 | return 0; | 204 | return 0; |
201 | } | 205 | } |
202 | 206 | ||
203 | 207 | ||
204 | /* callback_handler add the values to the list*/ | 208 | /* callback_handler add the values to the list*/ |
205 | int OSQLiteDriver::call_back( void* voi, int argc, | 209 | int OSQLiteDriver::call_back( void* voi, int argc, |
206 | char** argv, char** columns) { | 210 | char** argv, char** columns ) { |
207 | Query* qu = (Query*)voi; | 211 | Query* qu = (Query*)voi; |
208 | 212 | ||
209 | //copy them over to a OSQLResultItem | 213 | //copy them over to a OSQLResultItem |
210 | QMap<QString, QString> tableString; | 214 | QMap<QString, QString> tableString; |
211 | QMap<int, QString> tableInt; | 215 | QMap<int, QString> tableInt; |
212 | for (int i = 0; i < argc; i++ ) { | 216 | for (int i = 0; i < argc; i++ ) { |
213 | 217 | ||
214 | tableInt.insert( i, QString::fromUtf8( argv[i] ) ); | 218 | tableInt.insert( i, QString::fromUtf8( argv[i] ) ); |
215 | tableString.insert( QString::fromUtf8( columns[i] ), | 219 | tableString.insert( QString::fromUtf8( columns[i] ), |
216 | QString::fromUtf8( argv[i] ) ); | 220 | QString::fromUtf8( argv[i] ) ); |
217 | } | 221 | } |
218 | OSQLResultItem item( tableString, tableInt ); | 222 | OSQLResultItem item( tableString, tableInt ); |
219 | qu->items.append( item ); | 223 | qu->items.append( item ); |
220 | 224 | ||
221 | return ((Query*)voi)->driver->handleCallBack( argc, | 225 | return ((Query*)voi)->driver->handleCallBack( argc, |
222 | argv, | 226 | argv, |
223 | columns ); | 227 | columns ); |
224 | 228 | ||
225 | 229 | ||
226 | } | 230 | } |
227 | 231 | ||
228 | }}} // namespace OPIE::DB::Internal | 232 | }}} // namespace OPIE::DB::Internal |
diff --git a/libopie2/opiedb/osqlitedriver.h b/libopie2/opiedb/osqlitedriver.h index e38fd52..4990a11 100644 --- a/libopie2/opiedb/osqlitedriver.h +++ b/libopie2/opiedb/osqlitedriver.h | |||
@@ -1,51 +1,51 @@ | |||
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 <sqlite3.h> |
5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
6 | #include <regex.h> | 6 | #include <regex.h> |
7 | 7 | ||
8 | #include "osqldriver.h" | 8 | #include "osqldriver.h" |
9 | #include "osqlerror.h" | 9 | #include "osqlerror.h" |
10 | #include "osqlresult.h" | 10 | #include "osqlresult.h" |
11 | 11 | ||
12 | namespace Opie { | 12 | namespace Opie { |
13 | namespace DB { | 13 | namespace DB { |
14 | namespace Internal { | 14 | namespace Internal { |
15 | 15 | ||
16 | struct sqregex { | 16 | struct sqregex { |
17 | char *regex_raw; | 17 | char *regex_raw; |
18 | regex_t regex_c; | 18 | regex_t regex_c; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | class OSQLiteDriver : public OSQLDriver { | 21 | class OSQLiteDriver : public OSQLDriver { |
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | public: | 23 | public: |
24 | OSQLiteDriver( QLibrary *lib = 0l ); | 24 | OSQLiteDriver( QLibrary *lib = 0l ); |
25 | ~OSQLiteDriver(); | 25 | ~OSQLiteDriver(); |
26 | QString id()const; | 26 | QString id()const; |
27 | void setUserName( const QString& ); | 27 | void setUserName( const QString& ); |
28 | void setPassword( const QString& ); | 28 | void setPassword( const QString& ); |
29 | void setUrl( const QString& url ); | 29 | void setUrl( const QString& url ); |
30 | void setOptions( const QStringList& ); | 30 | void setOptions( const QStringList& ); |
31 | bool open(); | 31 | bool open(); |
32 | bool close(); | 32 | bool close(); |
33 | OSQLError lastError(); | 33 | OSQLError lastError(); |
34 | OSQLResult query( OSQLQuery* ); | 34 | OSQLResult query( OSQLQuery* ); |
35 | OSQLTable::ValueList tables()const; | 35 | OSQLTable::ValueList tables()const; |
36 | 36 | ||
37 | private: | 37 | private: |
38 | OSQLError m_lastE; | 38 | OSQLError m_lastE; |
39 | OSQLResult m_result; | 39 | OSQLResult m_result; |
40 | OSQLResultItem m_items; | 40 | OSQLResultItem m_items; |
41 | int handleCallBack( int, char**, char** ); | 41 | int handleCallBack( int, char**, char** ); |
42 | static int call_back( void*, int, char**, char** ); | 42 | static int call_back( void*, int, char**, char** ); |
43 | QString m_url; | 43 | QString m_url; |
44 | sqlite *m_sqlite; | 44 | sqlite3 *m_sqlite; |
45 | sqregex sqreg; | 45 | sqregex sqreg; |
46 | }; | 46 | }; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | #endif | 51 | #endif |
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 7ab1ea5..f936d4e 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h | |||
@@ -85,286 +85,279 @@ public: | |||
85 | */ | 85 | */ |
86 | virtual bool reload(); | 86 | virtual bool reload(); |
87 | 87 | ||
88 | /** Save contacts database. | 88 | /** Save contacts database. |
89 | * Save is more a "commit". After calling this function, all changes are public available. | 89 | * Save is more a "commit". After calling this function, all changes are public available. |
90 | * @return true if successful | 90 | * @return true if successful |
91 | */ | 91 | */ |
92 | bool save(); | 92 | bool save(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * if the resource was changed externally | 95 | * if the resource was changed externally |
96 | * You should use the signal handling instead of polling possible changes ! | 96 | * You should use the signal handling instead of polling possible changes ! |
97 | * zecke: Do you implement a signal for otodoaccess ? | 97 | * zecke: Do you implement a signal for otodoaccess ? |
98 | */ | 98 | */ |
99 | bool wasChangedExternally()const; | 99 | bool wasChangedExternally()const; |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * return a List of records | 102 | * return a List of records |
103 | * you can iterate over them | 103 | * you can iterate over them |
104 | */ | 104 | */ |
105 | virtual List allRecords()const; | 105 | virtual List allRecords()const; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * return a List of records | 108 | * return a List of records |
109 | * that match the regex | 109 | * that match the regex |
110 | */ | 110 | */ |
111 | virtual List matchRegexp( const QRegExp &r ) const; | 111 | virtual List matchRegexp( const QRegExp &r ) const; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * queryByExample. | 114 | * queryByExample. |
115 | * @see otodoaccess, ocontactaccess | 115 | * @see otodoaccess, ocontactaccess |
116 | */ | 116 | */ |
117 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); | 117 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * find the OPimRecord uid | 120 | * find the OPimRecord uid |
121 | */ | 121 | */ |
122 | T find( int uid )const; | 122 | T find( int uid )const; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * read ahead cache find method ;) | 125 | * read ahead cache find method ;) |
126 | */ | 126 | */ |
127 | T find( int uid, const QArray<int>&, | 127 | T find( int uid, const QArray<int>&, |
128 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; | 128 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; |
129 | 129 | ||
130 | 130 | ||
131 | /* invalidate cache here */ | 131 | /* invalidate cache here */ |
132 | /** | 132 | /** |
133 | * clears the backend and invalidates the backend | 133 | * clears the backend and invalidates the backend |
134 | */ | 134 | */ |
135 | void clear() ; | 135 | void clear() ; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * add T to the backend | 138 | * add T to the backend |
139 | * @param t The item to add. | 139 | * @param t The item to add. |
140 | * @return <i>true</i> if added successfully. | 140 | * @return <i>true</i> if added successfully. |
141 | */ | 141 | */ |
142 | virtual bool add( const T& t ) ; | 142 | virtual bool add( const T& t ) ; |
143 | 143 | ||
144 | bool add( const OPimRecord& ); | 144 | bool add( const OPimRecord& ); |
145 | /** | 145 | /** |
146 | * Add an Opie PimRecord. | 146 | * Add an Opie PimRecord. |
147 | * Info: Take this if you are working with OPimRecords and you need to add it into any database. | 147 | * Info: Take this if you are working with OPimRecords and you need to add it into any database. |
148 | * But take care that the accessing database is compatible to the real type of OPimRecord !! | 148 | * But take care that the accessing database is compatible to the real type of OPimRecord !! |
149 | * Otherwise this access will be rejected ! | 149 | * Otherwise this access will be rejected ! |
150 | */ | 150 | */ |
151 | bool add( const OPimRecord* ); | 151 | bool add( const OPimRecord* ); |
152 | 152 | ||
153 | 153 | ||
154 | /* only the uid matters */ | 154 | /* only the uid matters */ |
155 | /** | 155 | /** |
156 | * remove T from the backend | 156 | * remove T from the backend |
157 | * @param t The item to remove | 157 | * @param t The item to remove |
158 | * @return <i>true</i> if successful. | 158 | * @return <i>true</i> if successful. |
159 | */ | 159 | */ |
160 | virtual bool remove( const T& t ); | 160 | virtual bool remove( const T& t ); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * remove the OPimRecord with uid | 163 | * remove the OPimRecord with uid |
164 | * @param uid The ID of the item to remove | 164 | * @param uid The ID of the item to remove |
165 | * @return <i>true</i> if successful. | 165 | * @return <i>true</i> if successful. |
166 | */ | 166 | */ |
167 | bool remove( int uid ); | 167 | bool remove( int uid ); |
168 | bool remove( const OPimRecord& ); | 168 | bool remove( const OPimRecord& ); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * replace T from backend | 171 | * replace T from backend |
172 | * @param t The item to replace | 172 | * @param t The item to replace |
173 | * @return <i>true</i> if successful. | 173 | * @return <i>true</i> if successful. |
174 | */ | 174 | */ |
175 | virtual bool replace( const T& t) ; | 175 | virtual bool replace( const T& t) ; |
176 | 176 | ||
177 | void setReadAhead( uint count ); | 177 | void setReadAhead( uint count ); |
178 | /** | 178 | /** |
179 | * @internal | 179 | * @internal |
180 | */ | 180 | */ |
181 | virtual T cacheFind( int uid )const; | ||
182 | void cache( const T& )const; | 181 | void cache( const T& )const; |
183 | void setSaneCacheSize( int ); | 182 | void setSaneCacheSize( int ); |
184 | 183 | ||
185 | QArray<int> records()const; | 184 | QArray<int> records()const; |
186 | protected: | 185 | protected: |
187 | /** | 186 | /** |
188 | * invalidate the cache | 187 | * invalidate the cache |
189 | */ | 188 | */ |
190 | void invalidateCache(); | 189 | void invalidateCache(); |
191 | 190 | ||
192 | void setBackEnd( BackEnd* end ); | 191 | void setBackEnd( BackEnd* end ); |
193 | /** | 192 | /** |
194 | * returns the backend | 193 | * returns the backend |
195 | */ | 194 | */ |
196 | BackEnd* backEnd(); | 195 | BackEnd* backEnd(); |
197 | BackEnd* m_backEnd; | 196 | BackEnd* m_backEnd; |
198 | 197 | ||
199 | Cache m_cache; | 198 | Cache m_cache; |
200 | 199 | ||
201 | private: | 200 | private: |
202 | OPimAccessTemplatePrivate *d; | 201 | OPimAccessTemplatePrivate *d; |
203 | 202 | ||
204 | }; | 203 | }; |
205 | 204 | ||
206 | template <class T> | 205 | template <class T> |
207 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) | 206 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) |
208 | : OTemplateBase<T>(), m_backEnd( end ) | 207 | : OTemplateBase<T>(), m_backEnd( end ) |
209 | { | 208 | { |
210 | if (end ) | 209 | if (end ) |
211 | end->setFrontend( this ); | 210 | end->setFrontend( this ); |
212 | } | 211 | } |
213 | template <class T> | 212 | template <class T> |
214 | OPimAccessTemplate<T>::~OPimAccessTemplate() { | 213 | OPimAccessTemplate<T>::~OPimAccessTemplate() { |
215 | owarn << "~OPimAccessTemplate<T>" << oendl; | 214 | owarn << "~OPimAccessTemplate<T>" << oendl; |
216 | delete m_backEnd; | 215 | delete m_backEnd; |
217 | } | 216 | } |
218 | template <class T> | 217 | template <class T> |
219 | bool OPimAccessTemplate<T>::load() { | 218 | bool OPimAccessTemplate<T>::load() { |
220 | invalidateCache(); | 219 | invalidateCache(); |
221 | return m_backEnd->load(); | 220 | return m_backEnd->load(); |
222 | } | 221 | } |
223 | template <class T> | 222 | template <class T> |
224 | bool OPimAccessTemplate<T>::reload() { | 223 | bool OPimAccessTemplate<T>::reload() { |
225 | invalidateCache(); | 224 | invalidateCache(); |
226 | return m_backEnd->reload(); | 225 | return m_backEnd->reload(); |
227 | } | 226 | } |
228 | template <class T> | 227 | template <class T> |
229 | bool OPimAccessTemplate<T>::save() { | 228 | bool OPimAccessTemplate<T>::save() { |
230 | return m_backEnd->save(); | 229 | return m_backEnd->save(); |
231 | } | 230 | } |
232 | template <class T> | 231 | template <class T> |
233 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | 232 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { |
234 | QArray<int> ints = m_backEnd->allRecords(); | 233 | QArray<int> ints = m_backEnd->allRecords(); |
235 | List lis(ints, this ); | 234 | List lis(ints, this ); |
236 | return lis; | 235 | return lis; |
237 | } | 236 | } |
238 | template <class T> | 237 | template <class T> |
239 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { | 238 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { |
240 | QArray<int> ints = m_backEnd->matchRegexp( r ); | 239 | QArray<int> ints = m_backEnd->matchRegexp( r ); |
241 | List lis(ints, this ); | 240 | List lis(ints, this ); |
242 | return lis; | 241 | return lis; |
243 | } | 242 | } |
244 | template <class T> | 243 | template <class T> |
245 | QArray<int> OPimAccessTemplate<T>::records()const { | 244 | QArray<int> OPimAccessTemplate<T>::records()const { |
246 | return m_backEnd->allRecords(); | 245 | return m_backEnd->allRecords(); |
247 | } | 246 | } |
248 | template <class T> | 247 | template <class T> |
249 | typename OPimAccessTemplate<T>::List | 248 | typename OPimAccessTemplate<T>::List |
250 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { | 249 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { |
251 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); | 250 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); |
252 | 251 | ||
253 | List lis(ints, this ); | 252 | List lis(ints, this ); |
254 | return lis; | 253 | return lis; |
255 | } | 254 | } |
256 | template <class T> | 255 | template <class T> |
257 | T OPimAccessTemplate<T>::find( int uid ) const{ | 256 | T OPimAccessTemplate<T>::find( int uid ) const{ |
258 | // First search in cache.. | 257 | // First search in cache.. |
259 | if ( m_cache.contains( uid ) ) | 258 | if ( m_cache.contains( uid ) ) |
260 | return m_cache.find( uid ); | 259 | return m_cache.find( uid ); |
261 | 260 | ||
262 | T t = m_backEnd->find( uid ); | 261 | T t = m_backEnd->find( uid ); |
263 | cache( t ); | 262 | cache( t ); |
264 | 263 | ||
265 | return t; | 264 | return t; |
266 | } | 265 | } |
267 | 266 | ||
268 | template <class T> | 267 | template <class T> |
269 | T OPimAccessTemplate<T>::cacheFind( int uid ) const | ||
270 | { | ||
271 | return m_cache.find( uid ); | ||
272 | } | ||
273 | |||
274 | template <class T> | ||
275 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, | 268 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, |
276 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { | 269 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { |
277 | /* | 270 | /* |
278 | * better do T.isEmpty() | 271 | * better do T.isEmpty() |
279 | * after a find this way we would | 272 | * after a find this way we would |
280 | * avoid two finds in QCache... | 273 | * avoid two finds in QCache... |
281 | */ | 274 | */ |
282 | // owarn << "find it now " << uid << oendl; | 275 | // owarn << "find it now " << uid << oendl; |
283 | if ( m_cache.contains( uid ) ) { | 276 | if ( m_cache.contains( uid ) ) { |
284 | return m_cache.find( uid ); | 277 | return m_cache.find( uid ); |
285 | } | 278 | } |
286 | 279 | ||
287 | T t = m_backEnd->find( uid, ar, current, dir ); | 280 | T t = m_backEnd->find( uid, ar, current, dir ); |
288 | cache( t ); | 281 | cache( t ); |
289 | return t; | 282 | return t; |
290 | } | 283 | } |
291 | template <class T> | 284 | template <class T> |
292 | void OPimAccessTemplate<T>::clear() { | 285 | void OPimAccessTemplate<T>::clear() { |
293 | invalidateCache(); | 286 | invalidateCache(); |
294 | m_backEnd->clear(); | 287 | m_backEnd->clear(); |
295 | } | 288 | } |
296 | template <class T> | 289 | template <class T> |
297 | bool OPimAccessTemplate<T>::add( const T& t ) { | 290 | bool OPimAccessTemplate<T>::add( const T& t ) { |
298 | cache( t ); | 291 | cache( t ); |
299 | return m_backEnd->add( t ); | 292 | return m_backEnd->add( t ); |
300 | } | 293 | } |
301 | 294 | ||
302 | template <class T> | 295 | template <class T> |
303 | bool OPimAccessTemplate<T>::add( const OPimRecord& rec ) { | 296 | bool OPimAccessTemplate<T>::add( const OPimRecord& rec ) { |
304 | /* same type */ | 297 | /* same type */ |
305 | T tempInstance; | 298 | T tempInstance; |
306 | if ( rec.rtti() == tempInstance.rtti() ) { | 299 | if ( rec.rtti() == tempInstance.rtti() ) { |
307 | const T& t = static_cast<const T&>(rec); | 300 | const T& t = static_cast<const T&>(rec); |
308 | return add(t); | 301 | return add(t); |
309 | } else { | 302 | } else { |
310 | owarn << "Adding not possible: Objecttype mismatch" << oendl; | 303 | owarn << "Adding not possible: Objecttype mismatch" << oendl; |
311 | } | 304 | } |
312 | return false; | 305 | return false; |
313 | } | 306 | } |
314 | 307 | ||
315 | template <class T> | 308 | template <class T> |
316 | bool OPimAccessTemplate<T>::add( const OPimRecord* rec) { | 309 | bool OPimAccessTemplate<T>::add( const OPimRecord* rec) { |
317 | /* same type, but pointer */ | 310 | /* same type, but pointer */ |
318 | T tempInstance; | 311 | T tempInstance; |
319 | if ( rec -> rtti() == tempInstance.rtti() ) { | 312 | if ( rec -> rtti() == tempInstance.rtti() ) { |
320 | const T* t = static_cast<const T*>(rec); | 313 | const T* t = static_cast<const T*>(rec); |
321 | return add( *t ); | 314 | return add( *t ); |
322 | } else { | 315 | } else { |
323 | owarn << "Adding not possible: Objecttype mismatch" << oendl; | 316 | owarn << "Adding not possible: Objecttype mismatch" << oendl; |
324 | } | 317 | } |
325 | return false; | 318 | return false; |
326 | } | 319 | } |
327 | 320 | ||
328 | template <class T> | 321 | template <class T> |
329 | bool OPimAccessTemplate<T>::remove( const T& t ) { | 322 | bool OPimAccessTemplate<T>::remove( const T& t ) { |
330 | return remove( t.uid() ); | 323 | return remove( t.uid() ); |
331 | } | 324 | } |
332 | template <class T> | 325 | template <class T> |
333 | bool OPimAccessTemplate<T>::remove( int uid ) { | 326 | bool OPimAccessTemplate<T>::remove( int uid ) { |
334 | m_cache.remove( uid ); | 327 | m_cache.remove( uid ); |
335 | return m_backEnd->remove( uid ); | 328 | return m_backEnd->remove( uid ); |
336 | } | 329 | } |
337 | template <class T> | 330 | template <class T> |
338 | bool OPimAccessTemplate<T>::remove( const OPimRecord& rec) { | 331 | bool OPimAccessTemplate<T>::remove( const OPimRecord& rec) { |
339 | return remove( rec.uid() ); | 332 | return remove( rec.uid() ); |
340 | } | 333 | } |
341 | template <class T> | 334 | template <class T> |
342 | bool OPimAccessTemplate<T>::replace( const T& t ) { | 335 | bool OPimAccessTemplate<T>::replace( const T& t ) { |
343 | m_cache.replace( t ); | 336 | m_cache.replace( t ); |
344 | return m_backEnd->replace( t ); | 337 | return m_backEnd->replace( t ); |
345 | } | 338 | } |
346 | template <class T> | 339 | template <class T> |
347 | void OPimAccessTemplate<T>::invalidateCache() { | 340 | void OPimAccessTemplate<T>::invalidateCache() { |
348 | m_cache.invalidate(); | 341 | m_cache.invalidate(); |
349 | } | 342 | } |
350 | template <class T> | 343 | template <class T> |
351 | typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { | 344 | typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { |
352 | return m_backEnd; | 345 | return m_backEnd; |
353 | } | 346 | } |
354 | template <class T> | 347 | template <class T> |
355 | bool OPimAccessTemplate<T>::wasChangedExternally()const { | 348 | bool OPimAccessTemplate<T>::wasChangedExternally()const { |
356 | return false; | 349 | return false; |
357 | } | 350 | } |
358 | template <class T> | 351 | template <class T> |
359 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { | 352 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { |
360 | m_backEnd = end; | 353 | m_backEnd = end; |
361 | if (m_backEnd ) | 354 | if (m_backEnd ) |
362 | m_backEnd->setFrontend( this ); | 355 | m_backEnd->setFrontend( this ); |
363 | } | 356 | } |
364 | template <class T> | 357 | template <class T> |
365 | void OPimAccessTemplate<T>::cache( const T& t ) const{ | 358 | void OPimAccessTemplate<T>::cache( const T& t ) const{ |
366 | /* hacky we need to work around the const*/ | 359 | /* hacky we need to work around the const*/ |
367 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); | 360 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); |
368 | } | 361 | } |
369 | template <class T> | 362 | template <class T> |
370 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { | 363 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { |
diff --git a/libopie2/opiepim/core/opimcontactfields.h b/libopie2/opiepim/core/opimcontactfields.h index 3aa3894..2e42951 100644 --- a/libopie2/opiepim/core/opimcontactfields.h +++ b/libopie2/opiepim/core/opimcontactfields.h | |||
@@ -1,99 +1,99 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) Stefan Eielrs <eilers.stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
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 | #ifndef OCONTACTFIELDS_H | 30 | #ifndef OCONTACTFIELDS_H |
31 | #define OCONTACTFIELDS_H | 31 | #define OCONTACTFIELDS_H |
32 | 32 | ||
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | /* OPIE */ | 35 | /* OPIE */ |
36 | #include <opie2/opimcontact.h> | 36 | #include <opie2/opimcontact.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | #include <qmap.h> | 39 | #include <qmap.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | #define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" | 42 | #define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" |
43 | #define DEFAULT_FIELD_ORDER "__________" | 43 | #define DEFAULT_FIELD_ORDER "__________" |
44 | 44 | ||
45 | namespace Opie | 45 | namespace Opie |
46 | { | 46 | { |
47 | class OPimContactFields | 47 | class OPimContactFields |
48 | { | 48 | { |
49 | 49 | ||
50 | public: | 50 | public: |
51 | OPimContactFields(); | 51 | OPimContactFields(); |
52 | ~OPimContactFields(); | 52 | ~OPimContactFields(); |
53 | /** Set the index for combo boxes. | 53 | /** Set the index for combo boxes. |
54 | * Sets the <b>index</b> of combo <b>num</b>. | 54 | * Sets the <b>index</b> of combo <b>num</b>. |
55 | * @param num selects the number of the combo | 55 | * @param num selects the number of the combo |
56 | * @param index sets the index in the combo | 56 | * @param index sets the index in the combo |
57 | */ | 57 | */ |
58 | void setFieldOrder( int num, int index ); | 58 | void setFieldOrder( int num, int index ); |
59 | 59 | ||
60 | /** Get the index for combo boxes. | 60 | /** Get the index for combo boxes. |
61 | * Returns the index of combo <b>num</b> or defindex | 61 | * Returns the index of combo <b>num</b> or defindex |
62 | * if none was defined.. | 62 | * if none was defined.. |
63 | * @param num Selects the number of the combo | 63 | * @param num Selects the number of the combo |
64 | * @param defIndex will be returned if none was defined (either | 64 | * @param defIndex will be returned if none was defined (either |
65 | * globally in the config file, nor by the contact which was used | 65 | * globally in the config file, nor by the contact which was used |
66 | * by loadFromRecord() ) | 66 | * by loadFromRecord() ) |
67 | */ | 67 | */ |
68 | int getFieldOrder( int num, int defIndex ); | 68 | int getFieldOrder( int num, int defIndex ); |
69 | 69 | ||
70 | /** Store fieldorder to contact. */ | 70 | /** Store fieldorder to contact. */ |
71 | void saveToRecord( OPimContact& ); | 71 | void saveToRecord( OPimContact& ); |
72 | /** Get Fieldorder from contact. */ | 72 | /** Get Fieldorder from contact. */ |
73 | void loadFromRecord( const OPimContact& ); | 73 | void loadFromRecord( const OPimContact& ); |
74 | 74 | ||
75 | private: | 75 | private: |
76 | QString fieldOrder; | 76 | QString fieldOrder; |
77 | QString globalFieldOrder; | 77 | QString globalFieldOrder; |
78 | bool changedFieldOrder; | 78 | bool changedFieldOrder; |
79 | 79 | ||
80 | public: | 80 | public: |
81 | static QStringList personalfields( bool sorted = true, bool translated = false ); | 81 | static QStringList personalfields( bool sorted = true, bool translated = false ); |
82 | static QStringList phonefields( bool sorted = true, bool translated = false ); | 82 | static QStringList phonefields( bool sorted = true, bool translated = false ); |
83 | static QStringList detailsfields( bool sorted = true, bool translated = false ); | 83 | static QStringList detailsfields( bool sorted = true, bool translated = false ); |
84 | static QStringList fields( bool sorted = true, bool translated = false ); | 84 | static QStringList fields( bool sorted = true, bool translated = false ); |
85 | 85 | ||
86 | static QStringList trpersonalfields( bool sorted = true ); | 86 | static QStringList trpersonalfields( bool sorted = true ); |
87 | static QStringList untrpersonalfields( bool sorted = true ); | 87 | static QStringList untrpersonalfields( bool sorted = true ); |
88 | static QStringList trphonefields( bool sorted = true ); | 88 | static QStringList trphonefields( bool sorted = true ); |
89 | static QStringList untrphonefields( bool sorted = true ); | 89 | static QStringList untrphonefields( bool sorted = true ); |
90 | static QStringList trdetailsfields( bool sorted = true ); | 90 | static QStringList trdetailsfields( bool sorted = true ); |
91 | static QStringList untrdetailsfields( bool sorted = true ); | 91 | static QStringList untrdetailsfields( bool sorted = true ); |
92 | static QStringList trfields( bool sorted = true ); | 92 | static QStringList trfields( bool sorted = true ); |
93 | static QStringList untrfields( bool sorted = true ); | 93 | static QStringList untrfields( bool sorted = true ); |
94 | 94 | ||
95 | static QMap<int, QString> idToTrFields(); | 95 | static QMap<int, QString> idToTrFields(); |
96 | static QMap<QString, int> trFieldsToId(); | 96 | static QMap<QString, int> trFieldsToId(); |
97 | static QMap<int, QString> idToUntrFields(); | 97 | static QMap<int, QString> idToUntrFields(); |
98 | static QMap<QString, int> untrFieldsToId(); | 98 | static QMap<QString, int> untrFieldsToId(); |
99 | 99 | ||
diff --git a/libopie2/opiepim/core/opimtemplatebase.h b/libopie2/opiepim/core/opimtemplatebase.h index ec9a94e..787486c 100644 --- a/libopie2/opiepim/core/opimtemplatebase.h +++ b/libopie2/opiepim/core/opimtemplatebase.h | |||
@@ -1,136 +1,130 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Holger Freyther <zecke@handhelds.org> | 3 | Copyright (C) Holger Freyther <zecke@handhelds.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
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 | #ifndef OTEMPLATEBASE_H | 29 | #ifndef OTEMPLATEBASE_H |
30 | #define OTEMPLATEBASE_H | 30 | #define OTEMPLATEBASE_H |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimrecord.h> | 33 | #include <opie2/opimrecord.h> |
34 | #include <opie2/opimcache.h> | 34 | #include <opie2/opimcache.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qarray.h> | 37 | #include <qarray.h> |
38 | 38 | ||
39 | namespace Opie { | 39 | namespace Opie { |
40 | /** | 40 | /** |
41 | * Templates do not have a base class, This is why | 41 | * Templates do not have a base class, This is why |
42 | * we've this class | 42 | * we've this class |
43 | * this is here to give us the possibility | 43 | * this is here to give us the possibility |
44 | * to have a common base class | 44 | * to have a common base class |
45 | * You may not want to use that interface internaly | 45 | * You may not want to use that interface internaly |
46 | * POOR mans interface | 46 | * POOR mans interface |
47 | */ | 47 | */ |
48 | class OPimBasePrivate; | 48 | class OPimBasePrivate; |
49 | struct OPimBase { | 49 | struct OPimBase { |
50 | /** | 50 | /** |
51 | * return the rtti | 51 | * return the rtti |
52 | */ | 52 | */ |
53 | virtual int rtti() const = 0; | 53 | virtual int rtti() const = 0; |
54 | virtual OPimRecord* record()const = 0; | 54 | virtual OPimRecord* record()const = 0; |
55 | virtual OPimRecord* record(int uid)const = 0; | 55 | virtual OPimRecord* record(int uid)const = 0; |
56 | virtual bool add( const OPimRecord& ) = 0; | 56 | virtual bool add( const OPimRecord& ) = 0; |
57 | virtual bool add( const OPimRecord* ) = 0; | 57 | virtual bool add( const OPimRecord* ) = 0; |
58 | virtual bool remove( int uid ) = 0; | 58 | virtual bool remove( int uid ) = 0; |
59 | virtual bool remove( const OPimRecord& ) = 0; | 59 | virtual bool remove( const OPimRecord& ) = 0; |
60 | virtual void clear() = 0; | 60 | virtual void clear() = 0; |
61 | virtual bool load() = 0; | 61 | virtual bool load() = 0; |
62 | virtual bool save() = 0; | 62 | virtual bool save() = 0; |
63 | virtual QArray<int> records()const = 0; | 63 | virtual QArray<int> records()const = 0; |
64 | /* | 64 | /* |
65 | * ADD editing here? | 65 | * ADD editing here? |
66 | * -zecke | 66 | * -zecke |
67 | */ | 67 | */ |
68 | private: | 68 | private: |
69 | OPimBasePrivate* d; | 69 | OPimBasePrivate* d; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | /** | 72 | /** |
73 | * internal template base | 73 | * internal template base |
74 | * Attention: T needs to implement the copy c'tor!!! | 74 | * Attention: T needs to implement the copy c'tor!!! |
75 | */ | 75 | */ |
76 | class OTemplateBasePrivate; | 76 | class OTemplateBasePrivate; |
77 | template <class T = OPimRecord> | 77 | template <class T = OPimRecord> |
78 | class OTemplateBase : public OPimBase { | 78 | class OTemplateBase : public OPimBase { |
79 | public: | 79 | public: |
80 | /** Look ahead direction of cache */ | 80 | /** Look ahead direction of cache */ |
81 | enum CacheDirection { Forward=0, Reverse }; | 81 | enum CacheDirection { Forward=0, Reverse }; |
82 | 82 | ||
83 | OTemplateBase() { | 83 | OTemplateBase() { |
84 | }; | 84 | }; |
85 | virtual ~OTemplateBase() { | 85 | virtual ~OTemplateBase() { |
86 | } | 86 | } |
87 | virtual T find( int uid )const = 0; | 87 | virtual T find( int uid )const = 0; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * read ahead find | 90 | * read ahead find |
91 | */ | 91 | */ |
92 | virtual T find( int uid, const QArray<int>& items, | 92 | virtual T find( int uid, const QArray<int>& items, |
93 | uint current, CacheDirection dir = Forward )const = 0; | 93 | uint current, CacheDirection dir = Forward )const = 0; |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Find in Cache.. | ||
97 | * Returns empty object if nothing found. | ||
98 | */ | ||
99 | virtual T cacheFind( int uid )const = 0; | ||
100 | |||
101 | /** | ||
102 | * Put element into Cache | 96 | * Put element into Cache |
103 | */ | 97 | */ |
104 | virtual void cache( const T& )const = 0; | 98 | virtual void cache( const T& )const = 0; |
105 | virtual void setSaneCacheSize( int ) = 0; | 99 | virtual void setSaneCacheSize( int ) = 0; |
106 | 100 | ||
107 | OPimRecord* record()const; | 101 | OPimRecord* record()const; |
108 | OPimRecord* record(int uid )const; | 102 | OPimRecord* record(int uid )const; |
109 | static T* rec(); | 103 | static T* rec(); |
110 | 104 | ||
111 | 105 | ||
112 | private: | 106 | private: |
113 | OTemplateBasePrivate *d; | 107 | OTemplateBasePrivate *d; |
114 | }; | 108 | }; |
115 | 109 | ||
116 | 110 | ||
117 | template <class T> | 111 | template <class T> |
118 | OPimRecord* OTemplateBase<T>::record()const { | 112 | OPimRecord* OTemplateBase<T>::record()const { |
119 | T* t = new T; | 113 | T* t = new T; |
120 | return t; | 114 | return t; |
121 | } | 115 | } |
122 | template <class T> | 116 | template <class T> |
123 | OPimRecord* OTemplateBase<T>::record(int uid )const { | 117 | OPimRecord* OTemplateBase<T>::record(int uid )const { |
124 | T t2 = find(uid ); | 118 | T t2 = find(uid ); |
125 | T* t1 = new T(t2); | 119 | T* t1 = new T(t2); |
126 | 120 | ||
127 | return t1; | 121 | return t1; |
128 | }; | 122 | }; |
129 | template <class T> | 123 | template <class T> |
130 | T* OTemplateBase<T>::rec() { | 124 | T* OTemplateBase<T>::rec() { |
131 | return new T; | 125 | return new T; |
132 | } | 126 | } |
133 | 127 | ||
134 | } | 128 | } |
135 | 129 | ||
136 | #endif | 130 | #endif |