Fixing bug in db (don't use unparse!), adding still-failing unit test

db4
Daniel Ehrenberg 2009-02-12 17:13:01 -06:00
parent ccfd9f9c52
commit c4f45e3f74
3 changed files with 25 additions and 2 deletions

View File

@ -48,7 +48,7 @@ M: retryable execute-statement* ( statement type -- )
: query-make ( class quot -- statements )
#! query, input, outputs, secondary queries
over unparse "table" set
over db-table "table" set
[ sql-props ] dip
[ 0 sql-counter rot with-variable ] curry
{ "" { } { } { } } nmake

View File

@ -95,3 +95,26 @@ things "THINGS" {
things drop-table
] with-db
] unit-test
! Tables can have different names than the name of the tuple
TUPLE: foo slot ;
C: <foo> foo
foo "BAR" { { "slot" "SOMETHING" INTEGER +not-null+ } } define-persistent
TUPLE: hi bye ;
C: <hi> hi
hi "HELLO"
{ { "bye" "BUHBYE" INTEGER { +foreign-id+ foo "SOMETHING" } } } define-persistent
[ T{ foo { slot 1 } } T{ hi { bye 1 } } ] [
test.db [
foo create-table
hi create-table
1 <foo> insert-tuple
f <foo> select-tuple
1 <hi> insert-tuple
f <hi> select-tuple
hi drop-table
foo drop-table
] with-db
] unit-test

View File

@ -165,7 +165,7 @@ ERROR: no-column column ;
: >reference-string ( string pair -- string )
first2
[ [ unparse " " glue ] [ db-columns ] bi ] dip
[ [ db-table " " glue ] [ db-columns ] bi ] dip
swap [ column-name>> = ] with find nip
[ no-column ] unless*
column-name>> "(" ")" surround append ;