flush left over data in database
authorKevron Rees <tripzero.kev@gmail.com>
Sat, 4 May 2013 06:48:04 +0000 (23:48 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Sat, 4 May 2013 06:48:04 +0000 (23:48 -0700)
plugins/database/databasesink.cpp

index 833ced6..67f06a3 100644 (file)
@@ -58,6 +58,16 @@ void * cbFunc(gpointer data)
                delete obj;
        }
 
+       /// final flush of whatever is still in the queue:
+
+       shared->db->exec("BEGIN IMMEDIATE TRANSACTION");
+       for(int i=0; i< insertList.size(); i++)
+       {
+               DictionaryList<string> d = insertList[i];
+               shared->db->insert(d);
+       }
+       shared->db->exec("END TRANSACTION");
+
        return NULL;
 }