changeset 222:36fef91a6bbf

Integer and float constants in SQL
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 17:50:10 -0400
parents 79819a6346e2
children bbe5899a9585
files src/lacweb.grm tests/where.lac
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lacweb.grm	Sat Aug 16 17:46:26 2008 -0400
+++ b/src/lacweb.grm	Sat Aug 16 17:50:10 2008 -0400
@@ -684,6 +684,13 @@
                                                      EVar (["Basis"], "sql_bool"),
                                                      s (FALSEleft, FALSEright)))
 
+       | INT                            (sql_inject (EPrim (Prim.Int INT),
+                                                     EVar (["Basis"], "sql_int"),
+                                                     s (INTleft, INTright)))
+       | FLOAT                          (sql_inject (EPrim (Prim.Float FLOAT),
+                                                     EVar (["Basis"], "sql_float"),
+                                                     s (FLOATleft, FLOATright)))
+
        | tident DOT fident              (let
                                              val loc = s (tidentleft, fidentright)
                                              val e = (EVar (["Basis"], "sql_field"), loc)
--- a/tests/where.lac	Sat Aug 16 17:46:26 2008 -0400
+++ b/tests/where.lac	Sat Aug 16 17:50:10 2008 -0400
@@ -8,4 +8,4 @@
 val q5 = (SELECT * FROM t1 WHERE {1} = {1})
 val q6 = (SELECT * FROM t1 WHERE {"Hi"} < {"Bye"})
 val q7 = (SELECT * FROM t1 WHERE {1} <> {1} AND NOT ({"Hi"} >= {"Bye"}))
-val q8 = (SELECT * FROM t1 WHERE t1.A = {1})
+val q8 = (SELECT * FROM t1 WHERE t1.A = 1 OR t1.C < 3.0)