summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ur/basis.urs3
-rw-r--r--src/monoize.sml4
-rw-r--r--tests/lower.ur10
-rw-r--r--tests/lower.urp4
4 files changed, 20 insertions, 1 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index fcce3a01..83f23cae 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -565,7 +565,8 @@ val sql_ufunc : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
-> sql_exp tables agg exps ran
val sql_octet_length : sql_ufunc blob int
val sql_known : t ::: Type -> sql_ufunc t bool
-
+val sql_lower : sql_ufunc string string
+val sql_upper : sql_ufunc string string
val sql_nullable : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type} -> t ::: Type
-> sql_injectable_prim t
diff --git a/src/monoize.sml b/src/monoize.sml
index e4ed6562..b1cccb81 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2785,6 +2785,10 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
"octet_length"
else
"length")), loc), fm)
+ | L.EFfi ("Basis", "sql_lower") =>
+ ((L'.EPrim (Prim.String "lower"), loc), fm)
+ | L.EFfi ("Basis", "sql_upper") =>
+ ((L'.EPrim (Prim.String "upper"), loc), fm)
| L.ECApp ((L.EFfi ("Basis", "sql_known"), _), _) =>
((L'.EFfi ("Basis", "sql_known"), loc), fm)
diff --git a/tests/lower.ur b/tests/lower.ur
new file mode 100644
index 00000000..21e1f1f6
--- /dev/null
+++ b/tests/lower.ur
@@ -0,0 +1,10 @@
+table lower : { A : string }
+
+fun main () : transaction page =
+ all <- queryX1 (SELECT *
+ FROM lower
+ WHERE lower(lower.A) LIKE '%foo')
+ (fn r => <xml>{[r.A]}<br/></xml>);
+ return <xml><body>
+ {all}
+ </body></xml>
diff --git a/tests/lower.urp b/tests/lower.urp
new file mode 100644
index 00000000..6abf57aa
--- /dev/null
+++ b/tests/lower.urp
@@ -0,0 +1,4 @@
+database dbname=test
+sql lower.sql
+
+lower