summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp67
1 files changed, 33 insertions, 34 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 756f405..e79696c 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -1,64 +1,61 @@
1/* 1/*
2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
29/*
2 * SQL Backend for the OPIE-Calender Database. 30 * SQL Backend for the OPIE-Calender Database.
3 * 31 *
4 * Copyright (c) 2003 by Stefan Eilers (Eilers.Stefan@epost.de)
5 *
6 * =====================================================================
7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * =====================================================================
12 * =====================================================================
13 * Version: $Id$
14 * =====================================================================
15 * History:
16 * $Log$
17 * Revision 1.3 2003/12/22 11:41:39 eilers
18 * Fixing stupid bug, found by sourcode review..
19 *
20 * Revision 1.2 2003/12/22 10:19:26 eilers
21 * Finishing implementation of sql-backend for datebook. But I have to
22 * port the PIM datebook application to use it, before I could debug the
23 * whole stuff.
24 * Thus, PIM-Database backend is finished, but highly experimental. And some
25 * parts are still generic. For instance, the "queryByExample()" methods are
26 * not (or not fully) implemented. Todo: custom-entries not stored.
27 * The big show stopper: matchRegExp() (needed by OpieSearch) needs regular
28 * expression search in the database, which is not supported by sqlite !
29 * Therefore we need either an extended sqlite or a workaround which would
30 * be very slow and memory consuming..
31 *
32 * Revision 1.1 2003/12/08 15:18:12 eilers
33 * Committing unfinished sql implementation before merging to libopie2 starts..
34 *
35 *
36 */ 32 */
37 33
38#include <stdio.h> 34#include <stdio.h>
39#include <stdlib.h> 35#include <stdlib.h>
40 36
41#include <qarray.h> 37#include <qarray.h>
42#include <qstringlist.h> 38#include <qstringlist.h>
43 39
44#include <qpe/global.h> 40#include <qpe/global.h>
45 41
46#include <opie2/osqldriver.h> 42#include <opie2/osqldriver.h>
47#include <opie2/osqlmanager.h> 43#include <opie2/osqlmanager.h>
48#include <opie2/osqlquery.h> 44#include <opie2/osqlquery.h>
49 45
50#include "orecur.h" 46#include <opie2/orecur.h>
51#include "odatebookaccessbackend_sql.h" 47#include <opie2/odatebookaccessbackend_sql.h>
52 48
49namespace Opie {
53 50
54 51
55ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , 52ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
56 const QString& fileName ) 53 const QString& fileName )
57 : ODateBookAccessBackend(), m_driver( NULL ) 54 : ODateBookAccessBackend(), m_driver( NULL )
58{ 55{
59 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; 56 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
60 57
61 // Get the standart sql-driver from the OSQLManager.. 58 // Get the standart sql-driver from the OSQLManager..
62 OSQLManager man; 59 OSQLManager man;
63 m_driver = man.standard(); 60 m_driver = man.standard();
64 m_driver->setUrl( m_fileName ); 61 m_driver->setUrl( m_fileName );
@@ -356,12 +353,14 @@ QArray<int> ODateBookAccessBackend_SQL::extractUids( OSQLResult& res ) const
356 qWarning(" count = %d", list.count() ); 353 qWarning(" count = %d", list.count() );
357 354
358 int i = 0; 355 int i = 0;
359 for (it = list.begin(); it != list.end(); ++it ) { 356 for (it = list.begin(); it != list.end(); ++it ) {
360 ints[i] = (*it).data("uid").toInt(); 357 ints[i] = (*it).data("uid").toInt();
361 i++; 358 i++;
362 } 359 }
363 qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); 360 qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() );
364 361
365 return ints; 362 return ints;
366 363
367} 364}
365
366}