@Service(value=Backend.class) public class Ingres extends AbstractSql2003Backend
| Modifier and Type | Field and Description |
|---|---|
static String |
SQL_FIRST
FIRST string.
|
static String |
SQL_FIRST_PAR
FIRST string.
|
RESERVED_WORDS_SQL2003, SQL_WINDOW_1, SQL_WINDOW_2, SQL_WINDOW_LIMIT, SQL_WINDOW_OFFSETRESERVED_WORDS_SQL92, SQL_COALESCE, SQL_FOR_UPDATETYPE_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_INDEX, 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 |
|---|
Ingres() |
| 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.
|
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 |
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.
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.
|
boolean |
needSetLongWorkaround()
Checks whether we need a workaround for the (Ingres) setLong-Bug.
|
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 |
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.
|
boolean |
sqlRequiresExtraCommit()
According to the JDBC-specs
Connection.setAutoCommit(boolean)(true)
should commit, but some backends require an extra Connection.commit(). |
String |
sqlTypeToString(SqlType sqlType,
int size)
Converts the java SQL-type to the database type name.
|
getReservedWords, sqlNextFromSequene, supportsSequencesgetCoalesceKeyword, sqlCreateForeignKey, sqlDropForeignKeyallowsExpressionsReferringToTablesBeingUpdated, assertValidName, buildSelectSql, columnTypeNullDefaultToString, columnTypeToString, createColumnMetaData, createConnection, createIndexColumnMetaData, createIndexMetaData, createPassword, createTableMetaData, getDefaultSchema, getDefaultSize, getEmptyString, getMaxScale, getMetaData, getMigrationStrategy, getModelMetaData, getTableHeaders, getTableMetaData, isCommunicationLinkException, isConstraintException, isDefaultEqual, isDropIfExistsEnabled, isFunctionBasedIndexSupported, isMatchingName, isReleaseSavepointSupported, isReservedSchemaName, isReservedTableName, isTemporaryName, needAliasForSubselect, needTxForFetchsize, normalizeDefault, optimizeSql, 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, toQuotedString, toString, valueToLiteralpublic static final String SQL_FIRST
public static final String SQL_FIRST_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 boolean sqlRequiresExtraCommit()
BackendConnection.setAutoCommit(boolean)(true)
should commit, but some backends require an extra Connection.commit().sqlRequiresExtraCommit in interface BackendsqlRequiresExtraCommit in class AbstractBackendpublic boolean needSetLongWorkaround()
BackendneedSetLongWorkaround in interface BackendneedSetLongWorkaround in class AbstractBackendpublic 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 AbstractSql2003BackendsqlBuilder - 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 AbstractSql2003Backendstmt - 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 AbstractSql2003Backendstmt - 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 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)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