summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenanceimpl.cpp10
-rw-r--r--gentoobrowse-api/service/sql/maintenance/fileList.sql (renamed from gentoobrowse-api/service/sql/maintenance/createTempFileListView.sql)4
2 files changed, 7 insertions, 7 deletions
diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp
index d6b13a2..aec1cba 100644
--- a/gentoobrowse-api/service/maintenanceimpl.cpp
+++ b/gentoobrowse-api/service/maintenanceimpl.cpp
@@ -5,7 +5,7 @@
#include <buffer.h>
#include <boost/filesystem/operations.hpp>
#include <sql/maintenance/createTempFileListTable.sql.h>
-#include <sql/maintenance/createTempFileListView.sql.h>
+#include <sql/maintenance/fileList.sql.h>
#include "maintenance/categoryMetaProcessor.h"
#include "maintenance/packageManifestProcessor.h"
#include "maintenance/packageMetaProcessor.h"
@@ -118,26 +118,24 @@ namespace Gentoo {
i->execute();
}
}
- dbc->execute(sql::maintenance::createTempFileListView::sql);
}
void
Maintenance::processChanges(DB::Connection * dbc, const boost::filesystem::path & tmp)
{
+ DB::StaticSqlWriter src(sql::maintenance::fileList::sql);
DB::TablePatch tp;
- tp.src = "tmp";
+ tp.srcExpr = &src;
tp.dest = "gentoobrowse.files";
tp.pk = {"repoid", "filename"};
tp.cols = {"repoid", "filename", "filetypeid", "pathparts", "filesize", "moddate"};
tp.beforeDelete = boost::bind(&Maintenance::fileDeleted, this, dbc, tmp, _1);
tp.beforeUpdate = boost::bind(&Maintenance::fileChanged, this, dbc, tmp, _1);
tp.beforeInsert = boost::bind(&Maintenance::fileCreated, this, dbc, tmp, _1);
- DB::StaticSqlWriter obpo(
- "(SELECT processOrder FROM gentoobrowse.filetypes ft WHERE ft.filetypeid = b.filetypeid) NULLS LAST");
+ DB::StaticSqlWriter obpo("processOrder NULLS LAST");
tp.order = &obpo;
dbc->patchTable(&tp);
boost::filesystem::remove_all(tmp);
- dbc->execute("DROP VIEW tmp");
dbc->execute("DROP TABLE filelist");
}
diff --git a/gentoobrowse-api/service/sql/maintenance/createTempFileListView.sql b/gentoobrowse-api/service/sql/maintenance/fileList.sql
index f40473e..dd1c9da 100644
--- a/gentoobrowse-api/service/sql/maintenance/createTempFileListView.sql
+++ b/gentoobrowse-api/service/sql/maintenance/fileList.sql
@@ -1,11 +1,13 @@
-CREATE TEMPORARY VIEW tmp AS
+(
SELECT
r.repoid,
fl.filename,
ft.filetypeid,
+ ft.processOrder,
(STRING_TO_ARRAY(fl.filename, '/'))[2:100] pathparts,
fl.filesize,
fl.filemtime moddate
FROM filelist fl, gentoobrowse.repos r, gentoobrowse.filetypes ft
WHERE (STRING_TO_ARRAY(fl.filename, '/'))[1] = r.name
AND (STRING_TO_ARRAY(fl.filename, '/'))[2:100] ~ ft.spec
+)