summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-04-10 16:39:15 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-04-10 16:39:15 +0100
commit19df271ffe25d4d5a85a23ade84e24698cee2caf (patch)
tree490a664c37a35402434bdca6bfa71218db89223b
parentFix assertions and validate row count in SQL require equal (diff)
downloadgentoobrowse-api-19df271ffe25d4d5a85a23ade84e24698cee2caf.tar.bz2
gentoobrowse-api-19df271ffe25d4d5a85a23ade84e24698cee2caf.tar.xz
gentoobrowse-api-19df271ffe25d4d5a85a23ade84e24698cee2caf.zip
Ensure target category of move exists
-rw-r--r--gentoobrowse-api/service/maintenance/updatesProcessor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
index 25cebe0..5765c17 100644
--- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp
@@ -8,6 +8,7 @@
#include <glibmm/regex.h>
#include <fstream>
#include <boost/bind.hpp>
+#include <sql/maintenance/categoryInsert.sql.h>
#include <sql/maintenance/updatesPackageDirFiles.sql.h>
#include <sql/maintenance/updatesMD5CacheFiles.sql.h>
#include <sql/maintenance/updatesMovePackages.sql.h>
@@ -34,6 +35,7 @@ namespace Gentoo {
public:
UpdatesPatch(DB::Connection * db, bool v) :
vcsMode(v),
+ categoryInsert(sql::maintenance::categoryInsert.modify(db)),
movePackageDirFiles(sql::maintenance::updatesPackageDirFiles.modify(db)),
moveMD5CacheFiles(sql::maintenance::updatesMD5CacheFiles.modify(db)),
findPackage(sql::portage::findPackage.select(db)),
@@ -66,6 +68,7 @@ namespace Gentoo {
const bool vcsMode;
DB::ModifyCommandPtr drop;
+ DB::ModifyCommandPtr categoryInsert;
DB::ModifyCommandPtr movePackageDirFiles;
DB::ModifyCommandPtr moveMD5CacheFiles;
DB::SelectCommandPtr findPackage;
@@ -101,6 +104,9 @@ namespace Gentoo {
moveMD5CacheFiles->bindParamS(3, catfrom);
moveMD5CacheFiles->bindParamS(4, namefrom);
moveMD5CacheFiles->execute();
+ categoryInsert->bindParamS(0, catto);
+ categoryInsert->bindParamS(1, catto);
+ categoryInsert->execute();
movePackages->bindParamS(0, nameto);
movePackages->bindParamS(1, namefrom);
movePackages->bindParamS(2, catfrom);