diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-08-14 09:37:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-25 06:47:21 +0200 |
commit | 55b36b8297ef9aac9e4ccc7b98f8649534ee0ac1 (patch) | |
tree | e9f0d22285d7fc9ad814b75eac9d587c6d630995 /odb/pragma.cxx | |
parent | 19ba3497c0788f02fc417f441d87c96ce23f9446 (diff) |
Implement bulk database operation support for Oracle and SQL Server
Diffstat (limited to 'odb/pragma.cxx')
-rw-r--r-- | odb/pragma.cxx | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/odb/pragma.cxx b/odb/pragma.cxx index f40258f..4d0acae 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -378,7 +378,7 @@ check_spec_decl_type (declaration const& d, if (tc != RECORD_TYPE) { error (l) << "name '" << name << "' in db pragma " << p << " does " - << "not refer to a data member or class" << endl; + << "not refer to a class" << endl; return false; } } @@ -458,7 +458,8 @@ check_spec_decl_type (declaration const& d, p == "optimistic" || p == "polymorphic" || p == "definition" || - p == "sectionable") + p == "sectionable" || + p == "bulk") { if (tc != RECORD_TYPE) { @@ -1479,6 +1480,48 @@ handle_pragma (cxx_lexer& l, tt = l.next (tl, &tn); } + else if (p == "bulk") + { + // bulk (batch-size) + // + + // Make sure we've got the correct declaration type. + // + if (decl && !check_spec_decl_type (decl, decl_name, p, loc)) + return; + + if (l.next (tl, &tn) != CPP_OPEN_PAREN) + { + error (l) << "'(' expected after db pragma " << p << endl; + return; + } + + // base + // + if (l.next (tl, &tn) != CPP_NUMBER || TREE_CODE (tn) != INTEGER_CST) + { + error (l) << "unsigned integer expected as batch size" << endl; + return; + } + + unsigned long long b (integer (tn)); + + if (b == 0 || b == 1) + { + error (l) << "batch size has to be greater than 1" << endl; + return; + } + + val = b; + + if (l.next (tl, &tn) != CPP_CLOSE_PAREN) + { + error (l) << "')' expected at the end of db pragma " << p << endl; + return; + } + + tt = l.next (tl, &tn); + } else if (p == "query") { // query () |