comparison src/postgres.sml @ 1650:1bfd793e7eb8

Add dynamic content before running its scripts, to get IDs in scope; fix generation of Postgres queries with blobs
author Adam Chlipala <adam@chlipala.net>
date Thu, 29 Dec 2011 16:08:34 -0500
parents 8128fcb2d4a4
children 3e7c7e200713
comparison
equal deleted inserted replaced
1649:9253765d7724 1650:1bfd793e7eb8
678 p_list_sep (box [string ",", space]) 678 p_list_sep (box [string ",", space])
679 (fn t => if isBlob t then string "1" else string "0") inputs, 679 (fn t => if isBlob t then string "1" else string "0") inputs,
680 string " };", 680 string " };",
681 newline, 681 newline,
682 if List.exists isBlob inputs then 682 if List.exists isBlob inputs then
683 box [string "const int *paramLengths = uw_malloc(ctx, ", 683 box [string "int *paramLengths = uw_malloc(ctx, ",
684 string (Int.toString (length inputs)), 684 string (Int.toString (length inputs)),
685 string " * sizeof(int));", 685 string " * sizeof(int));",
686 newline, 686 newline,
687 p_list_sepi (box []) 687 p_list_sepi (box [])
688 (fn i => fn t => 688 (fn i => fn t =>
694 | Nullable Blob => string ("arg" ^ Int.toString (i + 1) 694 | Nullable Blob => string ("arg" ^ Int.toString (i + 1)
695 ^ "?arg" ^ Int.toString (i + 1) ^ "->size:0") 695 ^ "?arg" ^ Int.toString (i + 1) ^ "->size:0")
696 | _ => string "0", 696 | _ => string "0",
697 string ";", 697 string ";",
698 newline]) inputs, 698 newline]) inputs,
699 string " };",
700 newline] 699 newline]
701 else 700 else
702 box [string "const int *paramLengths = paramFormats;", 701 box [string "const int *paramLengths = paramFormats;",
703 newline], 702 newline],
704 703