]> gitweb.factorcode.org Git - factor.git/commitdiff
Fixing bug in db (don't use unparse!), adding still-failing unit test
authorDaniel Ehrenberg <littledan@Macintosh-103.local>
Thu, 12 Feb 2009 23:13:01 +0000 (17:13 -0600)
committerDaniel Ehrenberg <littledan@Macintosh-103.local>
Thu, 12 Feb 2009 23:13:01 +0000 (17:13 -0600)
basis/db/queries/queries.factor
basis/db/sqlite/sqlite-tests.factor
basis/db/types/types.factor

index 495c25ea682add21141a2db21d66b9c1d1f8c723..c714f43687d8ad7620f2a1f260bde4679f2508ab 100755 (executable)
@@ -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
index 69d5f1dd430f951398c7f298cdd0a09fa4de243e..657415c04862e0309b1cc3d299575a2befbfac35 100644 (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
index b5a7db987ac2dd9fb31f1c121ae23007a9e5762b..51e4b42bdc46f4756170932e5279ddecede7d7a2 100755 (executable)
@@ -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 ;