Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » UltraLiteJ » UltraLiteJ Reference » UltraLiteJ API reference

 

TableSchema interface

Specifies the schema of a table and provides constants defining the names of system tables.

Syntax
public TableSchema
Remarks

An object supporting this interface is returned by the createTable function.

All tables must have at least one column and a primary key.

The following example demonstrates the creation of the schema for a simple database. The T2 table is created with two columns, a primary key, and an index.

// Assumes a valid Connection object conn
TableSchema table_schema;
IndexSchema index_schema;

table_schema = conn.createTable("T2");
table_schema.createColumn("num", Domain.INTEGER);
table_schema.createColumn("quantity", Domain.INTEGER);

index_schema = table_schema.createPrimaryIndex("primary");
index_schema.addColumn("num", IndexSchema.ASCENDING);
index_schema = table_schema.createIndex("index1");
index_schema.addColumn("quantity", IndexSchema.ASCENDING);

conn.schemaCreateComplete();

Primary keys uniquely identify each row in a table. Columns included in primary keys cannot allow nulls. Primary keys are created using createPrimaryIndex function.

A unique key is a constraint to identify one or more columns that uniquely identify each row in the table. No two rows in the table can have the same values in all the named column(s). A table may have more than one unique constraint. Primary keys are unique keys. Unique keys are created using createUniqueKey function.

A unique index ensures that there are not two rows in the table with identical values in all the columns in the index. Each index key must be unique or contain a null in at least one column. Unique indexes are created using createUniqueIndex function.

An unrestricted index allows duplicate index entries and null columns. Plain indexes are created using createIndex function.

Members

All members of TableSchema, including all inherited members.


SYS_ARTICLES variable
SYS_COLUMNS variable
SYS_FKEY_COLUMNS variable
SYS_FOREIGN_KEYS variable
SYS_INDEXES variable
SYS_INDEX_COLUMNS variable
SYS_INTERNAL variable
SYS_PRIMARY_INDEX variable
SYS_PUBLICATIONS variable
SYS_TABLES variable
TABLE_IS_NOSYNC variable
TABLE_IS_SYSTEM variable
createColumn method
createColumn method
createColumn method
createIndex method
createPrimaryIndex method
createUniqueIndex method
createUniqueKey method
setNoSync method