aboutsummaryrefslogtreecommitdiff
path: root/migrate/migrate.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-06-30 02:53:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-03 23:56:29 +0300
commit17d44ec2c41a5b485cecae51a07396f85a601248 (patch)
tree5b8f74f8176059c9ab8cbbc770e4b9ee75872f41 /migrate/migrate.cxx
parentc2a0ae3e226d1cedceb2a7814c8adfbbfbd7afe1 (diff)
Fix builds page to correctly display unbuilt package count
Diffstat (limited to 'migrate/migrate.cxx')
-rw-r--r--migrate/migrate.cxx39
1 files changed, 27 insertions, 12 deletions
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 25b84d0..0fde937 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -93,21 +93,23 @@ schema (const char* s, string name)
{
string statement (op);
- auto read_until = [&i, &statement](const char stop[2]) -> bool
+ auto read_until = [&i, &statement] (const char stop[2]) -> bool
+ {
+ for (char prev ('\0'), c; i.get (c); prev = c)
{
- for (char prev ('\0'), c; i.get (c); prev = c)
- {
- statement.push_back (c);
+ statement.push_back (c);
- if (stop[0] == prev && stop[1] == c)
- return true;
- }
+ if (stop[0] == prev && stop[1] == c)
+ return true;
+ }
- return false;
- };
+ return false;
+ };
if (strcasecmp (op.c_str (), "CREATE") == 0)
{
+ bool valid (true);
+
string kw;
i >> kw;
statement += " " + kw;
@@ -125,7 +127,18 @@ schema (const char* s, string name)
{
// Fall through.
}
+ else if (strcasecmp (kw.c_str (), "FOREIGN") == 0)
+ {
+ i >> kw;
+ statement += " " + kw;
+ valid = strcasecmp (kw.c_str (), "TABLE") == 0;
+
+ // Fall through.
+ }
else
+ valid = false;
+
+ if (!valid)
{
cerr << "error: unexpected CREATE statement" << endl;
throw failed ();
@@ -321,9 +334,11 @@ try
#include <libbrep/package-extra.hxx>
, '\0'};
- schema s (db_schema == "package"
- ? package_extras
- : "",
+ static const char build_extras[] = {
+#include <libbrep/build-extra.hxx>
+ , '\0'};
+
+ schema s (db_schema == "package" ? package_extras : build_extras,
db_schema);
if (create)