summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml51
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