add a test to make sure assigned ids can't be inserted twice
fix a bug with sqlite finalizersdb4
parent
ed7af26003
commit
382868b362
|
@ -106,6 +106,8 @@ IN: db.sqlite.lib
|
|||
: sqlite-reset ( handle -- ) sqlite3_reset sqlite-check-result ;
|
||||
: sqlite-#columns ( query -- int ) sqlite3_column_count ;
|
||||
: sqlite-column ( handle index -- string ) sqlite3_column_text ;
|
||||
: sqlite-column-name ( handle index -- string ) sqlite3_column_name ;
|
||||
: sqlite-column-type ( handle index -- string ) sqlite3_column_type ;
|
||||
|
||||
: sqlite-column-blob ( handle index -- byte-array/f )
|
||||
[ sqlite3_column_bytes ] 2keep
|
||||
|
@ -140,7 +142,7 @@ IN: db.sqlite.lib
|
|||
: sqlite-row ( handle -- seq )
|
||||
dup sqlite-#columns [ sqlite-column ] with map ;
|
||||
|
||||
: sqlite-step-has-more-rows? ( step-result -- bool )
|
||||
: sqlite-step-has-more-rows? ( prepared -- bool )
|
||||
dup SQLITE_ROW = [
|
||||
drop t
|
||||
] [
|
||||
|
|
|
@ -38,7 +38,8 @@ M: sqlite-db <prepared-statement> ( str in out -- obj )
|
|||
sqlite-statement construct-delegate ;
|
||||
|
||||
M: sqlite-statement dispose ( statement -- )
|
||||
statement-handle sqlite-finalize ;
|
||||
statement-handle
|
||||
[ sqlite3_reset drop ] keep sqlite-finalize ;
|
||||
|
||||
M: sqlite-result-set dispose ( result-set -- )
|
||||
f swap set-result-set-handle ;
|
||||
|
|
|
@ -193,8 +193,17 @@ TUPLE: annotation n paste-id summary author mode contents ;
|
|||
[ native-person-schema test-tuples ] test-sqlite
|
||||
[ assigned-person-schema test-tuples ] test-sqlite
|
||||
|
||||
! [ native-person-schema test-tuples ] test-postgresql
|
||||
! [ assigned-person-schema test-tuples ] test-postgresql
|
||||
: test-repeated-insert
|
||||
[ ] [ person ensure-table ] unit-test
|
||||
|
||||
[ ] [ person1 get insert-tuple ] unit-test
|
||||
[ person1 get insert-tuple ] must-fail ;
|
||||
|
||||
[ native-person-schema test-tuples ] test-postgresql
|
||||
[ assigned-person-schema test-tuples ] test-postgresql
|
||||
|
||||
[ assigned-person-schema test-repeated-insert ] test-sqlite
|
||||
[ assigned-person-schema test-repeated-insert ] test-postgresql
|
||||
|
||||
TUPLE: serialize-me id data ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue