]> gitweb.factorcode.org Git - factor.git/commitdiff
make all types singletons instead of symbols, add NULL support for select statements
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 11 Oct 2008 01:52:28 +0000 (20:52 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 11 Oct 2008 01:52:28 +0000 (20:52 -0500)
basis/db/queries/queries.factor
basis/db/tuples/tuples-tests.factor
basis/db/types/types.factor

index 768ec70185b2b51d3047fbc64f0420e69b1a1c02..3cf4d98215f5a02c14f8fce841f1b31cbd8f4522 100644 (file)
@@ -114,6 +114,9 @@ M: sequence where ( spec obj -- )
         [ " or " 0% ] [ dupd where ] interleave drop
     ] in-parens ;
 
+M: NULL where ( spec obj -- )
+    drop column-name>> 0% " is NULL" 0% ;
+
 : object-where ( spec obj -- )
     over column-name>> 0% " = " 0% bind# ;
 
index f5569a97cd3eda19a93b8fda6c4e4f91caa58a02..192986484ec022395227c33bacf4d06605342d72 100644 (file)
@@ -472,7 +472,12 @@ TUPLE: exam id name score ;
         T{ exam } select-tuples
     ] unit-test
 
-    [ 4 ] [ T{ exam } count-tuples ] unit-test ;
+    [ 4 ] [ T{ exam } count-tuples ] unit-test
+
+    [ ] [ T{ exam { score 10 } } insert-tuple ] unit-test
+
+    [ 10 ]
+    [ T{ exam { name NULL } } select-tuples first score>> ] unit-test ;
 
 TUPLE: bignum-test id m n o ;
 : <bignum-test> ( m n o -- obj )
index ad9c9b0acfa57aebf3ae422fddd106c55958ced6..6a889689ce0c91416706d77a169cbd2fd73cb29a 100644 (file)
@@ -91,7 +91,7 @@ ERROR: not-persistent class ;
 
 : relation? ( spec -- ? ) [ +has-many+ = ] deep-find ;
 
-SYMBOLS: INTEGER BIG-INTEGER SIGNED-BIG-INTEGER UNSIGNED-BIG-INTEGER
+SINGLETONS: INTEGER BIG-INTEGER SIGNED-BIG-INTEGER UNSIGNED-BIG-INTEGER
 DOUBLE REAL BOOLEAN TEXT VARCHAR DATE TIME DATETIME TIMESTAMP BLOB
 FACTOR-BLOB NULL URL ;