Mercurial > urweb
diff src/prepare.sml @ 878:a8952047e1d3
Sequence code compiles in MySQL
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Jul 2009 16:29:13 -0400 |
parents | 3c7b48040dcf |
children | b2a175a0f2ef |
line wrap: on
line diff
--- a/src/prepare.sml Thu Jul 16 13:59:30 2009 -0400 +++ b/src/prepare.sml Thu Jul 16 16:29:13 2009 -0400 @@ -216,27 +216,30 @@ end) | ENextval {seq, ...} => - let - val s = case seq of - (EPrim (Prim.String s), loc) => - (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) - | _ => - let - val s' = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc) - in - (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s']), loc) - end - in - case prepString (s, [], 0) of - NONE => (e, sns) - | SOME (ss, n) => - let - val s = String.concat (rev ss) - in - ((ENextval {seq = seq, prepared = SOME (#2 sns, s)}, loc), - ((s, n) :: #1 sns, #2 sns + 1)) - end - end + if #supportsNextval (Settings.currentDbms ()) then + let + val s = case seq of + (EPrim (Prim.String s), loc) => + (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) + | _ => + let + val s' = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc) + in + (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s']), loc) + end + in + case prepString (s, [], 0) of + NONE => (e, sns) + | SOME (ss, n) => + let + val s = String.concat (rev ss) + in + ((ENextval {seq = seq, prepared = SOME (#2 sns, s)}, loc), + ((s, n) :: #1 sns, #2 sns + 1)) + end + end + else + (e, sns) | EUnurlify (e, t) => let