From c0931400a1c5f02cf145c90fd7e34216836efd88 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 Sep 2012 14:28:03 +0200 Subject: Implement --output-name, --generate-schema-only, and --at-once options --- odb/validator.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'odb/validator.cxx') diff --git a/odb/validator.cxx b/odb/validator.cxx index 225a2a1..aba82a5 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -573,7 +573,7 @@ namespace // Update features set based on this object. // - if (class_file (c) == unit.file ()) + if (options.at_once () || class_file (c) == unit.file ()) { if (poly_root != 0) features.polymorphic_object = true; @@ -706,7 +706,7 @@ namespace // Update features set based on this view. // - if (class_file (c) == unit.file ()) + if (options.at_once () || class_file (c) == unit.file ()) { features.view = true; } @@ -1251,6 +1251,21 @@ validate (options const& ops, unsigned short pass) { bool valid (true); + + // Validate options. + // + if (ops.generate_schema_only () && + (ops.schema_format ().size () != 1 || + *ops.schema_format ().begin () != schema_format::sql)) + { + cerr << "error: --generate-schema-only is only valid when generating " << + "schema as a standalone SQL file" << endl; + valid = false; + } + + if (!valid) + throw failed (); + auto_ptr ctx (create_context (cerr, u, ops, f, 0)); if (pass == 1) -- cgit v1.1