work on the sql types
parent
117a7b6643
commit
4b881bb3dd
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
} ;
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue