# HG changeset patch # User Tom Fredrik Blenning Klaussen # Date 1347015970 -7200 # Node ID 2b83559b78db7ad6744e67ba68a9940dc08897de # Parent 769f43c4c5d02b879474ec4e98fabf70c0237b76 BUGFIX: batch inserts inserted empty values. BUGFIX: cutoff limit was not observed at cutoff, but cutoff + 1 diff -r 769f43c4c5d0 -r 2b83559b78db DBCache.hpp --- a/DBCache.hpp Fri Sep 07 11:46:46 2012 +0200 +++ b/DBCache.hpp Fri Sep 07 13:06:10 2012 +0200 @@ -18,7 +18,6 @@ #include "Exception/SQLException.hpp" #include "Exception/IOException.hpp" - template struct SQLGenerator { @@ -154,9 +153,9 @@ query.bindValue(valueString(prefix), value); } - static void bindValues(QSqlQuery& query, const QVariantList& value, const QString& prefix = QString()) + static void bindValues(QSqlQuery& query, const QVariantList& values, const QString& prefix = QString()) { - query.bindValue(valueString(prefix), value); + query.bindValue(valueString(prefix), values); } static void bindValues(QSqlQuery& query, const QList& values, const QString& prefix = QString()) @@ -289,7 +288,7 @@ values << *memoryMap.value(key); } SQLGenerator::bindValues(insertQuery, values, "value"); - if (!insertQuery.exec()) { + if (!insertQuery.execBatch()) { throw SQLException(insertQuery); } insertQuery.finish(); @@ -337,7 +336,7 @@ if (memoryMapped) { memoryMap.insert(key, value); unsyncedKeys.append(key); - if (unsyncedKeys.size() > 1024) { + if (unsyncedKeys.size() >= 1024) { syncInsert(); } }