diff lib/ur/basis.urs @ 1072:9001966ae1c8

Weakening-type coercions for SQL values
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Dec 2009 13:00:55 -0500
parents 26197c957ad6
children b2311dfb3158
line wrap: on
line diff
--- a/lib/ur/basis.urs	Sun Dec 13 11:28:47 2009 -0500
+++ b/lib/ur/basis.urs	Sun Dec 13 13:00:55 2009 -0500
@@ -256,6 +256,11 @@
        -> sql_constraint ([mine1 = t] ++ mine ++ munused) []
 
 con sql_exp :: {{Type}} -> {{Type}} -> {Type} -> Type -> Type
+val sql_exp_weaken : fs ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type} -> t ::: Type
+                     -> fs' ::: {{Type}} -> agg' ::: {{Type}} -> exps' ::: {Type}
+                     -> [fs ~ fs'] => [agg ~ agg'] => [exps ~ exps'] =>
+                     sql_exp fs agg exps t
+                     -> sql_exp (fs ++ fs') (agg ++ agg') (exps ++ exps') t
 
 val check : fs ::: {Type}
             -> sql_exp [] [] fs bool
@@ -274,6 +279,12 @@
                                      (map (fn fields :: ({Type} * {Type}) => fields.1 ++ fields.2) keep_drop)
                                      (map (fn fields :: ({Type} * {Type}) => fields.1) keep_drop)
 val sql_subset_all : tables :: {{Type}} -> sql_subset tables tables
+val sql_subset_concat : big1 ::: {{Type}} -> little1 ::: {{Type}}
+                        -> big2 ::: {{Type}} -> little2 ::: {{Type}}
+                        -> [big1 ~ big2] => [little1 ~ little2] =>
+    sql_subset big1 little1
+    -> sql_subset big2 little2
+    -> sql_subset (big1 ++ big2) (little1 ++ little2)
 
 con sql_from_items :: {{Type}} -> Type
 
@@ -343,10 +354,10 @@
                 -> sql_relop
                 -> sql_query1 tables1 selectedFields selectedExps
                 -> sql_query1 tables2 selectedFields selectedExps
-                -> sql_query1 selectedFields selectedFields selectedExps
+                -> sql_query1 [] selectedFields selectedExps
 val sql_forget_tables : tables ::: {{Type}} -> selectedFields ::: {{Type}} -> selectedExps ::: {Type}
                         -> sql_query1 tables selectedFields selectedExps
-                        -> sql_query1 selectedFields selectedFields selectedExps
+                        -> sql_query1 [] selectedFields selectedExps
 
 type sql_direction
 val sql_asc : sql_direction