diff src/cjr_print.sml @ 486:8e055bbbd28b

Remove some allocation
author Adam Chlipala <adamc@hcoop.net>
date Sun, 09 Nov 2008 18:19:47 -0500
parents c9566d49ecfe
children 0fd65c50e0e2
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Nov 09 17:27:34 2008 -0500
+++ b/src/cjr_print.sml	Sun Nov 09 18:19:47 2008 -0500
@@ -1186,10 +1186,6 @@
                  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 @@
 
       | 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 "({",