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.sml15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 7c13fcb5..b1eb04b3 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -1186,10 +1186,6 @@ fun p_exp' par env (e, loc) =
p_exp env initial,
string ";",
newline,
- case prepared of
- NONE => box [string "printf(\"Executing: %s\\n\", query);",
- newline]
- | _ => box [],
string "PGresult *res = ",
case prepared of
NONE => string "PQexecParams(conn, query, 0, NULL, NULL, NULL, NULL, 0);"
@@ -1371,8 +1367,15 @@ fun p_exp' par env (e, loc) =
| ENextval {seq, prepared} =>
let
- val query = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc)
- val query = (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), query]), loc)
+ 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 "({",