summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/odatebookaccessbackend_sql.cpp11
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/libopie/pim/odatebookaccessbackend_sql.cpp b/libopie/pim/odatebookaccessbackend_sql.cpp
index e893b38..756f405 100644
--- a/libopie/pim/odatebookaccessbackend_sql.cpp
+++ b/libopie/pim/odatebookaccessbackend_sql.cpp
@@ -11,12 +11,15 @@
* =====================================================================
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.3 2003/12/22 11:41:39 eilers
+ * Fixing stupid bug, found by sourcode review..
+ *
* Revision 1.2 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
@@ -203,12 +206,13 @@ OEvent ODateBookAccessBackend_SQL::find( int uid ) const{
// Last step: Put map into date event and return it
OEvent retDate( dateEventMap );
return retDate;
}
+// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::add( const OEvent& ev )
{
QMap<int,QString> eventMap = ev.toMap();
QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() );
QMap<int, QString>::Iterator it;
@@ -242,15 +246,19 @@ bool ODateBookAccessBackend_SQL::add( const OEvent& ev )
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
+ // Update list of uid's
+ update();
+
return true;
}
+// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::remove( int uid )
{
QString qu = "DELETE from datebook where uid = "
+ QString::number( uid ) + ";";
qu += "DELETE from custom_data where uid = "
+ QString::number( uid ) + ";";
@@ -258,12 +266,15 @@ bool ODateBookAccessBackend_SQL::remove( int uid )
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
+ // Update list of uid's
+ update();
+
return true;
}
bool ODateBookAccessBackend_SQL::replace( const OEvent& ev )
{
remove( ev.uid() );
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index e893b38..756f405 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -11,12 +11,15 @@
* =====================================================================
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.3 2003/12/22 11:41:39 eilers
+ * Fixing stupid bug, found by sourcode review..
+ *
* Revision 1.2 2003/12/22 10:19:26 eilers
* Finishing implementation of sql-backend for datebook. But I have to
* port the PIM datebook application to use it, before I could debug the
* whole stuff.
* Thus, PIM-Database backend is finished, but highly experimental. And some
* parts are still generic. For instance, the "queryByExample()" methods are
@@ -203,12 +206,13 @@ OEvent ODateBookAccessBackend_SQL::find( int uid ) const{
// Last step: Put map into date event and return it
OEvent retDate( dateEventMap );
return retDate;
}
+// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::add( const OEvent& ev )
{
QMap<int,QString> eventMap = ev.toMap();
QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() );
QMap<int, QString>::Iterator it;
@@ -242,15 +246,19 @@ bool ODateBookAccessBackend_SQL::add( const OEvent& ev )
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
+ // Update list of uid's
+ update();
+
return true;
}
+// FIXME: Speed up update of uid's..
bool ODateBookAccessBackend_SQL::remove( int uid )
{
QString qu = "DELETE from datebook where uid = "
+ QString::number( uid ) + ";";
qu += "DELETE from custom_data where uid = "
+ QString::number( uid ) + ";";
@@ -258,12 +266,15 @@ bool ODateBookAccessBackend_SQL::remove( int uid )
OSQLRawQuery raw( qu );
OSQLResult res = m_driver->query( &raw );
if ( res.state() != OSQLResult::Success ){
return false;
}
+ // Update list of uid's
+ update();
+
return true;
}
bool ODateBookAccessBackend_SQL::replace( const OEvent& ev )
{
remove( ev.uid() );