changeset 114:d4e337567960

Add some debug statements and fix a bug in SQL execution.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Tue, 03 May 2016 02:26:39 +0200
parents 27e628852401
children 404795616b1e
files SqliteDBLink.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/SqliteDBLink.cpp	Tue May 03 02:23:14 2016 +0200
+++ b/SqliteDBLink.cpp	Tue May 03 02:26:39 2016 +0200
@@ -318,6 +318,7 @@
   bool infoQuery;
   switch (operation) {
   case Add:
+    qDebug() << "Add";
     query = preparedTryAddQuery;
     infoQuery = true;
     break;
@@ -333,12 +334,17 @@
     assert(paths.size() == 0);
     return;
   }
-  query->bindValue("path", paths);
+  if (operation != Update)
+    query->bindValue("path", paths);
   if (infoQuery) {
     query->bindValue("size", sizes);
     query->bindValue("mtime", mtimes);
     query->bindValue("checksum", checksums);
   }
+  //Because QT for some reason expect the parameters to be given in sequence
+  if (operation == Update)
+    query->bindValue("path", paths);
+
 
   if (!query->execBatch())
     throw SQLException(*query);
@@ -376,11 +382,16 @@
 
   while (operation) {
     if (operation->type() != last) {
+      qDebug() << "Execute Operation first" << typeString(last);
+      foreach(QVariant path, paths) {
+	qDebug() << path.toString();
+      }
       if (!preparedBeginQuery->exec())
 	throw SQLException(*preparedBeginQuery);
       executeOperation(paths, sizes, mtimes, hashes, last);
       if (!preparedEndQuery->exec())
 	throw SQLException(*preparedEndQuery);
+      qDebug() << "Execute Operation Done";
     }
 
     switch (operation->type()) {