diff --git a/extra/http/server/db/db-tests.factor b/extra/http/server/db/db-tests.factor new file mode 100644 index 0000000000..0c34745c00 --- /dev/null +++ b/extra/http/server/db/db-tests.factor @@ -0,0 +1,4 @@ +IN: http.server.db.tests +USING: tools.test http.server.db ; + +\ must-infer diff --git a/extra/http/server/db/db.factor b/extra/http/server/db/db.factor index 047af3f4ac..3d8f78fbdd 100755 --- a/extra/http/server/db/db.factor +++ b/extra/http/server/db/db.factor @@ -1,16 +1,17 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: db http.server http.server.sessions kernel accessors -continuations namespaces destructors ; +USING: db db.pooling http.server http.server.sessions kernel +accessors continuations namespaces destructors ; IN: http.server.db -TUPLE: db-persistence < filter-responder db params ; +TUPLE: db-persistence < filter-responder pool ; -C: db-persistence - -: connect-db ( db-persistence -- ) - [ db>> ] [ params>> ] bi make-db db-open - [ db set ] [ add-always-destructor ] bi ; +: ( responder db params -- responder' ) + db-persistence boa ; M: db-persistence call-responder* - [ connect-db ] [ call-next-method ] bi ; + [ + pool>> [ acquire-connection ] keep + [ return-connection-later ] [ drop db set ] 2bi + ] + [ call-next-method ] bi ;