From f5781cd6ee0976154ce459c3824b5f50021de4a2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Apr 2016 17:36:46 +0100 Subject: Add package herd support, even though none appear to have it at the moment. --- .../service/maintenance/packageMetaProcessor.cpp | 12 ++++++++---- .../service/sql/maintenance/packageMetaUpdate.sql | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp index 1f99ce2..17af6a3 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp @@ -27,8 +27,11 @@ namespace Gentoo { md.getXPathValue("/pkgmetadata/longdescription[@lang='en']/text()"), md.getXPathValue("/pkgmetadata/longdescription[1]/text()") }); - m->bindParamS(1, (fn / 1).string()); - m->bindParamS(2, (fn / 2).string()); + U::Database::bindOptionalsS(m, 1, { + md.getXPathValue("/pkgmetadata/herd/text()") + }); + m->bindParamS(2, (fn / 1).string()); + m->bindParamS(3, (fn / 2).string()); m->execute(); } @@ -43,8 +46,9 @@ namespace Gentoo { { auto m = dbc->modify(sql::maintenance::packageMetaUpdate::sql); m->bindNull(0); - m->bindParamS(1, (fn / 1).string()); - m->bindParamS(2, (fn / 2).string()); + m->bindNull(1); + m->bindParamS(2, (fn / 1).string()); + m->bindParamS(3, (fn / 2).string()); m->execute(); } } diff --git a/gentoobrowse-api/service/sql/maintenance/packageMetaUpdate.sql b/gentoobrowse-api/service/sql/maintenance/packageMetaUpdate.sql index ec83634..c065d3f 100644 --- a/gentoobrowse-api/service/sql/maintenance/packageMetaUpdate.sql +++ b/gentoobrowse-api/service/sql/maintenance/packageMetaUpdate.sql @@ -1,5 +1,6 @@ -UPDATE gentoobrowse.packages p - SET summary = gentoobrowse.textclean(?) +UPDATE gentoobrowse.packages p SET + summary = gentoobrowse.textclean(?), + herd = ? FROM gentoobrowse.categories c WHERE p.categoryid = c.categoryid AND c.name = ? -- cgit v1.2.3