summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-26 08:41:17 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-26 08:41:17 -0400
commit5badaf182a69fc7d67f9ae2e5a0a8e5bf7edea36 (patch)
tree063e92eebe8bb8761687451b45c15d9101af60b3 /src/cjr_print.sml
parent978e1439b5b985f1483f7eb1edfc954e3f2bf1c2 (diff)
Avoid using libpq when unneeded
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 26f6149e..e26293ab 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -1341,6 +1341,7 @@ fun p_decl env (dAll as (d, _) : decl) =
string "}",
newline]
+ | DPreparedStatements [] => box []
| DPreparedStatements ss =>
box [string "static void uw_db_prepare(uw_context ctx) {",
newline,
@@ -2182,6 +2183,8 @@ fun p_file env (ds, ps) =
end) sequences,
string "}"]
+
+ val hasDb = List.exists (fn (DDatabase _, _) => true | _ => false) ds
in
box [string "#include <stdio.h>",
newline,
@@ -2191,8 +2194,11 @@ fun p_file env (ds, ps) =
newline,
string "#include <math.h>",
newline,
- string "#include <postgresql/libpq-fe.h>",
- newline,
+ if hasDb then
+ box [string "#include <postgresql/libpq-fe.h>",
+ newline]
+ else
+ box [],
newline,
string "#include \"",
string (OS.Path.joinDirFile {dir = Config.includ,
@@ -2222,7 +2228,10 @@ fun p_file env (ds, ps) =
string "}",
newline,
newline,
- validate,
+ if hasDb then
+ validate
+ else
+ box [],
newline,
if List.exists (fn (DDatabase _, _) => true | _ => false) ds then
box []