diff --git a/extra/db/db-tests.factor b/extra/db/db-tests.factor index 9c32f9e326..0d95e3aea7 100755 --- a/extra/db/db-tests.factor +++ b/extra/db/db-tests.factor @@ -3,3 +3,4 @@ USING: tools.test db kernel ; { 1 0 } [ [ drop ] query-each ] must-infer-as { 1 1 } [ [ ] query-map ] must-infer-as +{ 2 0 } [ [ ] with-db ] must-infer-as diff --git a/extra/db/db.factor b/extra/db/db.factor index 82193ed467..91128a7ffb 100755 --- a/extra/db/db.factor +++ b/extra/db/db.factor @@ -131,6 +131,7 @@ M: nonthrowable execute-statement* ( statement type -- ) : with-db ( db seq quot -- ) >r make-db db-open db r> [ db get swap [ drop ] swap compose with-disposal ] curry with-variable ; + inline : default-query ( query -- result-set ) query-results [ [ sql-row ] query-map ] with-disposal ; diff --git a/extra/db/tuples/tuples-tests.factor b/extra/db/tuples/tuples-tests.factor index 32562a4ae8..557241f3c9 100755 --- a/extra/db/tuples/tuples-tests.factor +++ b/extra/db/tuples/tuples-tests.factor @@ -40,7 +40,7 @@ SYMBOL: person4 [ 1 ] [ person1 get person-the-id ] unit-test - 200 person1 get set-person-the-number + [ ] [ 200 person1 get set-person-the-number ] unit-test [ ] [ person1 get update-tuple ] unit-test @@ -363,3 +363,6 @@ TUPLE: does-not-persist ; \ delete-tuple must-infer \ select-tuple must-infer \ define-persistent must-infer +\ ensure-table must-infer +\ create-table must-infer +\ drop-table must-infer diff --git a/extra/db/tuples/tuples.factor b/extra/db/tuples/tuples.factor index fd4cfb906f..ce2236d23b 100755 --- a/extra/db/tuples/tuples.factor +++ b/extra/db/tuples/tuples.factor @@ -105,7 +105,7 @@ M: retryable execute-statement* ( statement type -- ) [ with-disposal ] curry each ] [ with-disposal - ] if ; + ] if ; inline : create-table ( class -- ) create-sql-statement [ execute-statement ] with-disposals ;