diff options
author | 2008-10-26 08:41:17 -0400 | |
---|---|---|
committer | 2008-10-26 08:41:17 -0400 | |
commit | 87b4008ca82e6779c48f9be777c0f54ea4c4cca4 (patch) | |
tree | 063e92eebe8bb8761687451b45c15d9101af60b3 /src/cjr_print.sml | |
parent | 30a571eeca8ad8c61cc0182ec550d66af179aa37 (diff) |
Avoid using libpq when unneeded
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 15 |
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 [] |