summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-10-15 09:04:41 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-10-15 09:04:41 -0400
commit1b99970168c819038eff86dfc52c5ae0dff2e4c1 (patch)
tree49c7507ba8ae3e2d432d2b6b22e33bf22564142d /doc
parent4a35810fb9430c5b229beeffa2246824d091cdac (diff)
For new IF, fix Monoize typing and add to manual
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.tex10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/manual.tex b/doc/manual.tex
index d98029af..2c1cecc2 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -1783,6 +1783,15 @@ $$\begin{array}{l}
\hspace{.1in} \to \mt{nullify} \; \mt{t} \; \mt{nt} \to \mt{sql\_query} \; \mt{tables} \; \mt{agg} \; [\mt{nm} = \mt{t}] \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{nt}
\end{array}$$
+There is also an \cd{IF..THEN..ELSE..} construct that is compiled into standard SQL \cd{CASE} expressions.
+$$\begin{array}{l}
+\mt{val} \; \mt{sql\_if\_then\_else} : \mt{tables} ::: \{\{\mt{Type}\}\} \to \mt{agg} ::: \{\{\mt{Type}\}\} \to \mt{exps} ::: \{\mt{Type}\} \to \mt{t} ::: \mt{Type} \\
+\hspace{.1in} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{bool} \\
+\hspace{.1in} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{t} \\
+\hspace{.1in} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{t} \\
+\hspace{.1in} \to \mt{sql\_exp} \; \mt{tables} \; \mt{agg} \; \mt{exps} \; \mt{t}
+\end{array}$$
+
\texttt{FROM} clauses are specified using a type family, whose arguments are the free table variables and the table variables bound by this clause.
$$\begin{array}{l}
\mt{con} \; \mt{sql\_from\_items} :: \{\{\mt{Type}\}\} \to \{\{\mt{Type}\}\} \to \mt{Type} \\
@@ -2133,6 +2142,7 @@ $$\begin{array}{rrcll}
&&& E \; b \; E & \textrm{binary operators} \\
&&& \mt{COUNT}(\ast) & \textrm{count number of rows} \\
&&& a(E) & \textrm{other aggregate function} \\
+ &&& \mt{IF} \; E \; \mt{THEN} \; E \; \mt{ELSE} \; E & \textrm{conditional} \\
&&& (Q) & \textrm{subquery (must return a single expression column)} \\
&&& (E) & \textrm{explicit precedence} \\
\textrm{Nullary operators} & n &::=& \mt{CURRENT\_TIMESTAMP} \\