work on the sql types
parent
117a7b6643
commit
4b881bb3dd
|
@ -123,7 +123,7 @@ basket "BASKET"
|
||||||
|
|
||||||
! Create table
|
! 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 [
|
T{ sqlite-db } db [
|
||||||
puppy dup db-columns swap db-table create-sql >lower
|
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 )
|
M: sqlite-db compound-modifier ( str obj -- newstr )
|
||||||
drop ;
|
compound-type ;
|
||||||
|
|
||||||
M: sqlite-db compound-type ( str seq -- newstr )
|
M: sqlite-db compound-type ( str seq -- newstr )
|
||||||
over {
|
over {
|
||||||
! { "varchar" [ first number>string join-space ] }
|
{ "default" [ first number>string join-space ] }
|
||||||
[ drop ] ! "no sqlite compound data type" 3array throw ]
|
[ 2drop ] ! "no sqlite compound data type" 3array throw ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
M: sqlite-db type-table ( -- assoc )
|
M: sqlite-db type-table ( -- assoc )
|
||||||
|
@ -191,7 +191,7 @@ M: sqlite-db type-table ( -- assoc )
|
||||||
{ +native-id+ "integer primary key" }
|
{ +native-id+ "integer primary key" }
|
||||||
{ INTEGER "integer" }
|
{ INTEGER "integer" }
|
||||||
{ TEXT "text" }
|
{ TEXT "text" }
|
||||||
{ VARCHAR "varchar" }
|
{ VARCHAR "text" }
|
||||||
{ TIMESTAMP "timestamp" }
|
{ TIMESTAMP "timestamp" }
|
||||||
{ DOUBLE "real" }
|
{ DOUBLE "real" }
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -104,8 +104,6 @@ TUPLE: no-sql-modifier ;
|
||||||
! PostgreSQL Types:
|
! PostgreSQL Types:
|
||||||
! http://developer.postgresql.org/pgdocs/postgres/datatype.html
|
! http://developer.postgresql.org/pgdocs/postgres/datatype.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HOOK: modifier-table db ( -- hash )
|
HOOK: modifier-table db ( -- hash )
|
||||||
HOOK: compound-modifier db ( str seq -- hash )
|
HOOK: compound-modifier db ( str seq -- hash )
|
||||||
|
|
||||||
|
@ -142,7 +140,6 @@ HOOK: compound-type db ( str n -- hash )
|
||||||
[ nip ] [ drop lookup-type* ] if
|
[ nip ] [ drop lookup-type* ] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
USE: prettyprint
|
|
||||||
: lookup-type ( obj create? -- str )
|
: lookup-type ( obj create? -- str )
|
||||||
[ lookup-create-type ] [ lookup-type* ] if ;
|
[ lookup-create-type ] [ lookup-type* ] if ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue