Merge branch 'master' of git://factorcode.org/git/factor
commit
0e48ccb4da
|
@ -3,4 +3,4 @@ IN: db.tests
|
|||
|
||||
{ 1 0 } [ [ drop ] query-each ] must-infer-as
|
||||
{ 1 1 } [ [ ] query-map ] must-infer-as
|
||||
{ 2 0 } [ [ ] with-db ] must-infer-as
|
||||
{ 1 0 } [ [ ] with-db ] must-infer-as
|
||||
|
|
|
@ -4,7 +4,7 @@ accessors kernel math destructors ;
|
|||
|
||||
\ <db-pool> must-infer
|
||||
|
||||
{ 2 0 } [ [ ] with-db-pool ] must-infer-as
|
||||
{ 1 0 } [ [ ] with-db-pool ] must-infer-as
|
||||
|
||||
{ 1 0 } [ [ ] with-pooled-db ] must-infer-as
|
||||
|
||||
|
@ -13,7 +13,7 @@ USE: db.sqlite
|
|||
|
||||
[ "pool-test.db" temp-file delete-file ] ignore-errors
|
||||
|
||||
[ ] [ "pool-test.db" temp-file sqlite-db <db-pool> "pool" set ] unit-test
|
||||
[ ] [ "pool-test.db" temp-file <sqlite-db> <db-pool> "pool" set ] unit-test
|
||||
|
||||
[ ] [ "pool" get expired>> t >>expired drop ] unit-test
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
! You will need to run 'createdb factor-test' to create the database.
|
||||
! Set username and password in the 'connect' word.
|
||||
|
||||
USING: kernel db.postgresql alien continuations io classes
|
||||
prettyprint sequences namespaces tools.test db
|
||||
db.tuples db.types unicode.case ;
|
||||
db.tuples db.types unicode.case accessors ;
|
||||
IN: db.postgresql.tests
|
||||
|
||||
: test-db ( -- postgresql-db )
|
||||
{ "localhost" "postgres" "foob" "factor-test" } postgresql-db ;
|
||||
<postgresql-db>
|
||||
"localhost" >>host
|
||||
"postgres" >>username
|
||||
"thepasswordistrust" >>password
|
||||
"factor-test" >>database ;
|
||||
|
||||
[ ] [ test-db [ ] with-db ] unit-test
|
||||
|
||||
|
@ -92,4 +93,4 @@ IN: db.postgresql.tests
|
|||
|
||||
|
||||
: with-dummy-db ( quot -- )
|
||||
>r T{ postgresql-db } db r> with-variable ;
|
||||
[ T{ postgresql-db } db ] dip with-variable ;
|
||||
|
|
|
@ -4,7 +4,7 @@ continuations db.types db.tuples unicode.case ;
|
|||
IN: db.sqlite.tests
|
||||
|
||||
: db-path "test.db" temp-file ;
|
||||
: test.db db-path sqlite-db ;
|
||||
: test.db db-path <sqlite-db> ;
|
||||
|
||||
[ ] [ [ db-path delete-file ] ignore-errors ] unit-test
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ destructors mirrors sets db.types ;
|
|||
IN: db.tuples
|
||||
|
||||
<PRIVATE
|
||||
! returns a sequence of prepared-statements
|
||||
|
||||
HOOK: create-sql-statement db ( class -- object )
|
||||
HOOK: drop-sql-statement db ( class -- object )
|
||||
|
||||
|
@ -65,6 +65,7 @@ GENERIC: eval-generator ( singleton -- object )
|
|||
|
||||
: do-count ( exemplar-tuple statement -- tuples )
|
||||
[ [ bind-tuple ] [ nip default-query ] 2bi ] with-disposal ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
|
||||
|
|
|
@ -182,9 +182,11 @@ http.server.dispatchers db.tuples ;
|
|||
[ stop-this-server "Goodbye" "text/html" <content> ] >>display
|
||||
"quit" add-responder ;
|
||||
|
||||
: test-db "test.db" temp-file <sqlite-db> ;
|
||||
: test-db-file "test.db" temp-file ;
|
||||
|
||||
[ test-db drop delete-file ] ignore-errors
|
||||
: test-db test-db-file <sqlite-db> ;
|
||||
|
||||
[ test-db-file delete-file ] ignore-errors
|
||||
|
||||
test-db [
|
||||
init-furnace-tables
|
||||
|
|
|
@ -26,7 +26,7 @@ webapps.user-admin
|
|||
webapps.help ;
|
||||
IN: websites.concatenative
|
||||
|
||||
: test-db ( -- params db ) "resource:test.db" <sqlite-db> ;
|
||||
: test-db ( -- db ) "resource:test.db" <sqlite-db> ;
|
||||
|
||||
: init-factor-db ( -- )
|
||||
test-db [
|
||||
|
|
Loading…
Reference in New Issue