public class TableImpl extends java.lang.Object implements Table
Modifier and Type | Class and Description |
---|---|
static class |
TableImpl.NameImpl |
Table.Name
Modifier | Constructor and Description |
---|---|
protected |
TableImpl(Schema pSchema,
Table.Name pName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
Column |
getColumn(Column.Name pName)
Returns the column with the given name or null,
if no such column exists.
|
Column |
getColumn(java.lang.String pName)
Returns the column with the given name or null,
if no such column exists.
|
java.util.Iterator |
getColumns()
Returns the table columns.
|
DeleteStatement |
getDeleteStatement()
Returns an UPDATE statement for updating a column in the table.
|
java.util.Iterator |
getForeignKeys()
Returns an
Iterator to the foreign keys defined on the
table. |
java.util.Iterator |
getIndexes()
Returns an
Iterator to the indexes defined on the table. |
InsertStatement |
getInsertStatement()
Returns an INSERT statement for filling all the values.
|
Table.Name |
getName()
Returns the table name.
|
Index |
getPrimaryKey()
Returns the tables primary key, if any, or null, if the table
doesn't have a primary key.
|
java.lang.String |
getQName()
Returns the tables qualified name, which is
getSchema().getName() + "." + getName() . |
Schema |
getSchema()
Returns the table schema.
|
SelectStatement |
getSelectStatement()
Returns a SELECT statement for selecting all the columns.
|
UpdateStatement |
getUpdateStatement()
Returns an UPDATE statement for updating a column in the table.
|
int |
hashCode() |
Column |
newColumn(Column.Name pName,
Column.Type pType)
Creates a new column.
|
Column |
newColumn(java.lang.String pName,
Column.Type pType)
Creates a new column.
|
ForeignKey |
newForeignKey(Table pTable)
Creates a new foreign key referencing the given table.
|
Index |
newIndex()
Creates a new, non-unique index on the table.
|
Index |
newKey()
Creates a new, unique index on the table.
|
Index |
newPrimaryKey()
Creates a new primary key on the table.
|
protected TableImpl(Schema pSchema, Table.Name pName)
public Schema getSchema()
Table
Returns the table schema.
public Table.Name getName()
Table
Returns the table name.
public java.lang.String getQName()
Table
Returns the tables qualified name, which is
getSchema().getName() + "." + getName()
. If the
schema is the default schema, returns getName()
.
public java.util.Iterator getColumns()
Table
Returns the table columns.
getColumns
in interface Table
public Column newColumn(java.lang.String pName, Column.Type pType)
Table
Creates a new column.
public Column newColumn(Column.Name pName, Column.Type pType)
Table
Creates a new column.
public Column getColumn(Column.Name pName)
Table
Returns the column with the given name or null, if no such column exists.
public Column getColumn(java.lang.String pName)
Table
Returns the column with the given name or null, if no such column exists.
public Index newKey()
Table
Creates a new, unique index on the table.
public Index newIndex()
Table
Creates a new, non-unique index on the table.
public Index getPrimaryKey()
Table
Returns the tables primary key, if any, or null, if the table doesn't have a primary key.
getPrimaryKey
in interface Table
public java.util.Iterator getIndexes()
Table
Returns an Iterator
to the indexes defined on the table.
This iterator includes the primary key, if any.
getIndexes
in interface Table
public Index newPrimaryKey()
Table
Creates a new primary key on the table.
newPrimaryKey
in interface Table
public java.util.Iterator getForeignKeys()
Table
Returns an Iterator
to the foreign keys defined on the
table.
getForeignKeys
in interface Table
public ForeignKey newForeignKey(Table pTable)
Table
Creates a new foreign key referencing the given table.
newForeignKey
in interface Table
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public InsertStatement getInsertStatement()
Table
Returns an INSERT statement for filling all the values. In
other words: If the table FOO has the columns A, B, and C,
then the statement INSERT INTO FOO (A,B,C) VALUES (?, ?, ?)
will be returned.
getInsertStatement
in interface Table
SQLFactory.newInsertStatement()
public SelectStatement getSelectStatement()
Table
Returns a SELECT statement for selecting all the columns. In
other words: If the table FOO has the columns A, B, and C,
then the statement SELECT A, B, C FROM FOO
will
be returned.
getSelectStatement
in interface Table
SQLFactory.newSelectStatement()
public UpdateStatement getUpdateStatement()
Table
Returns an UPDATE statement for updating a column in the table.
In other words: If the table FOO has the columns A, B, C and D
with the primary key columns A and B, then the statement
UPDATE FOO SET C = ?, D = ? WHERE A = ? AND B = ?
will be returned.
getUpdateStatement
in interface Table
SQLFactory.newUpdateStatement()
public DeleteStatement getDeleteStatement()
Table
Returns an UPDATE statement for updating a column in the table.
In other words: If the table FOO has the primary key columns A and B,
then the statement DELETE FROM FOO WHERE A = ? AND B = ?
will be returned.
getDeleteStatement
in interface Table
SQLFactory.newDeleteStatement()