On Thursday 24 January 2013, Kevin Krammer wrote:
> > if i make the else branch to always execute (ie never using the cache)
> > it's still broken.
> > but, if i disable also QueryCache::insert( statement, mQuery );
> > so never inserting anything in the cache, all starts to work normally
> > again. ie even just saving those prepared queries somewhere makes it
> > fail.
> 
> I don't know enough about the database stuff but it seems we'll have to
> deactivate prepared queries when sqlite is being used (assuming it works
> with PostgreSQL).

attached patch partially fixes the issue, does it look correct?
still have to try on the device but the agents seem to work correctly after 
the first akonadi startup (the first time it runs it still have the symptoms)

-- 
Marco Martin
diff --git a/server/src/storage/querycache.cpp b/server/src/storage/querycache.cpp
index 860aba0..5b683d5 100644
--- a/server/src/storage/querycache.cpp
+++ b/server/src/storage/querycache.cpp
@@ -18,6 +18,8 @@
  */
 
 #include "querycache.h"
+#include "dbtype.h"
+#include "datastore.h"
 
 #include <QSqlQuery>
 #include <QThreadStorage>
@@ -36,7 +38,11 @@ static QHash<QString, QSqlQuery>* cache()
 
 bool QueryCache::contains(const QString& queryStatement)
 {
-  return cache()->contains( queryStatement );
+  if ( DbType::type( DataStore::self()->database() ) == DbType::Sqlite ) {
+    return false;
+  } else {
+    return cache()->contains( queryStatement );
+  }
 }
 
 QSqlQuery QueryCache::query(const QString& queryStatement)
@@ -46,5 +52,7 @@ QSqlQuery QueryCache::query(const QString& queryStatement)
 
 void QueryCache::insert(const QString& queryStatement, const QSqlQuery& query)
 {
-  cache()->insert( queryStatement, query );
+  if ( DbType::type( DataStore::self()->database() ) != DbType::Sqlite ) {
+    cache()->insert( queryStatement, query );
+  }
 }
_______________________________________________
Active mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/active

Reply via email to