diff options
Diffstat (limited to 'odb/pragma.cxx')
-rw-r--r-- | odb/pragma.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/odb/pragma.cxx b/odb/pragma.cxx index 698551a..e2dc4cc 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -493,6 +493,17 @@ check_spec_decl_type (tree d, return false; } } + else if (p == "session") + { + // Session can be used only for namespaces and objects. + // + if (tc != NAMESPACE_DECL && !CLASS_TYPE_P (d)) + { + error (l) << "name '" << name << "' in db pragma " << p << " does " + << "not refer to a namespace or class" << endl; + return false; + } + } else if (p == "schema") { // For now schema can be used only for namespaces and objects. @@ -727,6 +738,42 @@ handle_pragma (cpp_reader* reader, tt = pragma_lex (&t); } + else if (p == "session") + { + // session + // session (true|false) + // + + // Make sure we've got the correct declaration type. + // + if (decl != 0 && !check_spec_decl_type (decl, decl_name, p, loc)) + return; + + tt = pragma_lex (&t); + + if (tt == CPP_OPEN_PAREN) + { + tt = pragma_lex (&t); + + string s; + if (tt != CPP_NAME || + ((s = IDENTIFIER_POINTER (t)) != "true" && s != "false")) + { + error () << "true or false expected in db pragma " << p << endl; + return; + } + + tt = pragma_lex (&t); + if (tt != CPP_CLOSE_PAREN) + { + error () << "')' expected at the end of db pragma " << p << endl; + return; + } + + val = (s == "true"); + tt = pragma_lex (&t); + } + } else if (p == "schema") { // schema (<name>) |