diff lib/ur/basis.urs @ 748:5f9b9972e6b8

Switch to using sql_from_items
author Adam Chlipala <adamc@hcoop.net>
date Tue, 28 Apr 2009 09:45:17 -0400
parents 2c7244c066f1
children 16bfd9e244cd
line wrap: on
line diff
--- a/lib/ur/basis.urs	Sun Apr 26 12:47:53 2009 -0400
+++ b/lib/ur/basis.urs	Tue Apr 28 09:45:17 2009 -0400
@@ -220,18 +220,28 @@
                                      (map (fn fields :: ({Type} * {Type}) => fields.1) keep_drop)
 val sql_subset_all : tables :: {{Type}} -> sql_subset tables tables
 
-val sql_query1 : tables ::: {({Type} * {{Unit}})}
+con sql_from_items :: {{Type}} -> Type
+
+val sql_from_table : cols ::: {Type} -> keys ::: {{Unit}}
+                     -> name :: Name -> sql_table cols keys
+                     -> sql_from_items [name = cols]
+val sql_from_comma : tabs1 ::: {{Type}} -> tabs2 ::: {{Type}}
+                     -> [tabs1 ~ tabs2]
+    => sql_from_items tabs1 -> sql_from_items tabs2
+       -> sql_from_items (tabs1 ++ tabs2)
+
+val sql_query1 : tables ::: {{Type}}
                  -> grouped ::: {{Type}}
                  -> selectedFields ::: {{Type}}
                  -> selectedExps ::: {Type}
-                 -> {From : $(map (fn p :: ({Type} * {{Unit}}) => sql_table p.1 p.2) tables),
-                     Where : sql_exp (map (fn p :: ({Type} * {{Unit}}) => p.1) tables) [] [] bool,
-                     GroupBy : sql_subset (map (fn p :: ({Type} * {{Unit}}) => p.1) tables) grouped,
-                     Having : sql_exp grouped (map (fn p :: ({Type} * {{Unit}}) => p.1) tables) [] bool,
+                 -> {From : sql_from_items tables,
+                     Where : sql_exp tables [] [] bool,
+                     GroupBy : sql_subset tables grouped,
+                     Having : sql_exp grouped tables [] bool,
                      SelectFields : sql_subset grouped selectedFields,
-                     SelectExps : $(map (sql_exp grouped (map (fn p :: ({Type} * {{Unit}}) => p.1) tables) [])
+                     SelectExps : $(map (sql_exp grouped tables [])
                                             selectedExps) }
-                 -> sql_query1 (map (fn p :: ({Type} * {{Unit}}) => p.1) tables) selectedFields selectedExps
+                 -> sql_query1 tables selectedFields selectedExps
 
 type sql_relop 
 val sql_union : sql_relop