summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 16:22:11 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 16:22:11 -0400
commit24158c81fb4cc8b318ceb5bc461ab2f494cb7b78 (patch)
tree931b8113bdd0687ea37ee48d1dede73a7cc65a46
parent26ad31287745567b98b357de9793a0e795c63334 (diff)
Add primary keys to demo
-rw-r--r--demo/batch.ur1
-rw-r--r--demo/batchG.ur1
-rw-r--r--demo/broadcast.ur1
-rw-r--r--demo/chat.ur1
-rw-r--r--demo/crud1.ur1
-rw-r--r--demo/crud2.ur1
-rw-r--r--demo/noisy.ur1
-rw-r--r--demo/refFun.ur1
-rw-r--r--demo/roundTrip.ur1
-rw-r--r--demo/sql.ur1
-rw-r--r--demo/tree.ur1
-rw-r--r--src/elisp/urweb-mode.el3
12 files changed, 13 insertions, 1 deletions
diff --git a/demo/batch.ur b/demo/batch.ur
index 454ff691..4100749f 100644
--- a/demo/batch.ur
+++ b/demo/batch.ur
@@ -1,6 +1,7 @@
datatype list t = Nil | Cons of t * list t
table t : {Id : int, A : string}
+ PRIMARY KEY Id
fun allRows () =
query (SELECT * FROM t)
diff --git a/demo/batchG.ur b/demo/batchG.ur
index e370b26e..d0071d7d 100644
--- a/demo/batchG.ur
+++ b/demo/batchG.ur
@@ -1,4 +1,5 @@
table t : {Id : int, A : string, B : float}
+ PRIMARY KEY Id
open BatchFun.Make(struct
val tab = t
diff --git a/demo/broadcast.ur b/demo/broadcast.ur
index 13cb5ceb..29d8d8fb 100644
--- a/demo/broadcast.ur
+++ b/demo/broadcast.ur
@@ -1,6 +1,7 @@
functor Make(M : sig type t end) = struct
sequence s
table t : {Id : int, Client : client, Channel : channel M.t}
+ PRIMARY KEY Id
type topic = int
diff --git a/demo/chat.ur b/demo/chat.ur
index ad1bf2ca..067397eb 100644
--- a/demo/chat.ur
+++ b/demo/chat.ur
@@ -4,6 +4,7 @@ structure Room = Broadcast.Make(struct
sequence s
table t : { Id : int, Title : string, Room : Room.topic }
+ PRIMARY KEY Id
fun chat id =
r <- oneRow (SELECT t.Title, t.Room FROM t WHERE t.Id = {[id]});
diff --git a/demo/crud1.ur b/demo/crud1.ur
index 3849e822..796c063d 100644
--- a/demo/crud1.ur
+++ b/demo/crud1.ur
@@ -1,4 +1,5 @@
table t1 : {Id : int, A : int, B : string, C : float, D : bool}
+ PRIMARY KEY Id
open Crud.Make(struct
val tab = t1
diff --git a/demo/crud2.ur b/demo/crud2.ur
index 1db376d4..54992e28 100644
--- a/demo/crud2.ur
+++ b/demo/crud2.ur
@@ -1,4 +1,5 @@
table t : {Id : int, Nam : string, Ready : bool}
+ PRIMARY KEY Id
open Crud.Make(struct
val tab = t
diff --git a/demo/noisy.ur b/demo/noisy.ur
index 118af737..708cfa2c 100644
--- a/demo/noisy.ur
+++ b/demo/noisy.ur
@@ -1,6 +1,7 @@
datatype list t = Nil | Cons of t * list t
table t : { Id : int, A : string }
+ PRIMARY KEY Id
fun add id s =
dml (INSERT INTO t (Id, A) VALUES ({[id]}, {[s]}))
diff --git a/demo/refFun.ur b/demo/refFun.ur
index c6a4ea5f..114d4ef0 100644
--- a/demo/refFun.ur
+++ b/demo/refFun.ur
@@ -7,6 +7,7 @@ functor Make(M : sig
sequence s
table t : { Id : int, Data : M.data }
+ PRIMARY KEY Id
fun new d =
id <- nextval s;
diff --git a/demo/roundTrip.ur b/demo/roundTrip.ur
index a2be8083..a0d29bf6 100644
--- a/demo/roundTrip.ur
+++ b/demo/roundTrip.ur
@@ -1,4 +1,5 @@
table channels : { Client : client, Channel : channel (string * int * float) }
+ PRIMARY KEY Client
fun writeBack v =
me <- self;
diff --git a/demo/sql.ur b/demo/sql.ur
index 44ff478f..bbfec24a 100644
--- a/demo/sql.ur
+++ b/demo/sql.ur
@@ -1,4 +1,5 @@
table t : { A : int, B : float, C : string, D : bool }
+ PRIMARY KEY A
fun list () =
rows <- queryX (SELECT * FROM t)
diff --git a/demo/tree.ur b/demo/tree.ur
index 27e9aa21..99f93011 100644
--- a/demo/tree.ur
+++ b/demo/tree.ur
@@ -1,5 +1,6 @@
sequence s
table t : { Id : int, Parent : option int, Nam : string }
+ PRIMARY KEY Id
open TreeFun.Make(struct
val tab = t
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el
index e7615cc3..65cd8abf 100644
--- a/src/elisp/urweb-mode.el
+++ b/src/elisp/urweb-mode.el
@@ -147,7 +147,8 @@ See doc for the variable `urweb-mode-info'."
(urweb-syms-re "SELECT" "FROM" "AS" "WHERE" "SQL" "GROUP" "ORDER" "BY"
"HAVING" "LIMIT" "OFFSET" "ALL" "UNION" "INTERSECT" "EXCEPT"
"TRUE" "FALSE" "AND" "OR" "NOT" "COUNT" "AVG" "SUM" "MIN" "MAX"
- "ASC" "DESC" "INSERT" "INTO" "VALUES" "UPDATE" "SET" "DELETE")
+ "ASC" "DESC" "INSERT" "INTO" "VALUES" "UPDATE" "SET" "DELETE"
+ "PRIMARY" "KEY" "CONSTRAINT" "UNIQUE")
"A regexp that matches SQL keywords.")
(defconst urweb-lident-regexp "\\<[a-z_][A-Za-z0-9_']*\\>"