comparison 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
comparison
equal deleted inserted replaced
877:dae141d911d9 878:a8952047e1d3
214 ((EDml {dml = dml, prepared = SOME (#2 sns, s)}, loc), 214 ((EDml {dml = dml, prepared = SOME (#2 sns, s)}, loc),
215 ((s, n) :: #1 sns, #2 sns + 1)) 215 ((s, n) :: #1 sns, #2 sns + 1))
216 end) 216 end)
217 217
218 | ENextval {seq, ...} => 218 | ENextval {seq, ...} =>
219 let 219 if #supportsNextval (Settings.currentDbms ()) then
220 val s = case seq of 220 let
221 (EPrim (Prim.String s), loc) => 221 val s = case seq of
222 (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) 222 (EPrim (Prim.String s), loc) =>
223 | _ => 223 (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc)
224 let 224 | _ =>
225 val s' = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc) 225 let
226 in 226 val s' = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc)
227 (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s']), loc) 227 in
228 end 228 (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s']), loc)
229 in 229 end
230 case prepString (s, [], 0) of 230 in
231 NONE => (e, sns) 231 case prepString (s, [], 0) of
232 | SOME (ss, n) => 232 NONE => (e, sns)
233 let 233 | SOME (ss, n) =>
234 val s = String.concat (rev ss) 234 let
235 in 235 val s = String.concat (rev ss)
236 ((ENextval {seq = seq, prepared = SOME (#2 sns, s)}, loc), 236 in
237 ((s, n) :: #1 sns, #2 sns + 1)) 237 ((ENextval {seq = seq, prepared = SOME (#2 sns, s)}, loc),
238 end 238 ((s, n) :: #1 sns, #2 sns + 1))
239 end 239 end
240 end
241 else
242 (e, sns)
240 243
241 | EUnurlify (e, t) => 244 | EUnurlify (e, t) =>
242 let 245 let
243 val (e, sns) = prepExp (e, sns) 246 val (e, sns) = prepExp (e, sns)
244 in 247 in