Fixing bug in db (don't use unparse!), adding still-failing unit test
parent
ccfd9f9c52
commit
c4f45e3f74
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ;
|
||||
|
|
Loading…
Reference in New Issue