diff options
author | 2009-07-16 16:29:13 -0400 | |
---|---|---|
committer | 2009-07-16 16:29:13 -0400 | |
commit | 4289cd07dd2467dfbad297cf21ad7cfaedc08f2b (patch) | |
tree | e84e8e1578e80ec83ada5acef409f93e11fabb03 /src/cjr_print.sml | |
parent | 7e10920b75383cd953898468385ae29e76bf184d (diff) |
Sequence code compiles in MySQL
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 835faad5..375cc4b8 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -1737,41 +1737,26 @@ fun p_exp' par env (e, loc) = string "}))"] | ENextval {seq, prepared} => - let - val query = case seq of - (EPrim (Prim.String s), loc) => - (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) - | _ => - let - val query = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc) - in - (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), query]), loc) - end - in - box [string "(uw_begin_region(ctx), ", - string "({", - newline, - string "uw_Basis_int n;", - newline, - - case prepared of - NONE => box [string "char *query = ", - p_exp env query, - string ";", - newline, - newline, + box [string "({", + newline, + string "uw_Basis_int n;", + newline, - #nextval (Settings.currentDbms ()) loc] - | SOME (id, query) => #nextvalPrepared (Settings.currentDbms ()) {loc = loc, - id = id, - query = query}, - newline, - newline, + case prepared of + NONE => #nextval (Settings.currentDbms ()) {loc = loc, + seqE = p_exp env seq, + seqName = case #1 seq of + EPrim (Prim.String s) => SOME s + | _ => NONE} + | SOME (id, query) => #nextvalPrepared (Settings.currentDbms ()) {loc = loc, + id = id, + query = query}, + newline, + newline, - string "n;", - newline, - string "}))"] - end + string "n;", + newline, + string "})"] | EUnurlify (e, t) => let |