@Service(value=Backend.class) public class Db2 extends AbstractSql2003Backend
RESERVED_WORDS_SQL2003, SQL_WINDOW_1, SQL_WINDOW_2, SQL_WINDOW_LIMIT, SQL_WINDOW_OFFSETRESERVED_WORDS_SQL92, SQL_COALESCE, SQL_FOR_UPDATEEMPTY_STRING, TYPE_BIGINT, TYPE_BIT, TYPE_BLOB, TYPE_BOOL, TYPE_BOOLEAN, TYPE_BYTE, TYPE_BYTEA, TYPE_CHAR_1, TYPE_DATE, TYPE_DATETIME, TYPE_DATETIME_YEAR_TO_SECOND, TYPE_DECIMAL, TYPE_DECIMAL_19, TYPE_DOUBLE, TYPE_FLOAT, TYPE_FLOAT4, TYPE_FLOAT8, TYPE_INT, TYPE_INT2, TYPE_INT4, TYPE_INT8, TYPE_INTEGER, TYPE_NCHAR_1, TYPE_NUMBER, TYPE_NUMBER_1, TYPE_NUMBER_10, TYPE_NUMBER_19, TYPE_NUMBER_5, TYPE_NVARCHAR, TYPE_NVARCHAR_MAX, TYPE_REAL, TYPE_SMALLFLOAT, TYPE_SMALLINT, TYPE_TEXT, TYPE_TIME, TYPE_TIMESTAMP, TYPE_TINYINT, TYPE_VARBINARY_MAX, TYPE_VARCHARSQL_ALLSTAR, SQL_AND, SQL_ANDNOT, SQL_COMMA, SQL_COMMA_PAR, SQL_DELETE, SQL_EQUAL, SQL_EQUAL_PAR, SQL_EQUAL_PAR_COMMA, SQL_EQUAL_ZERO, SQL_EXISTS, SQL_FROM, SQL_GREATER, SQL_GREATER_PAR, SQL_GREATEROREQUAL, SQL_GREATEROREQUAL_PAR, SQL_GROUPBY, SQL_INSERT_INTO, SQL_INSERT_VALUES, SQL_ISNOTNULL, SQL_ISNULL, SQL_LEFT_PARENTHESIS, SQL_LESS, SQL_LESS_PAR, SQL_LESSOREQUAL, SQL_LESSOREQUAL_PAR, SQL_LIKE, SQL_LIKE_PAR, SQL_MAX, SQL_MIN, SQL_NOT, SQL_NOTEQUAL, SQL_NOTEQUAL_PAR, SQL_NOTEQUAL_ZERO, SQL_NOTLIKE, SQL_NOTLIKE_PAR, SQL_OR, SQL_ORDERBY, SQL_ORNOT, SQL_PAR, SQL_PAR_COMMA, SQL_PLUS_ONE, SQL_RIGHT_PARENTHESIS, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SET, SQL_SORTASC, SQL_SORTDESC, SQL_UPDATE, SQL_WHERE, SQL_WHEREALL, SQL_WHEREAND, SQL_WHERENOTHING, SQL_WHEREOR| Constructor and Description |
|---|
Db2() |
| Modifier and Type | Method and Description |
|---|---|
String |
getBackendId(Connection connection)
Determines the unique id or name used by the backend for a given connection.
|
String |
getDriverClassName()
Gets the JDBC driver class name.
|
int |
getMaxSize(SqlType sqlType)
Returns the maximum size for a given SQL-type.
|
String |
getName()
Gets the name of the backend.
|
boolean |
isMatchingUrl(String url)
Checks whether the backend belongs to the given jdbc url.
|
SqlType[] |
jdbcTypeToSqlType(int jdbcType,
int size,
int scale)
Converts the JDBC data type integer to a tentackle backend SqlTypes.
|
String |
sqlAddColumn(String tableName,
String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Generates sql code to add a column.
|
String |
sqlAlterColumnType(String tableName,
String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Generates sql code to change the datatype of a column.
|
String |
sqlCreateColumn(String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue,
boolean primaryKey,
boolean withTrailingComma)
Generates the attribute definition of a CREATE TABLE statement.
|
String |
sqlCreateColumnComment(String tableName,
String columnName,
String comment)
Generates SQL code to create the comment for an attribute.
|
String |
sqlCreateTableComment(String tableName,
String comment)
Generates SQL code to create the comment for a table.
|
String |
sqlCreateTableIntro(String tableName,
String comment)
Generates the first line of a CREATE TABLE statement.
|
boolean |
sqlResultSetIsClosedSupported()
Determines whether the jdbc driver supports
ResultSet.isClosed(). |
String |
sqlTypeToString(SqlType sqlType,
int size)
Converts the java SQL-type to the database type name.
|
buildSelectSql, getReservedWords, setLeadingSelectParameters, setTrailingSelectParameters, sqlNextFromSequene, supportsSequencesgetCoalesceKeyword, sqlCreateForeignKey, sqlDropForeignKeyallowsExpressionsReferringToTablesBeingUpdated, assertValidName, buildSelectSql, columnTypeNullDefaultToString, columnTypeToString, createColumnMetaData, createConnection, createIndexColumnMetaData, createIndexMetaData, createTableMetaData, extractWhereClause, getDefaultSchema, getDefaultSize, getEmptyString, getMaxScale, getMetaData, getMigrationStrategy, getModelMetaData, getTableMetaData, isCommunicationLinkException, isConstraintException, isDefaultEqual, isMatchingName, isReleaseSavepointSupported, isTemporaryName, needAliasForSubselect, needSetLongWorkaround, needTxForFetchsize, normalizeDefault, optimizeSql, sqlAlterColumnComment, sqlAlterColumnDefault, sqlAlterColumnNullConstraint, sqlAlterTableComment, sqlAsBeforeTableAlias, sqlComment, sqlCreateIndex, sqlCreateTableAttributeWithoutComment, sqlCreateTableClosing, sqlCreateTableIntroWithoutComment, sqlDropColumn, sqlDropIndex, sqlFunction, sqlJoin, sqlJoinSelects, sqlJoinSelects, sqlRenameAndAlterColumnType, sqlRenameColumn, sqlRequiresExtraCommit, sqlUpdateToNotNull, toQuotedString, toString, valueToLiteralpublic boolean isMatchingUrl(String url)
Backendurl - the jdbc urlpublic String getName()
Backendpublic String getDriverClassName()
Backendpublic boolean sqlResultSetIsClosedSupported()
BackendResultSet.isClosed().sqlResultSetIsClosedSupported in interface BackendsqlResultSetIsClosedSupported in class AbstractBackendpublic int getMaxSize(SqlType sqlType)
BackendgetMaxSize in interface BackendgetMaxSize in class AbstractBackendsqlType - the SQL-typepublic String getBackendId(Connection connection)
Backend
Useful to figure out the corresponding ManagedConnection from the backend's logfiles.
connection - the jdbc connectionpublic String sqlCreateTableIntro(String tableName, String comment)
BackendsqlCreateTableIntro in interface BackendsqlCreateTableIntro in class AbstractBackendtableName - the tablename with optional schema separated by a dotcomment - optional comment, null if nonepublic String sqlTypeToString(SqlType sqlType, int size)
BackendsqlTypeToString in interface BackendsqlTypeToString in class AbstractBackendsqlType - the java sql typesize - the column's sizepublic SqlType[] jdbcTypeToSqlType(int jdbcType, int size, int scale)
BackendThere may be more than one sqltype returned!
jdbcTypeToSqlType in interface BackendjdbcTypeToSqlType in class AbstractBackendjdbcType - the jdbc data typesize - the column sizescale - the column's scaleTypespublic String sqlCreateColumn(String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue, boolean primaryKey, boolean withTrailingComma)
BackendsqlCreateColumn in interface BackendsqlCreateColumn in class AbstractBackendcolumnName - the database column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueprimaryKey - true if this is a primary keywithTrailingComma - true if append a commapublic String sqlCreateTableComment(String tableName, String comment)
BackendsqlCreateTableComment in interface BackendsqlCreateTableComment in class AbstractBackendtableName - the table namecomment - optional comment, null if noneBackend.sqlCreateTableIntro(java.lang.String, java.lang.String) or Backend.sqlCreateTableClosing(java.lang.String, java.lang.String)public String sqlCreateColumnComment(String tableName, String columnName, String comment)
BackendsqlCreateColumnComment in interface BackendsqlCreateColumnComment in class AbstractBackendtableName - the table namecolumnName - the column namecomment - optional comment, null if noneBackend.sqlCreateColumn(java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object, boolean, boolean)public String sqlAddColumn(String tableName, String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
BackendsqlAddColumn in interface BackendsqlAddColumn in class AbstractBackendtableName - the tablenamecolumnName - the new column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valuepublic String sqlAlterColumnType(String tableName, String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
BackendsqlAlterColumnType in interface BackendsqlAlterColumnType in class AbstractBackendtableName - the tablenamecolumnName - the new column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueTentackle - a domain driven enterprise framework