From 0230ce71e14ea09b3037ff4b58c3bae323c12236 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 7 Apr 2009 16:22:11 -0400 Subject: Add primary keys to demo --- demo/batch.ur | 1 + demo/batchG.ur | 1 + demo/broadcast.ur | 1 + demo/chat.ur | 1 + demo/crud1.ur | 1 + demo/crud2.ur | 1 + demo/noisy.ur | 1 + demo/refFun.ur | 1 + demo/roundTrip.ur | 1 + demo/sql.ur | 1 + demo/tree.ur | 1 + 11 files changed, 11 insertions(+) (limited to 'demo') 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 -- cgit v1.2.3