From a7027700d13fcd80816ceac22c3766981f1e5baf Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 12:51:21 -0500 Subject: [PATCH] update with-db usages --- basis/db/pools/pools.factor | 9 ++++---- basis/furnace/alloy/alloy.factor | 22 +++++++++---------- .../furnace/auth/providers/db/db-tests.factor | 2 +- basis/furnace/db/db.factor | 2 +- basis/furnace/sessions/sessions-tests.factor | 4 ++-- basis/http/http-tests.factor | 2 +- extra/webapps/planet/planet.factor | 4 ++-- .../concatenative/concatenative.factor | 2 +- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/basis/db/pools/pools.factor b/basis/db/pools/pools.factor index 45f37f8f7c..8bc5e87f0e 100644 --- a/basis/db/pools/pools.factor +++ b/basis/db/pools/pools.factor @@ -6,13 +6,12 @@ IN: db.pools TUPLE: db-pool < pool db ; -: ( params db -- pool ) +: ( db -- pool ) db-pool - swap >>db - swap >>params ; + swap >>db ; -: with-db-pool ( db params quot -- ) - >r r> with-pool ; inline +: with-db-pool ( db quot -- ) + [ ] dip with-pool ; inline M: db-pool make-connection ( pool -- ) db>> db-open ; diff --git a/basis/furnace/alloy/alloy.factor b/basis/furnace/alloy/alloy.factor index decee690a3..128ec448b7 100644 --- a/basis/furnace/alloy/alloy.factor +++ b/basis/furnace/alloy/alloy.factor @@ -17,19 +17,17 @@ IN: furnace.alloy state-classes ensure-tables user ensure-table ; -: ( responder db params -- responder' ) - [ [ init-furnace-tables ] with-db ] +: ( responder db -- responder' ) + [ [ init-furnace-tables ] with-db ] keep [ - [ - - - - ] 2dip - - - ] 2bi ; + + + + ] dip + + ; -: 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 ; diff --git a/basis/furnace/auth/providers/db/db-tests.factor b/basis/furnace/auth/providers/db/db-tests.factor index fac5c23e4a..3bcd82a15d 100755 --- a/basis/furnace/auth/providers/db/db-tests.factor +++ b/basis/furnace/auth/providers/db/db-tests.factor @@ -11,7 +11,7 @@ io.files accessors kernel ; [ "auth-test.db" temp-file delete-file ] ignore-errors -"auth-test.db" temp-file sqlite-db [ +"auth-test.db" temp-file [ user ensure-table diff --git a/basis/furnace/db/db.factor b/basis/furnace/db/db.factor index b4a4386015..ed18e42a4f 100755 --- a/basis/furnace/db/db.factor +++ b/basis/furnace/db/db.factor @@ -6,7 +6,7 @@ IN: furnace.db TUPLE: db-persistence < filter-responder pool ; -: ( responder params db -- responder' ) +: ( responder db -- responder' ) db-persistence boa ; M: db-persistence call-responder* diff --git a/basis/furnace/sessions/sessions-tests.factor b/basis/furnace/sessions/sessions-tests.factor index ff089a92b2..6bb3c1cd69 100755 --- a/basis/furnace/sessions/sessions-tests.factor +++ b/basis/furnace/sessions/sessions-tests.factor @@ -48,9 +48,9 @@ M: foo call-responder* [ [ ] "text/plain" 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 [ init-request session ensure-table diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 9a1421a3ad..eb8ba34f9e 100755 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -182,7 +182,7 @@ http.server.dispatchers db.tuples ; [ stop-server "Goodbye" "text/html" ] >>display "quit" add-responder ; -: test-db "test.db" temp-file sqlite-db ; +: test-db "test.db" temp-file ; [ test-db drop delete-file ] ignore-errors diff --git a/extra/webapps/planet/planet.factor b/extra/webapps/planet/planet.factor index 00d843573c..6c097d7faa 100755 --- a/extra/webapps/planet/planet.factor +++ b/extra/webapps/planet/planet.factor @@ -195,5 +195,5 @@ posting "POSTINGS" { planet "planet-common" } >>template ; -: start-update-task ( db params -- ) - '[ _ _ [ update-cached-postings ] with-db ] 10 minutes every drop ; +: start-update-task ( db -- ) + '[ _ [ update-cached-postings ] with-db ] 10 minutes every drop ; diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index 5553fda740..aa99493fa6 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -26,7 +26,7 @@ webapps.user-admin webapps.help ; IN: websites.concatenative -: test-db ( -- params db ) "resource:test.db" sqlite-db ; +: test-db ( -- params db ) "resource:test.db" ; : init-factor-db ( -- ) test-db [