From dbbc19b77dcf6ea828aabd64d7aa8cab9635aaf5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Apr 2017 20:53:00 +0300 Subject: Implement build task, result and log requests handling --- mod/mod-package-search.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'mod/mod-package-search.cxx') diff --git a/mod/mod-package-search.cxx b/mod/mod-package-search.cxx index 02b10d6..4988d42 100644 --- a/mod/mod-package-search.cxx +++ b/mod/mod-package-search.cxx @@ -44,14 +44,14 @@ init (scanner& s) options_ = make_shared ( s, unknown_mode::fail, unknown_mode::fail); - database_module::init (*options_); + database_module::init (*options_, options_->package_db_retry ()); if (options_->root ().empty ()) options_->root (dir_path ("/")); - // Check that the database schema matches the current one. It's enough to - // perform the check in just a single module implementation (and we don't - // do in the dispatcher because it doesn't use the database). + // Check that the database 'package' schema matches the current one. It's + // enough to perform the check in just a single module implementation (and we + // don't do in the dispatcher because it doesn't use the database). // // Note that the failure can be reported by each web server worker process. // While it could be tempting to move the check to the @@ -59,8 +59,10 @@ init (scanner& s) // be called by a different process (usually the web server root one) not // having the proper permissions to access the database. // - if (schema_catalog::current_version (*db_) != db_->schema_version ()) - fail << "database schema differs from the current one (module " + const string ds ("package"); + if (schema_catalog::current_version (*package_db_, ds) != + package_db_->schema_version (ds)) + fail << "database 'package' schema differs from the current one (module " << BREP_VERSION_STR << ")"; } @@ -133,10 +135,10 @@ handle (request& rq, response& rs) << DIV(ID="content"); session sn; - transaction t (db_->begin ()); + transaction t (package_db_->begin ()); auto pkg_count ( - db_->query_value ( + package_db_->query_value ( search_param (squery))); s << FORM_SEARCH (squery) @@ -146,13 +148,13 @@ handle (request& rq, response& rs) // s << DIV; for (const auto& pr: - db_->query ( + package_db_->query ( search_param (squery) + "ORDER BY rank DESC, name" + "OFFSET" + to_string (page * res_page) + "LIMIT" + to_string (res_page))) { - shared_ptr p (db_->load (pr.id)); + shared_ptr p (package_db_->load (pr.id)); s << TABLE(CLASS="proplist package") << TBODY -- cgit v1.1