define-persistent ( class table columns -- )
High-level tuple/database integration » High-level tuple/database words

Next:create-table ( class -- )


Vocabulary
db.tuples

Inputs
classa class
tablea string
columnsan array of slot specifiers


Outputs
None

Word description
Defines a relation from a Factor tuple class to an SQL database table name. The format for the slot specifiers is as follows:
a slot name from the tuple class
the name of a database column that maps to the slot
a database type (see Database types)

Throws an error if the slot name (column one from each row) is not a slot in the tuple or its superclases.

Examples
USING: db.tuples db.types ; TUPLE: boat id year name ; boat "BOAT" { { "id" "ID" +db-assigned-id+ } { "year" "YEAR" INTEGER } { "name" "NAME" TEXT } } define-persistent


Definition