diff options
author | 2008-09-07 12:58:33 -0400 | |
---|---|---|
committer | 2008-09-07 12:58:33 -0400 | |
commit | 4a627a550cb54c18cb16cc0ad852e6a0bbc59c31 (patch) | |
tree | c14ae0c932a86fb435119bbbf0267b64ccf0e9e3 | |
parent | 09b9ebf63c7a41dc40a702832b9d103e85dcf297 (diff) |
Reading bools from SQL
-rw-r--r-- | src/c/urweb.c | 4 | ||||
-rw-r--r-- | tests/pquery.ur | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index 632dbf1e..ad625cf6 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -808,9 +808,9 @@ lw_Basis_float lw_Basis_stringToFloat_error(lw_context ctx, lw_Basis_string s) { } lw_Basis_bool lw_Basis_stringToBool_error(lw_context ctx, lw_Basis_string s) { - if (!strcasecmp (s, "True")) + if (!strcasecmp(s, "T") || !strcasecmp (s, "True")) return lw_Basis_True; - else if (!strcasecmp (s, "False")) + else if (!strcasecmp(s, "F") || !strcasecmp (s, "False")) return lw_Basis_False; else lw_error(ctx, FATAL, "Can't parse bool: %s", s); diff --git a/tests/pquery.ur b/tests/pquery.ur index 1086aaee..ea53f7c9 100644 --- a/tests/pquery.ur +++ b/tests/pquery.ur @@ -1,13 +1,14 @@ -table t1 : {A : int, B : string, C : float} +table t1 : {A : int, B : string, C : float, D : bool} fun lookup (inp : {B : string}) = s <- query (SELECT * FROM t1 WHERE t1.B = {inp.B}) (fn fs _ => return fs.T1) - {A = 0, B = "Couldn't find it!", C = 0.0}; + {A = 0, B = "Couldn't find it!", C = 0.0, D = False}; return <html><body> A: {cdata (show _ s.A)}<br/> B: {cdata (show _ s.B)}<br/> C: {cdata (show _ s.C)}<br/> + D: {cdata (show _ s.D)}<br/> </body></html> fun main () : transaction page = return <html><body> |