|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.jdbc2xml.schema.impl.DerbyDialect
public class DerbyDialect
This class implements Dialect for Derby 10.x
Field Summary | |
---|---|
static String |
defaultDriverName
|
Constructor Summary | |
---|---|
DerbyDialect()
|
Method Summary | |
---|---|
String |
constructJDBCURL(String hostname,
Integer port,
String databaseName,
Properties properties)
Constructs a JDBC URL for the dialect; all parameters may be null, default values are used then. |
String |
createColumnSpec(ColumnInfo columnInfo)
Computes a string to feed a CREATE TABLE or ALTER TABLE ADD COLUMN statement, or returns null if the type is unsupported by the underlying DBMS or by the Dialect implementation. |
String |
defaultDriverName()
|
void |
fetchAdditionalColumnInfo(ISchemaEngine schemaEngine,
TableInfo ti,
ColumnInfo ci)
Hook to fetch additional, Dialect specific column information (e.g. auto increment). |
String |
getID()
TODO externalize id-strings to class/enum |
int |
getMappedSqlType(String dialectDataType)
Get the JDBC SQL type for a specified dialect specific type. |
String |
normalizeDefaultValue(int type,
String s)
Normalize a default value returned by DatabaseMetaData.getColumns(String, String, String, String)
in the column COLUMN_DEF . |
void |
pushAddColumn(SqlCommandQueue queue,
TableInfo ti,
ColumnInfo ci)
Push the add column command to a command queue. |
void |
pushAddForeignKey(SqlCommandQueue queue,
TableInfo ti,
ForeignKeyInfo fki)
Push the add foreign key command to a command queue. |
void |
pushAddIndex(SqlCommandQueue queue,
TableInfo ti,
IndexInfo indexInfo)
Push the add index command to a command queue. |
void |
pushChangeColumn(ISchemaEngine schemaEngine,
SqlCommandQueue queue,
TableInfo ti,
ColumnInfo oldColumnInfo,
ColumnInfo newColumnInfo)
Rename and change the datatype of a database column. |
void |
pushCreateTable(ISchemaEngine schemaEngine,
SqlCommandQueue queue,
TableInfo ti)
Push the create table command to a command queue. |
void |
pushDropColumn(ISchemaEngine schema,
SqlCommandQueue queue,
TableInfo ti,
ColumnInfo ci,
boolean force)
Push the drop column command to a command queue. |
void |
pushDropForeignKey(SqlCommandQueue queue,
TableInfo ti,
ForeignKeyInfo fki)
Push the drop foreign key command to a command queue. |
void |
pushDropIndex(SqlCommandQueue queue,
TableInfo ti,
IndexInfo indexInfo)
Push the drop index command to a command queue. |
void |
pushDropTable(ISchemaEngine schemaEngine,
SqlCommandQueue queue,
TableInfo ti,
boolean force)
Push the drop table command to a command queue. |
void |
pushModifyColumn(ISchemaEngine schemaEngine,
SqlCommandQueue queue,
TableInfo ti,
ColumnInfo oldColumnInfo,
ColumnInfo newColumnInfo)
Modify the datatype of a database column. |
void |
pushRenameTable(ISchemaEngine schemaEngine,
SqlCommandQueue queue,
TableInfo ti,
String newTableName)
Push a rename table command to a command queue. |
void |
quoteString(StringBuffer sb,
String s)
Quote the given string to the string buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String defaultDriverName
Constructor Detail |
---|
public DerbyDialect()
Method Detail |
---|
public String getID()
Dialect
getID
in interface Dialect
public void pushCreateTable(ISchemaEngine schemaEngine, SqlCommandQueue queue, TableInfo ti)
Dialect
pushCreateTable
in interface Dialect
schemaEngine
- The SchemaEngine.queue
- The queue to push to.ti
- The table info for which to push the create table command.public void pushRenameTable(ISchemaEngine schemaEngine, SqlCommandQueue queue, TableInfo ti, String newTableName) throws SQLException
Dialect
pushRenameTable
in interface Dialect
schemaEngine
- The SchemaEngine.queue
- The queue to push to.ti
- The table info for which to push the rename table command.newTableName
- The new name of the table after the rename operation.b
SQLException
public void pushDropTable(ISchemaEngine schemaEngine, SqlCommandQueue queue, TableInfo ti, boolean force)
Dialect
pushDropTable
in interface Dialect
schemaEngine
- The SchemaEngine.queue
- The queue to push to.ti
- The table info for which to push the drop table command.force
- If set to true, the data is not backed up before dropping the
table. Consequently, rollback is not supported, if
force
is set to true.public String createColumnSpec(ColumnInfo columnInfo)
Dialect
createColumnSpec
in interface Dialect
public String defaultDriverName()
defaultDriverName
in interface Dialect
public void quoteString(StringBuffer sb, String s)
Dialect
quoteString
in interface Dialect
sb
- The buffer to write to.s
- the String to quote.public String normalizeDefaultValue(int type, String s)
Dialect
DatabaseMetaData.getColumns(String, String, String, String)
in the column COLUMN_DEF
.
Some database engines return the default value in a quoted manner, so
we must perform unquoting here.
normalizeDefaultValue
in interface Dialect
type
- The java.sql.Types constant of the column type.s
- The string to normalize.
public void pushAddForeignKey(SqlCommandQueue queue, TableInfo ti, ForeignKeyInfo fki) throws SQLException
Dialect
pushAddForeignKey
in interface Dialect
queue
- The queue to push to.ti
- The table info for which to push the add foreign key command.fki
- The foreign key description.
SQLException
public void pushDropForeignKey(SqlCommandQueue queue, TableInfo ti, ForeignKeyInfo fki) throws SQLException
Dialect
pushDropForeignKey
in interface Dialect
queue
- The queue to push to.ti
- The table info for which to push the drop foreign key command.fki
- The foreign key description.
SQLException
public void pushAddIndex(SqlCommandQueue queue, TableInfo ti, IndexInfo indexInfo) throws SQLException
Dialect
pushAddIndex
in interface Dialect
queue
- The queue to push to.ti
- The table info for which to push the add index command.indexInfo
- The index description.
SQLException
public void pushDropIndex(SqlCommandQueue queue, TableInfo ti, IndexInfo indexInfo) throws SQLException
Dialect
pushDropIndex
in interface Dialect
queue
- The queue to push to.ti
- The table info for which to push the drop index command.indexInfo
- The index description.
SQLException
public void pushAddColumn(SqlCommandQueue queue, TableInfo ti, ColumnInfo ci) throws SQLException
Dialect
pushAddColumn
in interface Dialect
queue
- The queue to push to.ti
- The table info for which to push the add column command.ci
- The column description.
SQLException
public void pushDropColumn(ISchemaEngine schema, SqlCommandQueue queue, TableInfo ti, ColumnInfo ci, boolean force) throws SQLException
Dialect
pushDropColumn
in interface Dialect
schema
- The SchemaEngine.queue
- The queue to push to.ti
- The table info for which to push the add column command.ci
- The column description.force
- f set to true, the data is not backed up before dropping the
column. Consequently, rollback is not supported, if
force
is set to true.
SQLException
public void pushChangeColumn(ISchemaEngine schemaEngine, SqlCommandQueue queue, TableInfo ti, ColumnInfo oldColumnInfo, ColumnInfo newColumnInfo) throws SQLException
Dialect
pushChangeColumn
in interface Dialect
schemaEngine
- The SchemaEngine.queue
- The queue to push to.ti
- The description of the database table.oldColumnInfo
- The original column info of the column to be changed.newColumnInfo
- The destination column info carrying the new column name and the new datatype.
SQLException
public void pushModifyColumn(ISchemaEngine schemaEngine, SqlCommandQueue queue, TableInfo ti, ColumnInfo oldColumnInfo, ColumnInfo newColumnInfo) throws SQLException
Dialect
pushModifyColumn
in interface Dialect
schemaEngine
- The SchemaEngine.queue
- The queue to push to.ti
- The description of the database table.oldColumnInfo
- The column info as represented by the current schema.newColumnInfo
- The column information carrying the column name and the new datatype.
SQLException
public String constructJDBCURL(String hostname, Integer port, String databaseName, Properties properties)
Dialect
constructJDBCURL
in interface Dialect
hostname
- Name of the host to connect to, use null get the default value "localhost" for Client/Server resp. non-net URLs for integrated engines.port
- IP port to connect to, use null to use the dialect specific default port for Client/Server resp. non-net URLs for integrated engines.databaseName
- name of the database to connect to, use null to connect w/o a certain databaseproperties
- Properties to add to the URL, usually for tweaking the JDBC driver, may be null.
public int getMappedSqlType(String dialectDataType)
Dialect
getMappedSqlType
in interface Dialect
dialectDataType
- String representation of dialect specific type.
Types
public void fetchAdditionalColumnInfo(ISchemaEngine schemaEngine, TableInfo ti, ColumnInfo ci)
Dialect
fetchAdditionalColumnInfo
in interface Dialect
schemaEngine
- The calling SchemaEngine
ti
- The TableInfo
ci
- The ColumnInfo
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |