changeset 1810:b8558b613abd

show_sql_query
author Adam Chlipala <adam@chlipala.net>
date Wed, 22 Aug 2012 08:46:32 -0400
parents b8fa7441e637
children 9913c81bdbef
files lib/ur/basis.urs src/monoize.sml tests/showSql.ur tests/showSql.urp
diffstat 4 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/basis.urs	Sat Aug 18 13:57:48 2012 -0400
+++ b/lib/ur/basis.urs	Wed Aug 22 08:46:32 2012 -0400
@@ -641,6 +641,9 @@
                   -> state
                   -> transaction state
 
+val show_sql_query : freeTables ::: {{Type}} -> freeAggs ::: {{Type}} -> tables ::: {{Type}} -> exps ::: {Type}
+                     -> show (sql_query freeTables freeAggs tables exps)
+
 
 (*** Database mutators *)
 
--- a/src/monoize.sml	Sat Aug 18 13:57:48 2012 -0400
+++ b/src/monoize.sml	Wed Aug 22 08:46:32 2012 -0400
@@ -1257,6 +1257,12 @@
             in
                 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm)
             end
+          | L.ECApp ((L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "show_sql_query"), _), _), _), _), _), _), _), _) =>
+            let
+                val s = (L'.TFfi ("Basis", "string"), loc)
+            in
+                ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm)
+            end
           | L.ECApp ((L.EFfi ("Basis", "mkShow"), _), t) =>
             let
                 val t = monoType env t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/showSql.ur	Wed Aug 22 08:46:32 2012 -0400
@@ -0,0 +1,5 @@
+table t : { A : int }
+
+fun main () : transaction page = return <xml><body>
+  {[(SELECT t.A FROM t ORDER BY t.A DESC) : sql_query [] [] _ _]}
+</body></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/showSql.urp	Wed Aug 22 08:46:32 2012 -0400
@@ -0,0 +1,3 @@
+database dbname=test
+
+showSql