@Service(value=Backend.class) public class Informix extends AbstractSql92Backend
| Modifier and Type | Field and Description |
|---|---|
static String |
SQL_FIRST
FIRST string.
|
static String |
SQL_FIRST_PAR
FIRST string.
|
static String |
SQL_NVL
NVL keyword.
|
static String |
SQL_SKIP
SKIP string.
|
static String |
SQL_SKIP_PAR
SKIP string.
|
RESERVED_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_ALTER_COLUMN, SQL_ALTER_TABLE, 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_IF_EXISTS, 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 |
|---|
Informix() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildSelectSql(StringBuilder sqlBuilder,
boolean writeLock,
int limit,
int offset)
Creates a select statement string from an inner sql string.
|
Connection |
createConnection(String url,
String username,
char[] password)
Creates a jdbc connection.
|
protected String |
extractWhereClause(String sql,
int whereOffset)
Extracts the where clause from a given sql.
|
String |
getBackendId(Connection connection)
Determines the unique id or name used by the backend for a given connection.
|
String |
getCoalesceKeyword()
Gets the keyword for the COALESCE function.
|
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.
|
protected boolean |
isDropIfExistsSupported()
Adds "IF EXISTS" to drop clauses, if supported by the backend.
Makes migration a little more robust in case the same SQL scripts are applied to different databases than those used to generate the migration scripts for. |
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.
|
int |
setLeadingSelectParameters(BackendPreparedStatement stmt,
int limit,
int offset)
Sets optional parameters before applying the original parameters.
|
int |
setTrailingSelectParameters(BackendPreparedStatement stmt,
int index,
int limit,
int offset)
Sets optional parameters after applying the original parameters.
|
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 |
sqlAlterColumnDefault(String tableName,
String columnName,
SqlType sqlType,
Object defaultValue)
Generates sql code to change the default value 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 |
sqlDropColumn(String tableName,
String columnName)
Generates sql code to drop a column.
|
String |
sqlNextFromSequene(String name)
Creates the SQL string to retrieve the next id from a sequence.
|
String |
sqlRenameColumn(String tableName,
String oldColumnName,
String newColumnName)
Generates sql code to rename a column.
|
String |
sqlTypeToString(SqlType sqlType,
int size)
Converts the java SQL-type to the database type name.
|
boolean |
supportsSequences()
True if backend provides transactionless sequences.
|
getReservedWords, sqlCreateForeignKey, sqlDropForeignKeyallowsExpressionsReferringToTablesBeingUpdated, assertValidName, buildSelectSql, columnTypeNullDefaultToString, columnTypeToString, createColumnMetaData, createIndexColumnMetaData, createIndexMetaData, createTableMetaData, getDefaultSchema, getDefaultSize, getEmptyString, getMaxScale, getMetaData, getMigrationStrategy, getModelMetaData, getTableMetaData, isCommunicationLinkException, isConstraintException, isDefaultEqual, isDropIfExistsEnabled, isMatchingName, isReleaseSavepointSupported, isTemporaryName, needAliasForSubselect, needSetLongWorkaround, needTxForFetchsize, normalizeDefault, optimizeSql, setDropIfExistsEnabled, sqlAlterColumnComment, sqlAlterColumnNullConstraint, sqlAlterTableComment, sqlAsBeforeTableAlias, sqlComment, sqlCreateColumn, sqlCreateColumnComment, sqlCreateIndex, sqlCreateTableAttributeWithoutComment, sqlCreateTableClosing, sqlCreateTableComment, sqlCreateTableIntro, sqlCreateTableIntroWithoutComment, sqlDropIndex, sqlFunction, sqlJoin, sqlJoinSelects, sqlJoinSelects, sqlRenameAndAlterColumnType, sqlRequiresExtraCommit, sqlResultSetIsClosedSupported, sqlUpdateToNotNull, toQuotedString, toString, valueToLiteralpublic static final String SQL_NVL
public static final String SQL_FIRST
public static final String SQL_SKIP
public static final String SQL_FIRST_PAR
public static final String SQL_SKIP_PAR
public boolean isMatchingUrl(String url)
Backendurl - the jdbc urlpublic String getName()
Backendpublic String getDriverClassName()
Backendpublic String getBackendId(Connection connection)
Backend
Useful to figure out the corresponding ManagedConnection from the backend's logfiles.
connection - the jdbc connectionpublic Connection createConnection(String url, String username, char[] password) throws SQLException
BackendcreateConnection in interface BackendcreateConnection in class AbstractBackendurl - the jdbc urlusername - the usernamepassword - the passwordSQLException - if connection could not be establishedpublic String getCoalesceKeyword()
BackendgetCoalesceKeyword in interface BackendgetCoalesceKeyword in class AbstractSql92Backendpublic void buildSelectSql(StringBuilder sqlBuilder, boolean writeLock, int limit, int offset)
Backend
sqlBuilder is anything as FROM... WHERE... ORDER BY....
It is decorated with a leading SELECT plus optional clauses
like for the given parameters.
buildSelectSql in interface BackendbuildSelectSql in class AbstractSql92BackendsqlBuilder - the sql builder, initially containing the inner sql without leading SELECT.writeLock - true select should write locklimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clausepublic int setLeadingSelectParameters(BackendPreparedStatement stmt, int limit, int offset)
BackendsetLeadingSelectParameters in interface BackendsetLeadingSelectParameters in class AbstractSql92Backendstmt - the prepared statementlimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clausepublic int setTrailingSelectParameters(BackendPreparedStatement stmt, int index, int limit, int offset)
BackendsetTrailingSelectParameters in interface BackendsetTrailingSelectParameters in class AbstractSql92Backendstmt - the prepared statementindex - the first parameter indexlimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clausepublic int getMaxSize(SqlType sqlType)
BackendgetMaxSize in interface BackendgetMaxSize in class AbstractBackendsqlType - the SQL-typepublic 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 boolean supportsSequences()
BackendsupportsSequences in interface BackendsupportsSequences in class AbstractSql92Backendpublic String sqlNextFromSequene(String name)
BackendsqlNextFromSequene in interface BackendsqlNextFromSequene in class AbstractSql92Backendname - the name of the sequencepublic String sqlRenameColumn(String tableName, String oldColumnName, String newColumnName)
BackendsqlRenameColumn in interface BackendsqlRenameColumn in class AbstractBackendtableName - the tablenameoldColumnName - the old column namenewColumnName - the new column namepublic 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 sqlDropColumn(String tableName, String columnName)
BackendsqlDropColumn in interface BackendsqlDropColumn in class AbstractBackendtableName - the tablenamecolumnName - the new column namepublic 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 valuepublic String sqlAlterColumnDefault(String tableName, String columnName, SqlType sqlType, Object defaultValue)
BackendsqlAlterColumnDefault in interface BackendsqlAlterColumnDefault in class AbstractBackendtableName - the tablenamecolumnName - the new column namesqlType - the JDBC sql typedefaultValue - the optional default valueBackend.sqlAlterColumnType(java.lang.String, java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object)protected String extractWhereClause(String sql, int whereOffset)
AbstractBackendextractWhereClause in class AbstractBackendsql - the sql statementwhereOffset - the location of WHERE in sqlprotected boolean isDropIfExistsSupported()
AbstractBackendisDropIfExistsSupported in class AbstractBackendTentackle - distributed, domain- and model-driven