factor/basis/db/pools/pools.factor

21 lines
532 B
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel arrays namespaces sequences continuations
2008-12-17 22:04:17 -05:00
io.pools db fry db.private ;
IN: db.pools
TUPLE: db-pool < pool db ;
2008-10-02 13:51:21 -04:00
: <db-pool> ( db -- pool )
db-pool <pool>
2008-10-02 13:51:21 -04:00
swap >>db ;
2008-10-02 13:51:21 -04:00
: with-db-pool ( db quot -- )
[ <db-pool> ] dip with-pool ; inline
M: db-pool make-connection ( pool -- )
db>> db-open ;
: with-pooled-db ( pool quot -- )
2008-12-17 22:04:17 -05:00
'[ db-connection _ with-variable ] with-pooled-connection ; inline