update with-db usages
parent
67683dde20
commit
a7027700d1
|
@ -6,13 +6,12 @@ IN: db.pools
|
||||||
|
|
||||||
TUPLE: db-pool < pool db ;
|
TUPLE: db-pool < pool db ;
|
||||||
|
|
||||||
: <db-pool> ( params db -- pool )
|
: <db-pool> ( db -- pool )
|
||||||
db-pool <pool>
|
db-pool <pool>
|
||||||
swap >>db
|
swap >>db ;
|
||||||
swap >>params ;
|
|
||||||
|
|
||||||
: with-db-pool ( db params quot -- )
|
: with-db-pool ( db quot -- )
|
||||||
>r <db-pool> r> with-pool ; inline
|
[ <db-pool> ] dip with-pool ; inline
|
||||||
|
|
||||||
M: db-pool make-connection ( pool -- )
|
M: db-pool make-connection ( pool -- )
|
||||||
db>> db-open ;
|
db>> db-open ;
|
||||||
|
|
|
@ -17,19 +17,17 @@ IN: furnace.alloy
|
||||||
state-classes ensure-tables
|
state-classes ensure-tables
|
||||||
user ensure-table ;
|
user ensure-table ;
|
||||||
|
|
||||||
: <alloy> ( responder db params -- responder' )
|
: <alloy> ( responder db -- responder' )
|
||||||
[ [ init-furnace-tables ] with-db ]
|
[ [ init-furnace-tables ] with-db ] keep
|
||||||
[
|
|
||||||
[
|
[
|
||||||
<asides>
|
<asides>
|
||||||
<conversations>
|
<conversations>
|
||||||
<sessions>
|
<sessions>
|
||||||
] 2dip
|
] dip
|
||||||
<db-persistence>
|
<db-persistence>
|
||||||
<check-form-submissions>
|
<check-form-submissions> ;
|
||||||
] 2bi ;
|
|
||||||
|
|
||||||
: start-expiring ( db params -- )
|
: start-expiring ( db -- )
|
||||||
'[
|
'[
|
||||||
_ _ [ state-classes [ expire-state ] each ] with-db
|
_ [ state-classes [ expire-state ] each ] with-db
|
||||||
] 5 minutes every drop ;
|
] 5 minutes every drop ;
|
||||||
|
|
|
@ -11,7 +11,7 @@ io.files accessors kernel ;
|
||||||
|
|
||||||
[ "auth-test.db" temp-file delete-file ] ignore-errors
|
[ "auth-test.db" temp-file delete-file ] ignore-errors
|
||||||
|
|
||||||
"auth-test.db" temp-file sqlite-db [
|
"auth-test.db" temp-file <sqlite-db> [
|
||||||
|
|
||||||
user ensure-table
|
user ensure-table
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ IN: furnace.db
|
||||||
|
|
||||||
TUPLE: db-persistence < filter-responder pool ;
|
TUPLE: db-persistence < filter-responder pool ;
|
||||||
|
|
||||||
: <db-persistence> ( responder params db -- responder' )
|
: <db-persistence> ( responder db -- responder' )
|
||||||
<db-pool> db-persistence boa ;
|
<db-pool> db-persistence boa ;
|
||||||
|
|
||||||
M: db-persistence call-responder*
|
M: db-persistence call-responder*
|
||||||
|
|
|
@ -48,9 +48,9 @@ M: foo call-responder*
|
||||||
<action>
|
<action>
|
||||||
[ [ ] "text/plain" <content> exit-with ] >>display ;
|
[ [ ] "text/plain" <content> exit-with ] >>display ;
|
||||||
|
|
||||||
[ "auth-test.db" temp-file sqlite-db delete-file ] ignore-errors
|
[ "auth-test.db" temp-file delete-file ] ignore-errors
|
||||||
|
|
||||||
"auth-test.db" temp-file sqlite-db [
|
"auth-test.db" temp-file <sqlite-db> [
|
||||||
|
|
||||||
<request> init-request
|
<request> init-request
|
||||||
session ensure-table
|
session ensure-table
|
||||||
|
|
|
@ -182,7 +182,7 @@ http.server.dispatchers db.tuples ;
|
||||||
[ stop-server "Goodbye" "text/html" <content> ] >>display
|
[ stop-server "Goodbye" "text/html" <content> ] >>display
|
||||||
"quit" add-responder ;
|
"quit" add-responder ;
|
||||||
|
|
||||||
: test-db "test.db" temp-file sqlite-db ;
|
: test-db "test.db" temp-file <sqlite-db> ;
|
||||||
|
|
||||||
[ test-db drop delete-file ] ignore-errors
|
[ test-db drop delete-file ] ignore-errors
|
||||||
|
|
||||||
|
|
|
@ -195,5 +195,5 @@ posting "POSTINGS"
|
||||||
<boilerplate>
|
<boilerplate>
|
||||||
{ planet "planet-common" } >>template ;
|
{ planet "planet-common" } >>template ;
|
||||||
|
|
||||||
: start-update-task ( db params -- )
|
: start-update-task ( db -- )
|
||||||
'[ _ _ [ update-cached-postings ] with-db ] 10 minutes every drop ;
|
'[ _ [ update-cached-postings ] with-db ] 10 minutes every drop ;
|
||||||
|
|
|
@ -26,7 +26,7 @@ webapps.user-admin
|
||||||
webapps.help ;
|
webapps.help ;
|
||||||
IN: websites.concatenative
|
IN: websites.concatenative
|
||||||
|
|
||||||
: test-db ( -- params db ) "resource:test.db" sqlite-db ;
|
: test-db ( -- params db ) "resource:test.db" <sqlite-db> ;
|
||||||
|
|
||||||
: init-factor-db ( -- )
|
: init-factor-db ( -- )
|
||||||
test-db [
|
test-db [
|
||||||
|
|
Loading…
Reference in New Issue