From 7bd2bc26389467f685958601cff2708751764515 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 26 Apr 2009 10:45:59 -0400 Subject: Reading blobs from the database --- tests/blob.ur | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/blob.ur b/tests/blob.ur index 2d58faae..ec683068 100644 --- a/tests/blob.ur +++ b/tests/blob.ur @@ -1,16 +1,27 @@ sequence s table t : { Id : int, Nam : option string, Data : blob, Desc : string, Typ : string } +fun view id = + r <- oneRow (SELECT t.Data, t.Typ FROM t WHERE t.Id = {[id]}); + returnBlob r.T.Data (blessMime r.T.Typ) + fun save r = id <- nextval s; dml (INSERT INTO t (Id, Nam, Data, Desc, Typ) VALUES ({[id]}, {[fileName r.Data]}, {[fileData r.Data]}, {[r.Desc]}, {[fileMimeType r.Data]})); main () -and main () = return -
- - - - -
+and main () = + ls <- queryX (SELECT t.Id, t.Desc FROM t ORDER BY t.Desc) + (fn r =>
  • {[r.T.Desc]}
  • ); + return + {ls} + +
    + +
    + + + + +
    -- cgit v1.2.3