diff options
author | 2009-04-26 11:07:25 -0400 | |
---|---|---|
committer | 2009-04-26 11:07:25 -0400 | |
commit | d824fdd52fb824a6a9db9fb3cc32cfb28746d04b (patch) | |
tree | e73efff25966663d1e173a44b019be814b1a923a | |
parent | 8be9bc6c82ce1ad669f4696bc91415f3421e51b8 (diff) |
blobSize
-rw-r--r-- | include/urweb.h | 1 | ||||
-rw-r--r-- | lib/ur/basis.urs | 1 | ||||
-rw-r--r-- | src/c/urweb.c | 4 | ||||
-rw-r--r-- | tests/blob.ur | 4 |
4 files changed, 8 insertions, 2 deletions
diff --git a/include/urweb.h b/include/urweb.h index 716c3bc6..51ab9149 100644 --- a/include/urweb.h +++ b/include/urweb.h @@ -169,5 +169,6 @@ uw_Basis_string uw_Basis_sigString(uw_context, uw_unit); uw_Basis_string uw_Basis_fileName(uw_context, uw_Basis_file); uw_Basis_string uw_Basis_fileMimeType(uw_context, uw_Basis_file); uw_Basis_blob uw_Basis_fileData(uw_context, uw_Basis_file); +uw_Basis_int uw_Basis_blobSize(uw_context, uw_Basis_blob); __attribute__((noreturn)) void uw_return_blob(uw_context, uw_Basis_blob, uw_Basis_string mimeType); diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 6e22ece3..46218932 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -524,6 +524,7 @@ val upload : formTag file [] [Value = string, Size = int] type mimeType val blessMime : string -> mimeType val returnBlob : t ::: Type -> blob -> mimeType -> transaction t +val blobSize : blob -> int con radio = [Body, Radio] val radio : formTag string radio [] diff --git a/src/c/urweb.c b/src/c/urweb.c index 22b8a902..1d6b804f 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -2183,6 +2183,10 @@ uw_Basis_string uw_Basis_fileMimeType(uw_context ctx, uw_Basis_file f) { return f.type; } +uw_Basis_int uw_Basis_blobSize(uw_context ctx, uw_Basis_blob b) { + return b.size; +} + uw_Basis_blob uw_Basis_fileData(uw_context ctx, uw_Basis_file f) { return f.data; } diff --git a/tests/blob.ur b/tests/blob.ur index ec683068..82a631b9 100644 --- a/tests/blob.ur +++ b/tests/blob.ur @@ -12,8 +12,8 @@ fun save r = main () and main () = - ls <- queryX (SELECT t.Id, t.Desc FROM t ORDER BY t.Desc) - (fn r => <xml><li><a link={view r.T.Id}>{[r.T.Desc]}</a></li></xml>); + ls <- queryX (SELECT t.Id, t.Desc, t.Data FROM t ORDER BY t.Desc) + (fn r => <xml><li><a link={view r.T.Id}>{[r.T.Desc]} ({[blobSize r.T.Data]})</a></li></xml>); return <xml><body> {ls} |