java.lang.Object
org.tentackle.sql.backends.AbstractBackend
org.tentackle.sql.backends.AbstractSql92Backend
org.tentackle.sql.backends.AbstractSql2003Backend
org.tentackle.sql.backends.Ingres
- All Implemented Interfaces:
Backend
Backend for Ingres.
- Author:
- harald
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFIRST string.static final StringFIRST string.Fields inherited from class org.tentackle.sql.backends.AbstractSql2003Backend
RESERVED_WORDS_SQL2003, SQL_WINDOW_1, SQL_WINDOW_2, SQL_WINDOW_LIMIT, SQL_WINDOW_OFFSETFields inherited from class org.tentackle.sql.backends.AbstractSql92Backend
RESERVED_WORDS_SQL92, SQL_COALESCE, SQL_FOR_UPDATEFields inherited from class org.tentackle.sql.backends.AbstractBackend
TYPE_BIGINT, TYPE_BIT, TYPE_BLOB, TYPE_BOOL, TYPE_BOOLEAN, TYPE_BYTE, TYPE_BYTEA, TYPE_CHAR_1, TYPE_CLOB, 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_VARCHARFields inherited from interface org.tentackle.sql.Backend
SQL_ALLSTAR, SQL_ALTER_COLUMN, SQL_ALTER_INDEX, SQL_ALTER_TABLE, SQL_AND, SQL_ANDNOT, SQL_ARRAY_ALL, SQL_ARRAY_ALL_PAR, SQL_ARRAY_ANY, SQL_ARRAY_ANY_PAR, SQL_ARRAY_IN, SQL_ARRAY_IN_PAR, SQL_ARRAY_NOT_IN, SQL_ARRAY_NOT_IN_PAR, SQL_ARRAY_PAR, 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildSelectSql(StringBuilder sqlBuilder, boolean writeLock, int limit, int offset) Creates a select statement string from an inner sql string.protected StringextractWhereClause(String sql, int whereOffset) Extracts the where clause from a given sql.getBackendId(Connection connection) Determines the unique id or name used by the backend for a given connection.Gets the JDBC driver class name.intgetMaxSize(SqlType sqlType) Returns the maximum size for a given SQL-type.getName()Gets the name of the backend.protected booleanAdds "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.booleanisMatchingUrl(String url) Checks whether the backend belongs to the given jdbc url.
If multiple backend implementations are provided for the same database type, only one backend should match the URL.SqlType[]jdbcTypeToSqlType(int jdbcType, int size, int scale) Converts the JDBC data type integer to a tentackle backend SqlTypes.booleanChecks whether we need a workaround for the (Ingres) setLong-Bug.intsetLeadingSelectParameters(BackendPreparedStatement stmt, int limit, int offset) Sets optional parameters before applying the original parameters.intsetTrailingSelectParameters(BackendPreparedStatement stmt, int index, int limit, int offset) Sets optional parameters after applying the original parameters.sqlCreateColumnComment(String tableName, String columnName, String comment) Generates SQL code to create the comment for an attribute.sqlCreateTableComment(String tableName, String comment) Generates SQL code to create the comment for a table.booleanAccording to the JDBC-specsConnection.setAutoCommit(boolean)(true) should commit, but some backends require an extraConnection.commit().sqlTypeToString(SqlType sqlType, int size) Converts the java SQL-type to the database type name.Methods inherited from class org.tentackle.sql.backends.AbstractSql2003Backend
getReservedWords, sqlNextFromSequene, supportsSequencesMethods inherited from class org.tentackle.sql.backends.AbstractSql92Backend
getCoalesceKeyword, sqlCreateForeignKey, sqlDropForeignKeyMethods inherited from class org.tentackle.sql.backends.AbstractBackend
allowsExpressionsReferringToTablesBeingUpdated, assertValidName, buildSelectSql, columnTypeNullDefaultToString, columnTypeToString, createColumnMetaData, createConnection, createIndexColumnMetaData, createIndexMetaData, createPassword, createTableMetaData, getDefaultSchema, getDefaultSize, getEmptyString, getMaxScale, getMetaData, getMigrationStrategy, getModelMetaData, getTableHeaders, getTableMetaData, isArrayOperatorSupported, isClobSupported, isCommunicationLinkException, isConstraintException, isDefaultEqual, isDropIfExistsEnabled, isExceptionErrorCodeMatching, isExceptionStateMatching, isExceptionStateStartingWith, isFilteredIndexSupported, isFunctionBasedIndexSupported, isMatchingName, isReleaseSavepointSupported, isReservedSchemaName, isReservedTableName, isTemporaryName, isTransientTransactionException, needAliasForSubselect, needTxForFetchsize, normalizeDefault, optimizeSql, setArray, setDropIfExistsEnabled, sqlAddColumn, sqlAlterColumnComment, sqlAlterColumnDefault, sqlAlterColumnNullConstraint, sqlAlterColumnType, sqlAlterTableComment, sqlAsBeforeTableAlias, sqlComment, sqlCreateColumn, sqlCreateIndex, sqlCreateTableAttributeWithoutComment, sqlCreateTableClosing, sqlCreateTableIntro, sqlCreateTableIntroWithoutComment, sqlDropColumn, sqlDropIndex, sqlDropTable, sqlFunction, sqlJoin, sqlJoinSelects, sqlJoinSelects, sqlRenameAndAlterColumnType, sqlRenameColumn, sqlRenameIndex, sqlRenameTable, sqlResultSetIsClosedSupported, sqlUpdateToNotNull, toInternalType, toQuotedString, toString, valueToLiteral
-
Field Details
-
SQL_FIRST
FIRST string.- See Also:
-
SQL_FIRST_PAR
FIRST string.- See Also:
-
-
Constructor Details
-
Ingres
public Ingres()
-
-
Method Details
-
isMatchingUrl
Description copied from interface:BackendChecks whether the backend belongs to the given jdbc url.
If multiple backend implementations are provided for the same database type, only one backend should match the URL. The others must be selected via name.- Parameters:
url- the jdbc url- Returns:
- true if matches
-
getName
Description copied from interface:BackendGets the name of the backend.- Returns:
- the name
-
getDriverClassName
Description copied from interface:BackendGets the JDBC driver class name.- Returns:
- the class name
-
getBackendId
Description copied from interface:BackendDetermines the unique id or name used by the backend for a given connection.Useful to figure out the corresponding
ManagedConnectionfrom the backend's logfiles.- Parameters:
connection- the jdbc connection- Returns:
- the backend id, null if none
-
sqlRequiresExtraCommit
public boolean sqlRequiresExtraCommit()Description copied from interface:BackendAccording to the JDBC-specsConnection.setAutoCommit(boolean)(true) should commit, but some backends require an extraConnection.commit().- Specified by:
sqlRequiresExtraCommitin interfaceBackend- Overrides:
sqlRequiresExtraCommitin classAbstractBackend- Returns:
- true if the database needs an extra commit
-
needSetLongWorkaround
public boolean needSetLongWorkaround()Description copied from interface:BackendChecks whether we need a workaround for the (Ingres) setLong-Bug.- Specified by:
needSetLongWorkaroundin interfaceBackend- Overrides:
needSetLongWorkaroundin classAbstractBackend- Returns:
- true if workaround needed
-
buildSelectSql
Description copied from interface:BackendCreates a select statement string from an inner sql string.sqlBuilderis anything asFROM... WHERE... ORDER BY....
It is decorated with a leadingSELECTplus optional clauses like for the given parameters.- Specified by:
buildSelectSqlin interfaceBackend- Overrides:
buildSelectSqlin classAbstractSql2003Backend- Parameters:
sqlBuilder- the sql builder, initially containing the inner sql without leadingSELECT.writeLock- true select should write locklimit- the limit value, ≤ 0 if no limit clauseoffset- the offset value, ≤ 0 if no offset clause
-
setLeadingSelectParameters
Description copied from interface:BackendSets optional parameters before applying the original parameters.- Specified by:
setLeadingSelectParametersin interfaceBackend- Overrides:
setLeadingSelectParametersin classAbstractSql2003Backend- Parameters:
stmt- the prepared statementlimit- the limit value, ≤ 0 if no limit clauseoffset- the offset value, ≤ 0 if no offset clause- Returns:
- the next parameter index
-
setTrailingSelectParameters
public int setTrailingSelectParameters(BackendPreparedStatement stmt, int index, int limit, int offset) Description copied from interface:BackendSets optional parameters after applying the original parameters.- Specified by:
setTrailingSelectParametersin interfaceBackend- Overrides:
setTrailingSelectParametersin classAbstractSql2003Backend- Parameters:
stmt- the prepared statementindex- the first parameter indexlimit- the limit value, ≤ 0 if no limit clauseoffset- the offset value, ≤ 0 if no offset clause- Returns:
- the next parameter index
-
getMaxSize
Description copied from interface:BackendReturns the maximum size for a given SQL-type.- Specified by:
getMaxSizein interfaceBackend- Overrides:
getMaxSizein classAbstractBackend- Parameters:
sqlType- the SQL-type- Returns:
- the maximum size, 0 if unlimited, -1 if type without size
-
sqlTypeToString
Description copied from interface:BackendConverts the java SQL-type to the database type name.- Specified by:
sqlTypeToStringin interfaceBackend- Overrides:
sqlTypeToStringin classAbstractBackend- Parameters:
sqlType- the java sql typesize- the column's size- Returns:
- the corresponding type string
-
jdbcTypeToSqlType
Description copied from interface:BackendConverts the JDBC data type integer to a tentackle backend SqlTypes.There may be more than one sqltype returned!
- Specified by:
jdbcTypeToSqlTypein interfaceBackend- Overrides:
jdbcTypeToSqlTypein classAbstractBackend- Parameters:
jdbcType- the jdbc data typesize- the column sizescale- the column's scale- Returns:
- the SqlTypes, empty array if no mapping available or no exact match (not generated by TT)
- See Also:
-
sqlCreateTableComment
Description copied from interface:BackendGenerates SQL code to create the comment for a table.- Specified by:
sqlCreateTableCommentin interfaceBackend- Overrides:
sqlCreateTableCommentin classAbstractBackend- Parameters:
tableName- the table namecomment- optional comment, null if none- Returns:
- the SQL code, empty string if comment is created via
Backend.sqlCreateTableIntro(java.lang.String, java.lang.String)orBackend.sqlCreateTableClosing(java.lang.String, java.lang.String)
-
sqlCreateColumnComment
Description copied from interface:BackendGenerates SQL code to create the comment for an attribute.- Specified by:
sqlCreateColumnCommentin interfaceBackend- Overrides:
sqlCreateColumnCommentin classAbstractBackend- Parameters:
tableName- the table namecolumnName- the column namecomment- optional comment, null if none- Returns:
- the SQL code, empty string if comment is created via
Backend.sqlCreateColumn(java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object, boolean, boolean)
-
extractWhereClause
Description copied from class:AbstractBackendExtracts the where clause from a given sql.- Overrides:
extractWhereClausein classAbstractBackend- Parameters:
sql- the sql statementwhereOffset- the location of WHERE in sql- Returns:
- the where clause without the keyword WHERE
-
isDropIfExistsSupported
protected boolean isDropIfExistsSupported()Description copied from class:AbstractBackendAdds "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.- Overrides:
isDropIfExistsSupportedin classAbstractBackend- Returns:
- true if supported
-