Mercurial > meta
comparison sql.ur @ 16:959583692166
Reorder arguments for better partial application
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 11 Dec 2011 14:44:18 -0500 |
parents | 6ebc2ca594b7 |
children | 6cd839818393 |
comparison
equal
deleted
inserted
replaced
15:6ebc2ca594b7 | 16:959583692166 |
---|---|
27 (fn [rest1 :: {Type}] [rest2 :: {Type}] [rest1 ~ []] [rest2 ~ []] => (WHERE TRUE)) | 27 (fn [rest1 :: {Type}] [rest2 :: {Type}] [rest1 ~ []] [rest2 ~ []] => (WHERE TRUE)) |
28 fl [_] [_] ! ! | 28 fl [_] [_] ! ! |
29 | 29 |
30 fun insertIfMissing [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}] | 30 fun insertIfMissing [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}] |
31 [keyCols ~ otherCols] [[Pkey] ~ otherKeys] | 31 [keyCols ~ otherCols] [[Pkey] ~ otherKeys] |
32 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) | |
33 (ofl : folder otherCols) (oinj : $(map sql_injectable otherCols)) | |
32 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) | 34 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) |
33 (vs : $(keyCols ++ otherCols)) | 35 (vs : $(keyCols ++ otherCols)) |
34 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) | |
35 (ofl : folder otherCols) (oinj : $(map sql_injectable otherCols)) | |
36 : transaction bool = | 36 : transaction bool = |
37 alreadyThere <- oneRowE1 (SELECT COUNT( * ) > 0 | 37 alreadyThere <- oneRowE1 (SELECT COUNT( * ) > 0 |
38 FROM t | 38 FROM t |
39 WHERE {@selector [#T] ! kfl kinj (vs --- _)}); | 39 WHERE {@selector [#T] ! kfl kinj (vs --- _)}); |
40 if alreadyThere then | 40 if alreadyThere then |
44 ++ @sqexps ofl oinj (vs --- _))); | 44 ++ @sqexps ofl oinj (vs --- _))); |
45 return True | 45 return True |
46 | 46 |
47 fun deleteByKey [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}] | 47 fun deleteByKey [keyCols ::: {Type}] [otherCols ::: {Type}] [otherKeys ::: {{Unit}}] |
48 [keyCols ~ otherCols] [[Pkey] ~ otherKeys] | 48 [keyCols ~ otherCols] [[Pkey] ~ otherKeys] |
49 (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) | |
49 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) | 50 (t : sql_table (keyCols ++ otherCols) ([Pkey = map (fn _ => ()) keyCols] ++ otherKeys)) |
50 (vs : $keyCols) (kfl : folder keyCols) (kinj : $(map sql_injectable keyCols)) = | 51 (vs : $keyCols) = |
51 dml (delete t (@selector [#T] ! kfl kinj vs)) | 52 dml (delete t (@selector [#T] ! kfl kinj vs)) |