work on the sql types

db4
Doug Coleman 2008-02-20 18:30:55 -06:00
parent 117a7b6643
commit 4b881bb3dd
3 changed files with 5 additions and 8 deletions

2
extra/db/sqlite/sqlite-tests.factor Normal file → Executable file
View File

@ -123,7 +123,7 @@ basket "BASKET"
! Create table
[
"create table puppy(id integer primary key not null, name varchar 256, age integer);"
"create table puppy(id integer primary key not null, name varchar, age integer);"
] [
T{ sqlite-db } db [
puppy dup db-columns swap db-table create-sql >lower

View File

@ -178,12 +178,12 @@ M: sqlite-db modifier-table ( -- hashtable )
} ;
M: sqlite-db compound-modifier ( str obj -- newstr )
drop ;
compound-type ;
M: sqlite-db compound-type ( str seq -- newstr )
over {
! { "varchar" [ first number>string join-space ] }
[ drop ] ! "no sqlite compound data type" 3array throw ]
{ "default" [ first number>string join-space ] }
[ 2drop ] ! "no sqlite compound data type" 3array throw ]
} case ;
M: sqlite-db type-table ( -- assoc )
@ -191,7 +191,7 @@ M: sqlite-db type-table ( -- assoc )
{ +native-id+ "integer primary key" }
{ INTEGER "integer" }
{ TEXT "text" }
{ VARCHAR "varchar" }
{ VARCHAR "text" }
{ TIMESTAMP "timestamp" }
{ DOUBLE "real" }
} ;

View File

@ -104,8 +104,6 @@ TUPLE: no-sql-modifier ;
! PostgreSQL Types:
! http://developer.postgresql.org/pgdocs/postgres/datatype.html
HOOK: modifier-table db ( -- hash )
HOOK: compound-modifier db ( str seq -- hash )
@ -142,7 +140,6 @@ HOOK: compound-type db ( str n -- hash )
[ nip ] [ drop lookup-type* ] if
] if ;
USE: prettyprint
: lookup-type ( obj create? -- str )
[ lookup-create-type ] [ lookup-type* ] if ;