Jim,

 

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

 

doesn't make the directory.

 

But

 

init-db

 

does, though it fails in general:   "The image refers to a library or symbol
that was not found at load-time."

 

I just discovered the UI walker.  I tried Ctrl-W to launch it on init-db.  I
stepped-into several words, until I got to the one that threw the error
(BTW, the error dialog launches behind the walker, and you don't know it is
there, until you see that additional steps in the walker don't work).  When
I step-into as deeply as I can go I get this tack trace:

 

(U) Quotation: [ set-namestack init-catchstack self quot>> call -> stop ]

(O) Word: listener-thread

(O) Word: listener

(O) Word: (listener)

(U) Quotation: [

        [ ~quotation~ dip swap ~quotation~ dip ] dip swap

        [ call datastack ] dip -> swap [ set-datastack ] dip

    ]

(U) Quotation: [ call -> datastack ]

(U) Quotation: [ swap >c call -> c> drop ]

(U) Quotation: [ [ ~quotation~ ] dip [ break with-db ] curry compose call ->
]

(U) Quotation: [

        [ break db-open db-connection ] dip -> [ ~quotation~ ] dip

        compose [ ~quotation~ ] dip [ with-disposal ] curry compose

        with-variable

    ]

(U) Quotation: [ swap [ call ] dip -> ]

    Word: dip

(U) Quotation: [ db-open -> db-connection ]

(U) Quotation: [ path>> sqlite-open -> <sqlite-db-connection> ]

(U) Quotation: [

        [ drop (local-allots) ] [ swap out-parameters ] 2bi

        -> (cleanup-allot)

    ]

(U) Quotation: [ [ 2keep ] dip -> call ]

(U) Quotation: [ swap [ call ] dip -> ]

    Word: dip

(U) Quotation: [ swap [ dip ] dip -> ]

    Word: 2dip

(U) Quotation: [ swap [ call ] dip -> ]

    Word: dip

(U) Quotation: [

        dup -> save-error catchstack* empty? [

            thread-error-hook get-global ~quotation~ or

            (( error -- * )) call-effect-unsafe

        ] when c> continue-with

    ]

 

The problem is happening in sqlite-db-connect.  There is a
call-effect-unsafe near the bottom.  The data stack shows T {
local-allocation-error } and a path to <user-directory>/adhoc/adhoc.sqlite.
At this point the adhoc directory exists, but the adhoc.sqlite file does
not. 

 

 

Shaping

 

From: Jim mack [mailto:j...@less2do.com] 
Sent: 2010-November-18, 12:46
To: factor-talk@lists.sourceforge.net
Subject: Re: [Factor-talk] loading of webapps.site-watcher

 

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