diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-09-05 14:00:57 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-09-05 14:00:57 -0400 |
commit | ee175ea1f9151123e47d9cbfee0c6329b2e5d934 (patch) | |
tree | b1f65d2c756f6867bc59eb1a0bb424deefacfabe /src/cjr_print.sml | |
parent | 1d30544730c4785eef4aabc4a224c03fe1b26983 (diff) |
tryDml
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 412531a6..7331196f 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -1791,8 +1791,11 @@ fun p_exp' par env (e, loc) = box []] end - | EDml {dml, prepared} => - box [string "(uw_begin_region(ctx), ({", + | EDml {dml, prepared, mode} => + box [case mode of + Settings.Error => box [] + | Settings.None => string "({const char *uw_errmsg = NULL;", + string "(uw_begin_region(ctx), ({", newline, case prepared of NONE => box [string "char *dml = ", @@ -1800,7 +1803,7 @@ fun p_exp' par env (e, loc) = string ";", newline, newline, - #dml (Settings.currentDbms ()) loc] + #dml (Settings.currentDbms ()) (loc, mode)] | SOME {id, dml = dml'} => let val inputs = getPargs dml @@ -1823,16 +1826,23 @@ fun p_exp' par env (e, loc) = #dmlPrepared (Settings.currentDbms ()) {loc = loc, id = id, dml = dml', - inputs = map #2 inputs}] + inputs = map #2 inputs, + mode = mode}] end, newline, newline, - string "uw_end_region(ctx);", newline, - string "uw_unit_v;", + + case mode of + Settings.Error => string "uw_unit_v;" + | Settings.None => string "uw_errmsg ? uw_strdup(ctx, uw_errmsg) : NULL;", + newline, - string "}))"] + string "}))", + case mode of + Settings.Error => box [] + | Settings.None => string ";})"] | ENextval {seq, prepared} => box [string "({", |