summaryrefslogtreecommitdiff
path: root/src/prepare.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-09-14 11:02:18 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-09-14 11:02:18 -0400
commitc81c24b4feb3fae3c13861f1bcaafab697a6bb7e (patch)
tree4f168489261d0202a9d664e548dd71a10665df46 /src/prepare.sml
parent0faed8b64498534297bd797108b659802815aefc (diff)
SQL sequences
Diffstat (limited to 'src/prepare.sml')
-rw-r--r--src/prepare.sml13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/prepare.sml b/src/prepare.sml
index 20a09c9b..3c5aa2aa 100644
--- a/src/prepare.sml
+++ b/src/prepare.sml
@@ -163,6 +163,18 @@ fun prepExp (e as (_, loc), sns) =
((EDml {dml = dml, prepared = SOME (#2 sns)}, loc),
((String.concat (rev ss), n) :: #1 sns, #2 sns + 1)))
+ | ENextval {seq, ...} =>
+ let
+ val s = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc)
+ val s = (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s]), loc)
+ in
+ case prepString (s, [], 0) of
+ NONE => (e, sns)
+ | SOME (ss, n) =>
+ ((ENextval {seq = seq, prepared = SOME (#2 sns)}, loc),
+ ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1))
+ end
+
fun prepDecl (d as (_, loc), sns) =
case #1 d of
DStruct _ => (d, sns)
@@ -193,6 +205,7 @@ fun prepDecl (d as (_, loc), sns) =
end
| DTable _ => (d, sns)
+ | DSequence _ => (d, sns)
| DDatabase _ => (d, sns)
| DPreparedStatements _ => (d, sns)