comparison src/cjr_print.sml @ 323:5030e909fbf3

Region memory allocation for query parameters
author Adam Chlipala <adamc@hcoop.net>
date Thu, 11 Sep 2008 12:40:40 -0400
parents aa89b73d83e4
children b91480c9a729
comparison
equal deleted inserted replaced
322:aa89b73d83e4 323:5030e909fbf3
710 map (fn (x', t) => ("__uwf_" ^ ident x ^ ".__uwf_" ^ ident x', t)) xts) 710 map (fn (x', t) => ("__uwf_" ^ ident x ^ ".__uwf_" ^ ident x', t)) xts)
711 tables 711 tables
712 712
713 val outputs = exps @ tables 713 val outputs = exps @ tables
714 in 714 in
715 box [string "({", 715 box [string "(uw_begin_region(ctx), ({",
716 newline, 716 newline,
717 string "PGconn *conn = uw_get_db(ctx);", 717 string "PGconn *conn = uw_get_db(ctx);",
718 newline, 718 newline,
719 case prepared of 719 case prepared of
720 NONE => box [string "char *query = ", 720 NONE => box [string "char *query = ",
789 newline], 789 newline],
790 string "}", 790 string "}",
791 newline, 791 newline,
792 newline, 792 newline,
793 793
794 string "uw_end_region(ctx);",
795 newline,
794 string "n = PQntuples(res);", 796 string "n = PQntuples(res);",
795 newline, 797 newline,
796 string "for (i = 0; i < n; ++i) {", 798 string "for (i = 0; i < n; ++i) {",
797 newline, 799 newline,
798 box [string "struct", 800 box [string "struct",
849 newline, 851 newline,
850 string "PQclear(res);", 852 string "PQclear(res);",
851 newline, 853 newline,
852 string "acc;", 854 string "acc;",
853 newline, 855 newline,
854 string "})"] 856 string "}))"]
855 end 857 end
856 858
857 | EDml {dml, prepared} => 859 | EDml {dml, prepared} =>
858 box [string "({", 860 box [string "({",
859 newline, 861 newline,