Specifies the schema of a column.
public ColumnSchema
An object supporting this interface is returned by the TableSchema.createColumn(String.short), TableSchema.createColumn(String,short,int) and TableSchema.createColumn(String,short,int,int) methods.
The following example demonstrates the creation of the schema for a simple database. The T1 table is created with a primary key integer column which is auto-incrementing.
// Assumes a valid Connection object TableSchema table_schema; ColumnSchema col_schema; IndexSchema index_schema; table_schema = conn.createTable("T1"); col_schema = table_schema.createColumn("num", Domain.INTEGER); col_schema.setDefault(ColumnSchema.COLUMN_DEFAULT_AUTOINC); // BIT columns are not nullable by default. col_schema = table_schema.createColumn("flag", Domain.BIT); col_schema.setNullable(true); col_schema = table_schema.createColumn( "cost", Domain.NUMERIC, 10, 2 ); col_schema.setNullable(false); index_schema = table_schema.createPrimaryIndex("primary"); index_schema.addColumn("num", IndexSchema.ASCENDING); conn.schemaCreateComplete(); |
All members of ColumnSchema, including all inherited members.
COLUMN_DEFAULT_AUTOINC variable
COLUMN_DEFAULT_CURRENT_DATE variable
COLUMN_DEFAULT_CURRENT_TIME variable
COLUMN_DEFAULT_CURRENT_TIMESTAMP variable
COLUMN_DEFAULT_GLOBAL_AUTOINC variable
COLUMN_DEFAULT_NONE variable
COLUMN_DEFAULT_UNIQUE_ID variable
setDefault function
setNullable function
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |