diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-13 18:25:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-06-13 18:27:21 +0200 |
commit | 0efbd383bf4b9d6c1a884ff0249412567b329fce (patch) | |
tree | 3750dab9a638aedea8fb6e592a2009a21fd07ef8 /odb/relational/processor.cxx | |
parent | 9c822ec823fb8a11745f09b5e45e43b405432ae0 (diff) |
Add support for native views that call stored procedures
Diffstat (limited to 'odb/relational/processor.cxx')
-rw-r--r-- | odb/relational/processor.cxx | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index 5ac97f5..0c27971 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -1234,22 +1234,35 @@ namespace relational if (!vq.literal.empty ()) { string q (upcase (vq.literal)); - vq.kind = (q.compare (0, 7, "SELECT ") == 0) - ? view_query::complete - : view_query::condition; + + if (q.compare (0, 7, "SELECT ") == 0) + vq.kind = view_query::complete_select; + else if (q.compare (0, 5, "EXEC ") == 0 || + q.compare (0, 5, "CALL ") == 0 || + q.compare (0, 8, "EXECUTE ") == 0) + vq.kind = view_query::complete_execute; + else + vq.kind = view_query::condition; } else if (!vq.expr.empty ()) { // If the first token in the expression is a string and - // it starts with "SELECT " or is equal to "SELECT", then - // we have a complete query. + // it starts with "SELECT " or is equal to "SELECT" or + // one of the stored procedure call keywords, then we + // have a complete query. // if (vq.expr.front ().type == CPP_STRING) { string q (upcase (vq.expr.front ().literal)); - vq.kind = (q.compare (0, 7, "SELECT ") == 0 || q == "SELECT") - ? view_query::complete - : view_query::condition; + + if (q.compare (0, 7, "SELECT ") == 0 || q == "SELECT") + vq.kind = view_query::complete_select; + else if (q.compare (0, 5, "EXEC ") == 0 || q == "EXEC" || + q.compare (0, 5, "CALL ") == 0 || q == "CALL" || + q.compare (0, 8, "EXECUTE ") == 0 || q == "EXECUTE") + vq.kind = view_query::complete_execute; + else + vq.kind = view_query::condition; } else vq.kind = view_query::condition; |