view demo/more/orm1.ur @ 1892:907a82a44f01

Add missing inter-library dependencies This is needed, at least on recent Ubuntu, to fix these linker errors when compiling any Ur/Web application: liburweb.so: undefined reference to `lround' liburweb.so: undefined reference to `ceil' liburweb.so: undefined reference to `RAND_bytes' liburweb.so: undefined reference to `DES_fcrypt' liburweb.so: undefined reference to `SHA256_Init' liburweb.so: undefined reference to `SHA256_Final' liburweb.so: undefined reference to `SHA256_Update' Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- src/c/Makefile.am | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
author Anders Kaseorg <andersk@mit.edu>
date Thu, 21 Nov 2013 14:32:11 -0500
parents 8d3aa6c7cee0
children 819756825c8d
line wrap: on
line source
open Orm

structure T = Table(struct
                        val cols = {A = local [int],
                                    B = local [string]}
                    end)

structure S = Table(struct
                        val cols = {C = T.id,
                                    D = local [float]}
                    end)

fun action () =
    r1 <- T.create {A = 3, B = "Hi"};
    T.save (r1 -- #B ++ {B = "Bye"});
    r2 <- T.create {A = 4, B = "Why"};
    r3 <- T.create {A = 66, B = "Hi"};

    s <- S.create {C = r1.Id, D = 45.67};

    ls <- T.list;
    ls' <- T.search (T.eq T.cols.B.Col "Hi");

    lsS <- S.list;
    lsS <- List.mapM (fn r => p <- S.cols.C.Parent r; return (r, p)) lsS;

    T.delete r1;
    T.delete r2;
    T.delete r3;

    S.delete s;

    return <xml><body>
      {List.mapX (fn r => <xml><li> {[r.A]}: {[r.B]}</li></xml>) ls}
      <br/>
      {List.mapX (fn r => <xml><li> {[r.A]}: {[r.B]}</li></xml>) ls'}
      <br/>
      {List.mapX (fn (s, ro) => <xml><li> {[s.D]}: {case ro of
                                                        None => <xml>No parent</xml>
                                                      | Some r => <xml>{[r.B]}</xml>}
      </li></xml>) lsS}
    </body></xml>
    
fun main () = return <xml><body>
  <form><submit action={action}/></form>
</body></xml>