diff options
4 files changed, 13 insertions, 3 deletions
diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp index 01f27f1..93c08f0 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp @@ -3,6 +3,9 @@ #include "fileUtils.h" #include "xmlUtils.h" #include "dbUtils.h" +#include <sql/maintenance/categoryInsert.sql.h> +#include <sql/maintenance/categoryUpdate.sql.h> +#include <sql/maintenance/categoryDelete.sql.h> namespace U = Gentoo::Utils; using namespace Gentoo::Utils::File; @@ -14,7 +17,7 @@ namespace Gentoo { void CategoryMetaProcessor::created(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const { - upsert(dbc->modify("INSERT INTO gentoobrowse.categories(summary, name) VALUES(?, ?)"), fn, path); + upsert(dbc->modify(sql::maintenance::categoryInsert::sql), fn, path); } void @@ -32,13 +35,13 @@ namespace Gentoo { void CategoryMetaProcessor::modified(DB::Connection * dbc, const boost::filesystem::path & fn, const boost::filesystem::path & path) const { - upsert(dbc->modify("UPDATE gentoobrowse.categories SET summary = ? WHERE name = ?)"), fn, path); + upsert(dbc->modify(sql::maintenance::categoryUpdate::sql), fn, path); } void CategoryMetaProcessor::deleted(DB::Connection * dbc, const boost::filesystem::path & fn) const { - auto m = dbc->modify("DELETE FROM gentoobrowse.categories WHERE name = ?"); + auto m = dbc->modify(sql::maintenance::categoryDelete::sql); m->bindParamS(0, (fn / 1).string()); m->execute(); } diff --git a/gentoobrowse-api/service/sql/maintenance/categoryDelete.sql b/gentoobrowse-api/service/sql/maintenance/categoryDelete.sql new file mode 100644 index 0000000..ad961c8 --- /dev/null +++ b/gentoobrowse-api/service/sql/maintenance/categoryDelete.sql @@ -0,0 +1,2 @@ +DELETE FROM gentoobrowse.categories +WHERE name = ? diff --git a/gentoobrowse-api/service/sql/maintenance/categoryInsert.sql b/gentoobrowse-api/service/sql/maintenance/categoryInsert.sql new file mode 100644 index 0000000..8c3f685 --- /dev/null +++ b/gentoobrowse-api/service/sql/maintenance/categoryInsert.sql @@ -0,0 +1,2 @@ +INSERT INTO gentoobrowse.categories(summary, name) +VALUES(?, ?) diff --git a/gentoobrowse-api/service/sql/maintenance/categoryUpdate.sql b/gentoobrowse-api/service/sql/maintenance/categoryUpdate.sql new file mode 100644 index 0000000..1b0ef38 --- /dev/null +++ b/gentoobrowse-api/service/sql/maintenance/categoryUpdate.sql @@ -0,0 +1,3 @@ +UPDATE gentoobrowse.categories SET + summary = ? +WHERE name = ? |