Class DialectOracle
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.jdbc.dialect.Dialect
-
- org.nuxeo.ecm.core.storage.sql.jdbc.dialect.DialectOracle
-
public class DialectOracle extends Dialect
Oracle-specific dialect.- Author:
- Florent Guillaume
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DialectOracle.XAErrorLogger
-
Nested classes/interfaces inherited from class org.nuxeo.ecm.core.storage.sql.jdbc.dialect.Dialect
Dialect.ArraySubQuery, Dialect.DialectIdType, Dialect.FulltextMatchInfo, Dialect.JDBCInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected static Set<Character>
CHARS_RESERVED
protected static String
CHARS_RESERVED_STR
static int
CLOB_LENGTH_MIN_VALUE
protected boolean
disableReadVersionPermission
protected boolean
disableVersionACL
protected String
fulltextParameters
protected String
idSequenceName
protected Dialect.DialectIdType
idType
protected int
majorVersion
protected Class<PreparedStatement>
oraclePreparedStatementClass
protected Method
oraclePreparedStatementGetReturnResultSet
protected Method
oraclePreparedStatementRegisterReturnParameter
protected boolean
pathOptimizationsEnabled
protected int
pathOptimizationsVersion
static String
USE_CLOB_PROPERTY
protected String
usersSeparator
protected DialectOracle.XAErrorLogger
xaErrorLogger
-
Fields inherited from class org.nuxeo.ecm.core.storage.sql.jdbc.dialect.Dialect
aclOptimizationsEnabled, ARRAY_SEP, clusteringEnabled, DEBUG_REAL_UUIDS, DEBUG_UUIDS, descending, DIALECT_CLASS, DIALECTS, fulltextDisabled, fulltextSearchDisabled, HEX_DIGITS, NULLS_LAST_ON_DESC_PROP, proxiesEnabled, readAclMaxSize, softDeleteEnabled, storesUpperCaseIdentifiers
-
-
Constructor Summary
Constructors Constructor Description DialectOracle(DatabaseMetaData metadata, RepositoryDescriptor repositoryDescriptor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addPagingClause(String sql, long limit, long offset)
Returns the SQL query with a paging clauseString
castIdToVarchar(String expr)
Casts an id column to a VARCHAR type.List<String>
checkStoredProcedure(String procName, String procCreate, String ddlMode, Connection connection, JDBCLogger logger, Map<String,Serializable> properties)
Checks if a given stored procedure exists and is identical to the passed creation SQL.Array
createArrayOf(int type, Object[] elements, Connection connection)
Factory method for creating Array objects, suitable for passing toPreparedStatement.setArray(int, java.sql.Array)
.boolean
doesUpdateFromRepeatSelf()
When doing an UPDATE t SET ...String
getAddColumnString()
String
getAncestorsIdsSql()
Gets the SQL query to get the ancestors of a set of ids.Serializable[]
getArrayResult(Array array)
Gets the array result as a converted array of Serializable.String
getBlobLengthFunction()
Gets the SQL function that returns the length of a blob, in bytes.String
getCascadeDropConstraintsString()
String
getClobCast(boolean inOrderBy)
When using a CLOB field in an expression, is some casting required and with what pattern?String
getClusterGetInvalidations()
Gets the SQL to query invalidations for this cluster node.String
getClusterInsertInvalidations()
Gets the SQL to send an invalidation to the cluster.String
getConnectionSchema(Connection connection)
Gets the schema to use to query metadata about existing tables.String
getCreateFulltextIndexSql(String indexName, String quotedIndexName, Table table, List<Column> columns, Model model)
Gets a CREATE INDEX statement for a fulltext index.String
getDateCast()
Get the expression to use to cast a column to a DATE type.String
getDialectFulltextQuery(String query)
Get the dialect-specific version of a fulltext query.Serializable
getFromResultSet(ResultSet rs, int index, Column column)
int
getFulltextIndexedColumns()
Specifies what columns of the fulltext table have to be indexed.Dialect.FulltextMatchInfo
getFulltextScoredMatchInfo(String fulltextQuery, String indexName, int nthMatch, Column mainColumn, Model model, Database database)
Gets the SQL information needed to do a a fulltext match, either with a direct expression in the WHERE clause, or using a join with an additional table.Serializable
getGeneratedId(Connection connection)
Gets a generated id if so configured, otherwise returns null.String
getIdentityGeneratedKeySql(Column column)
Gets the SQL query to execute to retrieve the last generated identity key.Dialect.DialectIdType
getIdType()
Gets the type of id when stored in the database.String
getInsertOnConflictDoNothingSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues)
Gets the SQL string for an INSERT ...String
getInTreeSql(String idColumnName, String id)
Gets the expression to use to check tree membership.Dialect.JDBCInfo
getJDBCTypeAndString(ColumnType type)
Gets the JDBC type and string from Nuxeo's type abstraction.String
getLikeEscaping()
Gets the SQL fragment to add after a LIKE match to specify the escaping character.boolean
getMaterializeFulltextSyntheticColumn()
Does the fulltext synthetic column have to be materialized.protected int
getMaxIndexNameSize()
protected int
getMaxNameSize()
protected String
getMergeSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues, boolean updateWhenMatched)
String
getNoColumnsInsertString(Column idColumn)
protected int
getOracleErrorCode(Throwable t)
List<String>
getPostCreateIdentityColumnSql(Column column)
Gets additional SQL statements to execute after the CREATE TABLE when creating an identity column.String
getPrepareUserReadAclsSql()
Gets the SQL expression to prepare the user read acls cache.String
getQuotedNameForExpression(Column column)
Gets the SQL to use to refer to a column in an expression.String
getReadAclsCheckSql(String userIdCol)
Gets the expression to check if access is allowed using read acls.String
getRebuildReadAclsSql()
Gets the statement to rebuild the wall read aclsResultSet
getReturnResultSet(PreparedStatement ps)
Gets returnResultSet
.String
getSecurityCheckSql(String idColumnName)
Gets the expression to use to check security.String
getSoftDeleteCleanupSql()
SQL to clean soft-delete documents.String
getSoftDeleteSql()
SQL to soft delete documents.String
getSQLForDump(String sql)
Returns the SQL statement with proper terminator to use in a dump.String
getSQLStatementsFilename()
Gets the name of the file containing the SQL statements.Map<String,Serializable>
getSQLStatementsProperties(Model model, Database database)
Gets the properties to use with the SQL statements.List<String>
getStartupSqls(Model model, Database database)
Gets the sql statements to execute after the repository init (at startup).String
getTestSQLStatementsFilename()
String
getUpdateReadAclsSql()
Gets the statement to update the read aclsString
getUpsertSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues)
Gets the SQL string for an UPSERT expression.String
getUsersSeparator()
String
getValidationQuery()
A query that, when executed, will make at least a round-trip to the server to check that the connection is alive.boolean
hasIdentityGeneratedKey()
True if the dialect returns the generated key for the identity from the insert statement.boolean
hasNullEmptyString()
Does the dialect have an empty string identical to NULL (Oracle).boolean
isAllowedConversion(int expected, int actual, String actualName, int actualSize)
Check mismatches between expected and actual JDBC types read from database introspection.boolean
isClusteringDeleteNeeded()
Does clustering fetch of invalidations (Dialect.getClusterGetInvalidations()
) need a separate delete for them.boolean
isClusteringSupported()
Checks that clustering is supported.boolean
isConcurrentUpdateException(Throwable t)
Checks if an exception received means that a concurrent update was detected.protected boolean
isConnectionClosed(int oracleError)
boolean
needsNullsLastOnDescSort()
True if the dialect need an extra NULLS LAST on DESC sort.boolean
needsOracleJoins()
Whether implicit Oracle joins (instead of explicit ANSI joins) are needed.boolean
needsOriginalColumnInGroupBy()
Whether a GROUP BY can only be used with the original column name and not an alias.protected DialectOracle.XAErrorLogger
newXAErrorLogger()
protected static String
normalizeString(String string)
void
registerReturnParameter(PreparedStatement ps, int parameterIndex, int sqlType)
Registers return parameters.void
setId(PreparedStatement ps, int index, Serializable value)
Sets a prepared statement value that is a Nuxeo main id (usually UUID).void
setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column)
boolean
supportsArrays()
Does the dialect support passing ARRAY values (to stored procedures mostly).boolean
supportsArraysReturnInsteadOfRows()
Does a stored function returning an result set need to access it as a single array instead of iterating over a normal result set's rows.boolean
supportsBatchUpdateCount()
Does the dialect report accurate update counts for batch updates.boolean
supportsFastDescendants()
Checks whetherDialect.getInTreeSql(String, String)
is optimized for fast results (using an ancestors or descendants table).boolean
supportsPaging()
Indicates if dialect supports pagingboolean
supportsReadAcl()
Does the dialect support an optimized read security checksboolean
supportsUpdateFrom()
Does the dialect support UPDATE t SET ...boolean
supportsWith()
Does the dialect support SQL-99 WITH common table expressions.-
Methods inherited from class org.nuxeo.ecm.core.storage.sql.jdbc.dialect.Dialect
closeQuote, createDialect, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getArrayElementString, getArrayIlikeSql, getArrayInSql, getArrayLikeSql, getArraySubQuery, getBinaryFulltextSql, getCalendarFromTimestamp, getCalendarFromTimestamp, getColumnName, getCreateIndexSql, getCustomColumnDefinition, getCustomPostCreateSqls, getDescending, getDumpStart, getDumpStop, getForeignKeyConstraintName, getFreeVariableSetterForType, getFromResultSetString, getFromResultSetTimestamp, getFulltextType, getIgnoredColumns, getIndexName, getMatchMixinType, getMaximumArgsForIn, getNullColumnString, getPrimaryKeyConstraintName, getTableName, getTableTypeString, getTimestampFromCalendar, getTimestampFromCalendar, isIdentityAlreadyPrimary, jdbcInfo, jdbcInfo, jdbcInfo, jdbcInfo, makeName, makeName, needsAliasForDerivedTable, needsOrderByKeysAfterDistinct, needsPrepareUserReadAcls, openQuote, performAdditionalStatements, performPostOpenStatements, qualifyIndexName, setIdLong, setToPreparedStatementString, setToPreparedStatementTimestamp, storesUpperCaseIdentifiers, supportsAncestorsTable, supportsArrayColumns, supportsCircularCascadeDeleteConstraints, supportsIfExistsAfterTableName, supportsIfExistsBeforeTableName, supportsIlike, supportsMultipleFulltextIndexes, supportsScroll, supportsSysNameArray, toBooleanValueString, toHexString
-
-
-
-
Field Detail
-
USE_CLOB_PROPERTY
public static final String USE_CLOB_PROPERTY
- See Also:
- Constant Field Values
-
CLOB_LENGTH_MIN_VALUE
public static final int CLOB_LENGTH_MIN_VALUE
- See Also:
- Constant Field Values
-
oraclePreparedStatementClass
protected Class<PreparedStatement> oraclePreparedStatementClass
-
oraclePreparedStatementRegisterReturnParameter
protected Method oraclePreparedStatementRegisterReturnParameter
-
oraclePreparedStatementGetReturnResultSet
protected Method oraclePreparedStatementGetReturnResultSet
-
fulltextParameters
protected final String fulltextParameters
-
pathOptimizationsEnabled
protected boolean pathOptimizationsEnabled
-
pathOptimizationsVersion
protected int pathOptimizationsVersion
-
disableVersionACL
protected final boolean disableVersionACL
-
disableReadVersionPermission
protected final boolean disableReadVersionPermission
-
usersSeparator
protected String usersSeparator
-
idType
protected final Dialect.DialectIdType idType
-
idSequenceName
protected String idSequenceName
-
majorVersion
protected int majorVersion
-
xaErrorLogger
protected DialectOracle.XAErrorLogger xaErrorLogger
-
CHARS_RESERVED_STR
protected static final String CHARS_RESERVED_STR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DialectOracle
public DialectOracle(DatabaseMetaData metadata, RepositoryDescriptor repositoryDescriptor)
-
-
Method Detail
-
newXAErrorLogger
protected DialectOracle.XAErrorLogger newXAErrorLogger()
-
registerReturnParameter
public void registerReturnParameter(PreparedStatement ps, int parameterIndex, int sqlType) throws SQLException
Description copied from class:Dialect
Registers return parameters.Used for Oracle "DML Returning".
- Overrides:
registerReturnParameter
in classDialect
- Throws:
SQLException
-
getReturnResultSet
public ResultSet getReturnResultSet(PreparedStatement ps) throws SQLException
Description copied from class:Dialect
Gets returnResultSet
.Used for Oracle "DML Returning".
- Overrides:
getReturnResultSet
in classDialect
- Throws:
SQLException
-
getNoColumnsInsertString
public String getNoColumnsInsertString(Column idColumn)
- Overrides:
getNoColumnsInsertString
in classDialect
-
getConnectionSchema
public String getConnectionSchema(Connection connection) throws SQLException
Description copied from class:Dialect
Gets the schema to use to query metadata about existing tables.- Overrides:
getConnectionSchema
in classDialect
- Throws:
SQLException
-
getCascadeDropConstraintsString
public String getCascadeDropConstraintsString()
- Overrides:
getCascadeDropConstraintsString
in classDialect
-
getAddColumnString
public String getAddColumnString()
- Overrides:
getAddColumnString
in classDialect
-
getJDBCTypeAndString
public Dialect.JDBCInfo getJDBCTypeAndString(ColumnType type)
Description copied from class:Dialect
Gets the JDBC type and string from Nuxeo's type abstraction.- Specified by:
getJDBCTypeAndString
in classDialect
-
isAllowedConversion
public boolean isAllowedConversion(int expected, int actual, String actualName, int actualSize)
Description copied from class:Dialect
Check mismatches between expected and actual JDBC types read from database introspection.- Overrides:
isAllowedConversion
in classDialect
-
getGeneratedId
public Serializable getGeneratedId(Connection connection) throws SQLException
Description copied from class:Dialect
Gets a generated id if so configured, otherwise returns null.- Overrides:
getGeneratedId
in classDialect
- Throws:
SQLException
-
setId
public void setId(PreparedStatement ps, int index, Serializable value) throws SQLException
Description copied from class:Dialect
Sets a prepared statement value that is a Nuxeo main id (usually UUID).- Overrides:
setId
in classDialect
- Parameters:
ps
- the prepared statementindex
- the parameter index in the prepared statementvalue
- the value to set- Throws:
SQLException
-
setToPreparedStatement
public void setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column) throws SQLException
- Specified by:
setToPreparedStatement
in classDialect
- Throws:
SQLException
-
getFromResultSet
public Serializable getFromResultSet(ResultSet rs, int index, Column column) throws SQLException
- Specified by:
getFromResultSet
in classDialect
- Throws:
SQLException
-
getMaxNameSize
protected int getMaxNameSize()
- Overrides:
getMaxNameSize
in classDialect
-
getMaxIndexNameSize
protected int getMaxIndexNameSize()
- Overrides:
getMaxIndexNameSize
in classDialect
-
getCreateFulltextIndexSql
public String getCreateFulltextIndexSql(String indexName, String quotedIndexName, Table table, List<Column> columns, Model model)
Description copied from class:Dialect
Gets a CREATE INDEX statement for a fulltext index.- Specified by:
getCreateFulltextIndexSql
in classDialect
-
getDialectFulltextQuery
public String getDialectFulltextQuery(String query)
Description copied from class:Dialect
Get the dialect-specific version of a fulltext query.- Specified by:
getDialectFulltextQuery
in classDialect
- Parameters:
query
- the CMIS-syntax-based fulltext query string- Returns:
- the dialect native fulltext query string
-
getFulltextScoredMatchInfo
public Dialect.FulltextMatchInfo getFulltextScoredMatchInfo(String fulltextQuery, String indexName, int nthMatch, Column mainColumn, Model model, Database database)
Description copied from class:Dialect
Gets the SQL information needed to do a a fulltext match, either with a direct expression in the WHERE clause, or using a join with an additional table.- Specified by:
getFulltextScoredMatchInfo
in classDialect
-
getMaterializeFulltextSyntheticColumn
public boolean getMaterializeFulltextSyntheticColumn()
Description copied from class:Dialect
Does the fulltext synthetic column have to be materialized.- Specified by:
getMaterializeFulltextSyntheticColumn
in classDialect
-
getFulltextIndexedColumns
public int getFulltextIndexedColumns()
Description copied from class:Dialect
Specifies what columns of the fulltext table have to be indexed.- Specified by:
getFulltextIndexedColumns
in classDialect
- Returns:
- 0 for none, 1 for the synthetic one, 2 for the individual ones
-
getLikeEscaping
public String getLikeEscaping()
Description copied from class:Dialect
Gets the SQL fragment to add after a LIKE match to specify the escaping character.- Overrides:
getLikeEscaping
in classDialect
-
supportsUpdateFrom
public boolean supportsUpdateFrom()
Description copied from class:Dialect
Does the dialect support UPDATE t SET ... FROM t, u WHERE ... ?- Specified by:
supportsUpdateFrom
in classDialect
-
doesUpdateFromRepeatSelf
public boolean doesUpdateFromRepeatSelf()
Description copied from class:Dialect
When doing an UPDATE t SET ... FROM t, u WHERE ..., does the FROM clause need to repeate the updated table (t).- Specified by:
doesUpdateFromRepeatSelf
in classDialect
-
needsOriginalColumnInGroupBy
public boolean needsOriginalColumnInGroupBy()
Description copied from class:Dialect
Whether a GROUP BY can only be used with the original column name and not an alias.- Overrides:
needsOriginalColumnInGroupBy
in classDialect
-
needsOracleJoins
public boolean needsOracleJoins()
Description copied from class:Dialect
Whether implicit Oracle joins (instead of explicit ANSI joins) are needed.- Overrides:
needsOracleJoins
in classDialect
-
getClobCast
public String getClobCast(boolean inOrderBy)
Description copied from class:Dialect
When using a CLOB field in an expression, is some casting required and with what pattern?Needed for H2.
- Overrides:
getClobCast
in classDialect
- Parameters:
inOrderBy
-true
if the expression is for an ORDER BY column- Returns:
- a pattern for String.format with one parameter for the column name and one for the width, or
null
if no cast is required
-
getQuotedNameForExpression
public String getQuotedNameForExpression(Column column)
Description copied from class:Dialect
Gets the SQL to use to refer to a column in an expression.Needed for Oracle CLOB.
- Overrides:
getQuotedNameForExpression
in classDialect
- Parameters:
column
- the column used in an expression- Returns:
- the SQL to use to refer to it
-
supportsReadAcl
public boolean supportsReadAcl()
Description copied from class:Dialect
Does the dialect support an optimized read security checks- Overrides:
supportsReadAcl
in classDialect
-
getPrepareUserReadAclsSql
public String getPrepareUserReadAclsSql()
Description copied from class:Dialect
Gets the SQL expression to prepare the user read acls cache. This can be used to populate a table cache.- Overrides:
getPrepareUserReadAclsSql
in classDialect
- Returns:
- and SQL expression with one parameter (principals)
-
getReadAclsCheckSql
public String getReadAclsCheckSql(String userIdCol)
Description copied from class:Dialect
Gets the expression to check if access is allowed using read acls. The dialect must suppportsReadAcl.- Overrides:
getReadAclsCheckSql
in classDialect
- Parameters:
userIdCol
- the quoted name of the aclr_user_map user_id column to use- Returns:
- an SQL expression with one parameter (principals) that is true if access is allowed
-
getUpdateReadAclsSql
public String getUpdateReadAclsSql()
Description copied from class:Dialect
Gets the statement to update the read acls- Overrides:
getUpdateReadAclsSql
in classDialect
-
getRebuildReadAclsSql
public String getRebuildReadAclsSql()
Description copied from class:Dialect
Gets the statement to rebuild the wall read acls- Overrides:
getRebuildReadAclsSql
in classDialect
-
getSecurityCheckSql
public String getSecurityCheckSql(String idColumnName)
Description copied from class:Dialect
Gets the expression to use to check security.- Specified by:
getSecurityCheckSql
in classDialect
- Parameters:
idColumnName
- the quoted name of the id column to use- Returns:
- an SQL expression with two parameters (principals and permissions) that is true if access is allowed
-
supportsFastDescendants
public boolean supportsFastDescendants()
Description copied from class:Dialect
Checks whetherDialect.getInTreeSql(String, String)
is optimized for fast results (using an ancestors or descendants table).- Overrides:
supportsFastDescendants
in classDialect
-
getInTreeSql
public String getInTreeSql(String idColumnName, String id)
Description copied from class:Dialect
Gets the expression to use to check tree membership.- Specified by:
getInTreeSql
in classDialect
- Parameters:
idColumnName
- the quoted name of the id column to useid
- the id, to check syntax with respect to specialized id column types- Returns:
- an SQL expression with one parameters for the based id that is true if the document is under base id, or
null
if the query cannot match
-
getUpsertSql
public String getUpsertSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues)
Description copied from class:Dialect
Gets the SQL string for an UPSERT expression.- Specified by:
getUpsertSql
in classDialect
- Parameters:
columns
- the columns to upsert (first one being the key column)values
- the values to upsert (first one being the key value)outColumns
- the columns to use in the prepared statementoutValues
- the values to use in the prepared statement
-
getInsertOnConflictDoNothingSql
public String getInsertOnConflictDoNothingSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues)
Description copied from class:Dialect
Gets the SQL string for an INSERT ... ON CONFLICT DO NOTHING expression.- Overrides:
getInsertOnConflictDoNothingSql
in classDialect
- Parameters:
columns
- the columns to insert (first one being the key column)values
- the values to insert (first one being the key value)outColumns
- the columns to use in the prepared statementoutValues
- the values to use in the prepared statement
-
getMergeSql
protected String getMergeSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues, boolean updateWhenMatched)
-
isClusteringSupported
public boolean isClusteringSupported()
Description copied from class:Dialect
Checks that clustering is supported.- Overrides:
isClusteringSupported
in classDialect
-
isClusteringDeleteNeeded
public boolean isClusteringDeleteNeeded()
Description copied from class:Dialect
Does clustering fetch of invalidations (Dialect.getClusterGetInvalidations()
) need a separate delete for them.- Overrides:
isClusteringDeleteNeeded
in classDialect
-
getClusterInsertInvalidations
public String getClusterInsertInvalidations()
Description copied from class:Dialect
Gets the SQL to send an invalidation to the cluster.- Overrides:
getClusterInsertInvalidations
in classDialect
- Returns:
- an SQL statement with parameters for: nodeId, id, fragments, kind
-
getClusterGetInvalidations
public String getClusterGetInvalidations()
Description copied from class:Dialect
Gets the SQL to query invalidations for this cluster node.- Overrides:
getClusterGetInvalidations
in classDialect
- Returns:
- an SQL statement returning a result set
-
supportsPaging
public boolean supportsPaging()
Description copied from class:Dialect
Indicates if dialect supports paging- Overrides:
supportsPaging
in classDialect
- Returns:
- true if the dialect supports paging
-
addPagingClause
public String addPagingClause(String sql, long limit, long offset)
Description copied from class:Dialect
Returns the SQL query with a paging clause- Overrides:
addPagingClause
in classDialect
-
supportsWith
public boolean supportsWith()
Description copied from class:Dialect
Does the dialect support SQL-99 WITH common table expressions.- Overrides:
supportsWith
in classDialect
-
supportsArrays
public boolean supportsArrays()
Description copied from class:Dialect
Does the dialect support passing ARRAY values (to stored procedures mostly).If not, we'll simulate them using a string and a separator.
- Overrides:
supportsArrays
in classDialect
- Returns:
- true if ARRAY values are supported
-
supportsArraysReturnInsteadOfRows
public boolean supportsArraysReturnInsteadOfRows()
Description copied from class:Dialect
Does a stored function returning an result set need to access it as a single array instead of iterating over a normal result set's rows.Oracle needs this.
- Overrides:
supportsArraysReturnInsteadOfRows
in classDialect
-
getArrayResult
public Serializable[] getArrayResult(Array array) throws SQLException
Description copied from class:Dialect
Gets the array result as a converted array of Serializable.- Overrides:
getArrayResult
in classDialect
- Throws:
SQLException
-
hasNullEmptyString
public boolean hasNullEmptyString()
Description copied from class:Dialect
Does the dialect have an empty string identical to NULL (Oracle).- Overrides:
hasNullEmptyString
in classDialect
-
createArrayOf
public Array createArrayOf(int type, Object[] elements, Connection connection) throws SQLException
Description copied from class:Dialect
Factory method for creating Array objects, suitable for passing toPreparedStatement.setArray(int, java.sql.Array)
.(An equivalent method is defined by JDBC4 on the
Connection
class.)- Overrides:
createArrayOf
in classDialect
- Parameters:
type
- the SQL type of the elementselements
- the elements of the arrayconnection
- the connection- Returns:
- an Array holding the elements
- Throws:
SQLException
-
getSQLStatementsFilename
public String getSQLStatementsFilename()
Description copied from class:Dialect
Gets the name of the file containing the SQL statements.- Specified by:
getSQLStatementsFilename
in classDialect
-
getTestSQLStatementsFilename
public String getTestSQLStatementsFilename()
- Specified by:
getTestSQLStatementsFilename
in classDialect
-
getSQLStatementsProperties
public Map<String,Serializable> getSQLStatementsProperties(Model model, Database database)
Description copied from class:Dialect
Gets the properties to use with the SQL statements.- Specified by:
getSQLStatementsProperties
in classDialect
-
getOracleErrorCode
protected int getOracleErrorCode(Throwable t)
-
isConnectionClosed
protected boolean isConnectionClosed(int oracleError)
-
isConcurrentUpdateException
public boolean isConcurrentUpdateException(Throwable t)
Description copied from class:Dialect
Checks if an exception received means that a concurrent update was detected.- Overrides:
isConcurrentUpdateException
in classDialect
-
getValidationQuery
public String getValidationQuery()
Description copied from class:Dialect
A query that, when executed, will make at least a round-trip to the server to check that the connection is alive.The query should throw an error if the connection is dead.
- Overrides:
getValidationQuery
in classDialect
-
getBlobLengthFunction
public String getBlobLengthFunction()
Description copied from class:Dialect
Gets the SQL function that returns the length of a blob, in bytes.- Overrides:
getBlobLengthFunction
in classDialect
-
getPostCreateIdentityColumnSql
public List<String> getPostCreateIdentityColumnSql(Column column)
Description copied from class:Dialect
Gets additional SQL statements to execute after the CREATE TABLE when creating an identity column.Oracle needs both a sequence and a trigger.
- Overrides:
getPostCreateIdentityColumnSql
in classDialect
-
hasIdentityGeneratedKey
public boolean hasIdentityGeneratedKey()
Description copied from class:Dialect
True if the dialect returns the generated key for the identity from the insert statement.Oracle needs a separate call to CURRVAL.
- Overrides:
hasIdentityGeneratedKey
in classDialect
-
getIdentityGeneratedKeySql
public String getIdentityGeneratedKeySql(Column column)
Description copied from class:Dialect
Gets the SQL query to execute to retrieve the last generated identity key.Oracle needs a separate call to CURRVAL.
- Overrides:
getIdentityGeneratedKeySql
in classDialect
-
getAncestorsIdsSql
public String getAncestorsIdsSql()
Description copied from class:Dialect
Gets the SQL query to get the ancestors of a set of ids.- Overrides:
getAncestorsIdsSql
in classDialect
- Returns:
- null if not available
-
needsNullsLastOnDescSort
public boolean needsNullsLastOnDescSort()
Description copied from class:Dialect
True if the dialect need an extra NULLS LAST on DESC sort.- Overrides:
needsNullsLastOnDescSort
in classDialect
-
getDateCast
public String getDateCast()
Description copied from class:Dialect
Get the expression to use to cast a column to a DATE type.- Overrides:
getDateCast
in classDialect
- Returns:
- a pattern for String.format with one parameter for the column name
-
castIdToVarchar
public String castIdToVarchar(String expr)
Description copied from class:Dialect
Casts an id column to a VARCHAR type.Used for uuid/varchar joins.
- Overrides:
castIdToVarchar
in classDialect
- Returns:
- the casted expression
-
getIdType
public Dialect.DialectIdType getIdType()
Description copied from class:Dialect
Gets the type of id when stored in the database.
-
getUsersSeparator
public String getUsersSeparator()
-
getSoftDeleteSql
public String getSoftDeleteSql()
Description copied from class:Dialect
SQL to soft delete documents. SQL returned has free parameters for the array of ids and time.- Overrides:
getSoftDeleteSql
in classDialect
-
getSoftDeleteCleanupSql
public String getSoftDeleteCleanupSql()
Description copied from class:Dialect
SQL to clean soft-delete documents. SQL returned has free parameters max and beforeTime.- Overrides:
getSoftDeleteCleanupSql
in classDialect
-
getStartupSqls
public List<String> getStartupSqls(Model model, Database database)
Description copied from class:Dialect
Gets the sql statements to execute after the repository init (at startup).Used for vacuum-like operations.
- Overrides:
getStartupSqls
in classDialect
-
checkStoredProcedure
public List<String> checkStoredProcedure(String procName, String procCreate, String ddlMode, Connection connection, JDBCLogger logger, Map<String,Serializable> properties) throws SQLException
Description copied from class:Dialect
Checks if a given stored procedure exists and is identical to the passed creation SQL.There are 3 cases to deal with, and actions to perform:
- the stored procedure doesn't exist, and must be created (create the stored procedure);
- the stored procedure exists but is not up to date (drop the old stored procedure and re-create it);
- the stored procedure exists and is up to date (nothing to do).
When there is nothing to do,
null
is returned. Otherwise the returned value is a list of SQL statements to execute. Note that the SQL statements will include also INSERT statements to be executed to remember the creation SQL itself.- Specified by:
checkStoredProcedure
in classDialect
- Parameters:
procName
- the stored procedure nameprocCreate
- the creation SQL for the stored procedureddlMode
- the DDL modeconnection
- the connectionlogger
- the loggerproperties
- the statement execution properties- Returns:
- a list of SQL statements
- Throws:
SQLException
-
getSQLForDump
public String getSQLForDump(String sql)
Description copied from class:Dialect
Returns the SQL statement with proper terminator to use in a dump.- Overrides:
getSQLForDump
in classDialect
- Returns:
- the SQL statement
-
supportsBatchUpdateCount
public boolean supportsBatchUpdateCount()
Description copied from class:Dialect
Does the dialect report accurate update counts for batch updates.- Overrides:
supportsBatchUpdateCount
in classDialect
-
-