aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-10-27 18:57:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-10-27 18:57:27 +0200
commit60223c1696a3b307cf3c566f031528faa2e2ab6e (patch)
tree1bdc024e6dca0625773f4a5cca789f04c8cb12db
parentfef201c447dab4850fe36499ad058e83a350cb76 (diff)
Recognize /*CALL*/ hint in SELECT statements that call stored procedures
-rw-r--r--odb/relational/processor.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx
index cf0a776..508a5ee 100644
--- a/odb/relational/processor.cxx
+++ b/odb/relational/processor.cxx
@@ -1187,6 +1187,15 @@ namespace relational
q.compare (0, 5, "CALL ") == 0 ||
q.compare (0, 8, "EXECUTE ") == 0)
vq.kind = view_query::complete_execute;
+ //
+ // Hint for databases that use SELECT for stored procedure
+ // calls (e.g., PostgreSQL).
+ //
+ else if (q.compare (0, 8, "/*CALL*/") == 0)
+ {
+ vq.literal = string (vq.literal, q[8] == ' ' ? 9 : 8);
+ vq.kind = view_query::complete_execute;
+ }
else
vq.kind = view_query::condition;
}
@@ -1207,6 +1216,12 @@ namespace relational
q.compare (0, 5, "CALL ") == 0 || q == "CALL" ||
q.compare (0, 8, "EXECUTE ") == 0 || q == "EXECUTE")
vq.kind = view_query::complete_execute;
+ else if (q.compare (0, 8, "/*CALL*/") == 0)
+ {
+ vq.expr.front ().literal =
+ string (vq.expr.front ().literal, q[8] == ' ' ? 9 : 8);
+ vq.kind = view_query::complete_execute;
+ }
else
vq.kind = view_query::condition;
}