remove throwable conecpt from db

db4
Doug Coleman 2008-05-31 23:38:10 -05:00
parent b380e3ad35
commit 18f139394e
3 changed files with 6 additions and 28 deletions

View File

@ -39,31 +39,13 @@ TUPLE: statement handle sql in-params out-params bind-params bound? type ;
TUPLE: simple-statement < statement ;
TUPLE: prepared-statement < statement ;
SINGLETON: throwable
SINGLETON: nonthrowable
: make-throwable ( obj -- obj' )
dup sequence? [
[ make-throwable ] map
] [
throwable >>type
] if ;
: make-nonthrowable ( obj -- obj' )
dup sequence? [
[ make-nonthrowable ] map
] [
nonthrowable >>type
] if ;
TUPLE: result-set sql in-params out-params handle n max ;
: construct-statement ( sql in out class -- statement )
new
swap >>out-params
swap >>in-params
swap >>sql
throwable >>type ;
swap >>sql ;
HOOK: <simple-statement> db ( str in out -- statement )
HOOK: <prepared-statement> db ( str in out -- statement )
@ -81,12 +63,9 @@ GENERIC: more-rows? ( result-set -- ? )
GENERIC: execute-statement* ( statement type -- )
M: throwable execute-statement* ( statement type -- )
M: object execute-statement* ( statement type -- )
drop query-results dispose ;
M: nonthrowable execute-statement* ( statement type -- )
drop [ query-results dispose ] [ 2drop ] recover ;
: execute-statement ( statement -- )
dup sequence? [
[ execute-statement ] each

View File

@ -8,9 +8,8 @@ IN: db.queries
GENERIC: where ( specs obj -- )
: maybe-make-retryable ( statement -- statement )
dup in-params>> [ generator-bind? ] contains? [
make-retryable
] when ;
dup in-params>> [ generator-bind? ] contains?
[ make-retryable ] when ;
: query-make ( class quot -- )
>r sql-props r>

View File

@ -112,8 +112,8 @@ M: retryable execute-statement* ( statement type -- )
: recreate-table ( class -- )
[
drop-sql-statement make-nonthrowable
[ execute-statement ] with-disposals
[ drop-sql-statement [ execute-statement ] with-disposals
] curry ignore-errors
] [ create-table ] bi ;
: ensure-table ( class -- )