We can't seem to get the below simple high level db-tuple example going,
which may be easier to debug if it is sqlite problem.  Shaping, this prints
a folder to 'Look in:'.  Does it actually create that folder? If not, we
have a permissions problem, perhaps.  A file called "adhoc.sqlite" should
appear upon execution of init-db, or nothing further can work, so please
remind me of the results of the above two expectations.

USING: db.types db.tuples db.sqlite io.directories fry db calendar ;

TUPLE: entity id author date content ;

entity "entity" {
    { "id" "ID" INTEGER +db-assigned-id+ }
    { "author" "AUTHOR" { VARCHAR 256 } +not-null+ } ! uid
    { "date" "DATE" TIMESTAMP +not-null+ }
    { "content" "CONTENT" TEXT +not-null+ }
} define-persistent

: blog-db ( -- db ) "adhoc" home prepend-path [ make-directories ] [
"adhoc.sqlite" append-path ] bi <sqlite-db> ;
: with-blog-data ( quot -- ) '[ blog-db _ with-db ] call ; inline
: init-db ( -- )  [
    entity ensure-table
     ] with-blog-data ;

"adhoc" home prepend-path "Look in: " prepend .

init-db

entity new "Jim" >>author now >>date "blog entry" >>content

[ insert-tuple ] with-blog-data

entity new "Shaping" >>author now >>date "blog entry reply" >>content

[ insert-tuple ] with-blog-data

[ entity new select-tuples ] with-blog-data

[ "select * from entity order by author" sql-query  ] with-blog-data
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to