summaryrefslogtreecommitdiff
path: root/demo/more
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 15:35:58 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 15:35:58 -0400
commitf734c97cc7f02a8ada114be16779991b59e6761e (patch)
tree1e06ff6455bda35dc28fb3f9601270a7f91cdc2e /demo/more
parentb0d857842e340ff23af2fc398617c9d3cf3a3dcb (diff)
Track whether SQL expressions may use window functions, in preparation for actual window function support
Diffstat (limited to 'demo/more')
-rw-r--r--demo/more/dbgrid.ur8
-rw-r--r--demo/more/orm.ur10
-rw-r--r--demo/more/versioned.ur12
3 files changed, 15 insertions, 15 deletions
diff --git a/demo/more/dbgrid.ur b/demo/more/dbgrid.ur
index fc593533..13092db6 100644
--- a/demo/more/dbgrid.ur
+++ b/demo/more/dbgrid.ur
@@ -385,7 +385,7 @@ functor Make(M : sig
val wholeRow = @Folder.concat ! M.keyFolder M.rowFolder
fun ensql [env] (r : $(M.key ++ M.row)) =
- @map2 [rawMeta] [ident] [sql_exp env [] []]
+ @map2 [rawMeta] [ident] [sql_exp env [] [] disallow_window]
(fn [t] meta v => @sql_inject meta.Inj v)
wholeRow M.raw r
@@ -396,12 +396,12 @@ functor Make(M : sig
dml (insert M.tab (ensql row));
return row
- fun selector (r : $M.key) : sql_exp [T = M.key ++ M.row] [] [] bool =
+ fun selector (r : $M.key) : sql_exp [T = M.key ++ M.row] [] [] disallow_window bool =
@foldR2 [rawMeta] [ident]
- [fn key => rest :: {Type} -> [rest ~ key] => sql_exp [T = key ++ rest] [] [] bool]
+ [fn key => rest :: {Type} -> [rest ~ key] => sql_exp [T = key ++ rest] [] [] disallow_window bool]
(fn [nm :: Name] [t :: Type] [key :: {Type}] [[nm] ~ key]
(meta : rawMeta t) (v : t)
- (exp : rest :: {Type} -> [rest ~ key] => sql_exp [T = key ++ rest] [] [] bool)
+ (exp : rest :: {Type} -> [rest ~ key] => sql_exp [T = key ++ rest] [] [] disallow_window bool)
[rest :: {Type}] [rest ~ [nm = t] ++ key] =>
(WHERE T.{nm} = {@sql_inject meta.Inj v} AND {exp [[nm = t] ++ rest]}))
(fn [rest :: {Type}] [rest ~ []] => (WHERE TRUE))
diff --git a/demo/more/orm.ur b/demo/more/orm.ur
index 468281f7..2e1fc2e0 100644
--- a/demo/more/orm.ur
+++ b/demo/more/orm.ur
@@ -32,8 +32,8 @@ functor Table(M : sig
val id = {Link = fn id => resultOut (SELECT * FROM t WHERE t.Id = {[id]}),
Inj = inj}
- fun ensql [avail ::_] (r : row') : $(map (sql_exp avail [] []) fs') =
- @map2 [meta] [fst] [fn ts :: (Type * Type) => sql_exp avail [] [] ts.1]
+ fun ensql [avail ::_] (r : row') : $(map (sql_exp avail [] [] disallow_window) fs') =
+ @map2 [meta] [fst] [fn ts :: (Type * Type) => sql_exp avail [] [] disallow_window ts.1]
(fn [ts] meta v => @sql_inject meta.Inj v)
M.folder M.cols r
@@ -53,11 +53,11 @@ functor Table(M : sig
val list = resultsOut (SELECT * FROM t)
- con col = fn t => {Exp : sql_exp [T = fs] [] [] t,
+ con col = fn t => {Exp : sql_exp [T = fs] [] [] disallow_window t,
Inj : sql_injectable t}
val idCol = {Exp = sql_field [#T] [#Id], Inj = _}
con meta' = fn (fs :: {Type}) (col :: Type, parent :: Type) =>
- {Col : {Exp : sql_exp [T = fs] [] [] col,
+ {Col : {Exp : sql_exp [T = fs] [] [] disallow_window col,
Inj : sql_injectable col},
Parent : $fs -> transaction (option parent)}
val cols = @foldR [meta] [fn before => after :: {(Type * Type)} -> [before ~ after] =>
@@ -75,7 +75,7 @@ functor Table(M : sig
M.folder M.cols
[[Id = (id, row)]] !
- type filter = sql_exp [T = fs] [] [] bool
+ type filter = sql_exp [T = fs] [] [] disallow_window bool
fun find (f : filter) = resultOut (SELECT * FROM t WHERE {f})
fun search (f : filter) = resultsOut (SELECT * FROM t WHERE {f})
diff --git a/demo/more/versioned.ur b/demo/more/versioned.ur
index d08ebcb0..5da8704c 100644
--- a/demo/more/versioned.ur
+++ b/demo/more/versioned.ur
@@ -24,7 +24,7 @@ functor Make(M : sig
Eq : eq t}
fun keyRecd (r : $(M.key ++ M.data)) =
- @map2 [sql_injectable] [ident] [sql_exp [] [] []]
+ @map2 [sql_injectable] [ident] [sql_exp [] [] [] disallow_window]
(fn [t] => @sql_inject)
M.keyFolder M.key (r --- M.data)
@@ -34,18 +34,18 @@ functor Make(M : sig
({Version = (SQL {[vr]}), When = (SQL CURRENT_TIMESTAMP)}
++ keyRecd r
++ @map2 [dmeta] [ident]
- [fn t => sql_exp [] [] [] (option t)]
+ [fn t => sql_exp [] [] [] disallow_window (option t)]
(fn [t] x v => @sql_inject (@sql_option_prim x.Inj)
(Some v))
M.dataFolder M.data (r --- M.key)))
- fun keyExp (r : $M.key) : sql_exp [T = all] [] [] bool =
+ fun keyExp (r : $M.key) : sql_exp [T = all] [] [] disallow_window bool =
@foldR2 [sql_injectable] [ident] [fn before => after :: {Type} -> [before ~ after]
- => sql_exp [T = before ++ after] [] [] bool]
+ => sql_exp [T = before ++ after] [] [] disallow_window bool]
(fn [nm :: Name] [t :: Type] [before :: {Type}] [[nm] ~ before]
(inj : sql_injectable t) (v : t)
(e : after :: {Type} -> [before ~ after]
- => sql_exp [T = before ++ after] [] [] bool)
+ => sql_exp [T = before ++ after] [] [] disallow_window bool)
[after :: {Type}] [[nm = t] ++ before ~ after] =>
(SQL t.{nm} = {[v]} AND {e [[nm = t] ++ after]}))
(fn [after :: {Type}] [[] ~ after] => (SQL TRUE))
@@ -113,7 +113,7 @@ functor Make(M : sig
| Some cur =>
vr <- nextval s;
let
- val r' = @map3 [dmeta] [ident] [ident] [fn t => sql_exp [] [] [] (option t)]
+ val r' = @map3 [dmeta] [ident] [ident] [fn t => sql_exp [] [] [] disallow_window (option t)]
(fn [t] (meta : dmeta t) old new =>
@sql_inject (@sql_option_prim meta.Inj)
(if @@eq [_] meta.Eq old new then