Class Dialect
- Direct Known Subclasses:
DialectDB2
,DialectH2
,DialectMySQL
,DialectOracle
,DialectPostgreSQL
,DialectSQLServer
- Author:
- Florent Guillaume
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Structured Array Subquery Abstract Class.static enum
Type of id when stored in the database.static class
Information needed to express fulltext search with scoring.static final class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
static final String
protected boolean
static final boolean
static final boolean
protected String
Store the SQL for descending orderstatic final String
System property to override the dialect to use globally instead of the one auto-detected.protected boolean
protected boolean
protected static final char[]
static final String
Property used to disable NULLS LAST usage when sorting DESC.protected boolean
protected final int
protected boolean
protected final boolean
-
Constructor Summary
ConstructorDescriptionDialect
(DatabaseMetaData metadata, RepositoryDescriptor repositoryDescriptor) -
Method Summary
Modifier and TypeMethodDescriptionaddPagingClause
(String sql, long limit, long offset) Returns the SQL query with a paging clausecastIdToVarchar
(String expr) Casts an id column to a VARCHAR type.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.char
createArrayOf
(int type, Object[] elements, Connection connection) Factory method for creating Array objects, suitable for passing toPreparedStatement.setArray(int, java.sql.Array)
.static Dialect
createDialect
(Connection connection, RepositoryDescriptor repositoryDescriptor) Creates aDialect
by connecting to the datasource to check what database is used.abstract boolean
When doing an UPDATE t SET ...getAddForeignKeyConstraintString
(String constraintName, String[] foreignKeys, String referencedTable, String[] primaryKeys, boolean referencesPrimaryKey) getAddPrimaryKeyConstraintString
(String constraintName) Gets the SQL query to get the ancestors of a set of ids.getArrayElementString
(String arrayColumnName, int arrayElementIndex) Get SQL Array Element Subscripted string.getArrayIlikeSql
(Column arrayColumn, String refName, boolean positive, Table dataHierTable) Gets the SQL string for an array column ILIKE expression.getArrayInSql
(Column arrayColumn, String cast, boolean positive, List<Serializable> params) Gets the SQL string for an array column IN expression.getArrayLikeSql
(Column arrayColumn, String refName, boolean positive, Table dataHierTable) Gets the SQL string for an array column LIKE expression.getArrayResult
(Array array) Gets the array result as a converted array of Serializable.getArraySubQuery
(Column arrayColumn, String subQueryAlias) Gets the dialect-specific subquery for an array column.getBinaryFulltextSql
(List<String> columns) Return the SQL to get the columns fulltext fieldsGets the SQL function that returns the length of a blob, in bytes.Calendar[]
getCalendarFromTimestamp
(Timestamp[] value) getClobCast
(boolean inOrderBy) When using a CLOB field in an expression, is some casting required and with what pattern?Gets the SQL to query invalidations for this cluster node.Gets the SQL to send an invalidation to the cluster.getColumnName
(String name) getConnectionSchema
(Connection connection) Gets the schema to use to query metadata about existing tables.abstract String
getCreateFulltextIndexSql
(String indexName, String quotedIndexName, Table table, List<Column> columns, Model model) Gets a CREATE INDEX statement for a fulltext index.getCreateIndexSql
(String indexName, Table.IndexType indexType, Table table, List<Column> columns, Model model) Gets a CREATE INDEX statement for an index.getCustomColumnDefinition
(Table table) Additional column definitions for CREATE TABLE.getCustomPostCreateSqls
(Table table, Model model) Additional things to execute after CREATE TABLE.Get the expression to use to cast a column to a DATE type.Gets the SQL descending sort direction with option to sort nulls last.abstract String
getDialectFulltextQuery
(String query) Get the dialect-specific version of a fulltext query.Collection<? extends String>
Returns the initial DDL statements to add to a DDL dump.Collection<? extends String>
Returns the final DDL statements to add to a DDL dump.getForeignKeyConstraintName
(String tableName, String foreignColumnName, String foreignTableName) Gets the JDBC expression setting a free value for this column type.abstract Serializable
getFromResultSet
(ResultSet rs, int index, Column column) protected Serializable
getFromResultSetString
(ResultSet rs, int index, Column column) protected Serializable
getFromResultSetTimestamp
(ResultSet rs, int index, Column column) abstract int
Specifies what columns of the fulltext table have to be indexed.abstract 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.int
Gets the type of a fulltext column has known by JDBC.getGeneratedId
(Connection connection) Gets a generated id if so configured, otherwise returns null.getIdentityGeneratedKeySql
(Column column) Gets the SQL query to execute to retrieve the last generated identity key.Gets the type of id when stored in the database.getIgnoredColumns
(Table table) Columns ignored if we see them in existing tables.getIndexName
(String tableName, List<String> columnNames) getInsertOnConflictDoNothingSql
(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues) Gets the SQL string for an INSERT ...abstract String
getInTreeSql
(String idColumnName, String id) Gets the expression to use to check tree membership.abstract Dialect.JDBCInfo
Gets the JDBC type and string from Nuxeo's type abstraction.Gets the SQL fragment to add after a LIKE match to specify the escaping character.getMatchMixinType
(Column mixinsColumn, String mixin, boolean positive, String[] returnParam) Gets the SQL fragment to match a mixin type.abstract boolean
Does the fulltext synthetic column have to be materialized.int
Maximum number of values in a IN (?protected int
protected int
getNoColumnsInsertString
(Column idColumn) getPostCreateIdentityColumnSql
(Column column) Gets additional SQL statements to execute after the CREATE TABLE when creating an identity column.Gets the SQL expression to prepare the user read acls cache.getPrimaryKeyConstraintName
(String tableName) getQuotedNameForExpression
(Column column) Gets the SQL to use to refer to a column in an expression.getReadAclsCheckSql
(String userIdCol) Gets the expression to check if access is allowed using read acls.Gets the statement to rebuild the wall read aclsGets returnResultSet
.abstract String
getSecurityCheckSql
(String idColumnName) Gets the expression to use to check security.SQL to clean soft-delete documents.SQL to soft delete documents.getSQLForDump
(String sql) Returns the SQL statement with proper terminator to use in a dump.abstract String
Gets the name of the file containing the SQL statements.abstract Map<String,
Serializable> getSQLStatementsProperties
(Model model, Database database) Gets the properties to use with the SQL statements.getStartupSqls
(Model model, Database database) Gets the sql statements to execute after the repository init (at startup).getTableName
(String name) getTableTypeString
(Table table) abstract String
getTimestampFromCalendar
(Serializable[] value) getTimestampFromCalendar
(Calendar value) Gets the statement to update the read aclsabstract String
getUpsertSql
(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues) Gets the SQL string for an UPSERT expression.A query that, when executed, will make at least a round-trip to the server to check that the connection is alive.boolean
True if the dialect returns the generated key for the identity from the insert statement.boolean
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
Does clustering fetch of invalidations (getClusterGetInvalidations()
) need a separate delete for them.boolean
Checks that clustering is supported.boolean
Checks if an exception received means that a concurrent update was detected.boolean
Checks if an identity column is already defined as a primary key and does not need a separate index added.static Dialect.JDBCInfo
static Dialect.JDBCInfo
static Dialect.JDBCInfo
static Dialect.JDBCInfo
protected String
protected String
boolean
Whether a derived table (subselect in a FROM statement) needs an alias.boolean
True if the dialect need an extra NULLS LAST on DESC sort.boolean
Whether implicit Oracle joins (instead of explicit ANSI joins) are needed.boolean
When doing a SELECT DISTINCT that uses a ORDER BY, do the keys along which we order have to be mentioned in the DISTINCT clause?boolean
Whether a GROUP BY can only be used with the original column name and not an alias.boolean
The dialect need an extra SQL statement to populate a user read acl cache before running the query.char
void
performAdditionalStatements
(Connection connection) Let the dialect processes additional statements after tables creation and conditional statements.void
performPostOpenStatements
(Connection connection) Let the dialect perform additional statements just after the connection is opened.boolean
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
setIdLong
(PreparedStatement ps, int index, Serializable value) Sets a long id (sequence) from a value that may be a String or already a Long.abstract void
setToPreparedStatement
(PreparedStatement ps, int index, Serializable value, Column column) protected void
setToPreparedStatementString
(PreparedStatement ps, int index, Serializable value, Column column) void
setToPreparedStatementTimestamp
(PreparedStatement ps, int index, Serializable value, Column column) boolean
boolean
Checks if the dialect supports an ancestors table.boolean
Does the dialect support storing arrays in table columns.boolean
Does the dialect support passing ARRAY values (to stored procedures mostly).boolean
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
Does the dialect report accurate update counts for batch updates.boolean
boolean
Checks whethergetInTreeSql(String, String)
is optimized for fast results (using an ancestors or descendants table).boolean
boolean
boolean
Does the dialect support ILIKE operatorboolean
SQL Server supports only one fulltext index.boolean
Indicates if dialect supports pagingboolean
Does the dialect support an optimized read security checksboolean
Does the dialect support an scroll APIboolean
Checks if the dialect supports storing arrays of system names (for mixins for instance).abstract boolean
Does the dialect support UPDATE t SET ...boolean
Does the dialect support SQL-99 WITH common table expressions.toBooleanValueString
(boolean bool) static String
toHexString
(byte[] bytes)
-
Field Details
-
DEBUG_UUIDS
public static final boolean DEBUG_UUIDS- See Also:
-
DEBUG_REAL_UUIDS
public static final boolean DEBUG_REAL_UUIDS- See Also:
-
NULLS_LAST_ON_DESC_PROP
Property used to disable NULLS LAST usage when sorting DESC. This increase performance for some dialects because they can use an index for sorting when there are no NULL value.- Since:
- 5.9
- See Also:
-
descending
Store the SQL for descending order- Since:
- 5.9
-
DIALECT_CLASS
System property to override the dialect to use globally instead of the one auto-detected. It can be suffixed by "." and the database name (without spaces and as returned by the database itself) to override only for a specific database.- Since:
- 5.6
- See Also:
-
DIALECTS
-
storesUpperCaseIdentifiers
protected final boolean storesUpperCaseIdentifiers -
fulltextDisabled
protected boolean fulltextDisabled -
fulltextSearchDisabled
protected boolean fulltextSearchDisabled -
aclOptimizationsEnabled
protected final boolean aclOptimizationsEnabled -
clusteringEnabled
protected boolean clusteringEnabled- Since:
- 5.7
-
softDeleteEnabled
protected boolean softDeleteEnabled- Since:
- 5.7
-
proxiesEnabled
protected boolean proxiesEnabled -
readAclMaxSize
protected final int readAclMaxSize -
ARRAY_SEP
- See Also:
-
HEX_DIGITS
protected static final char[] HEX_DIGITS
-
-
Constructor Details
-
Dialect
-
-
Method Details
-
supportsScroll
public boolean supportsScroll()Does the dialect support an scroll API- Since:
- 8.4
-
jdbcInfo
-
jdbcInfo
-
jdbcInfo
public static Dialect.JDBCInfo jdbcInfo(String string, int jdbcType, String jdbcBaseTypeString, int jdbcBaseType) -
jdbcInfo
public static Dialect.JDBCInfo jdbcInfo(String string, int length, int jdbcType, String jdbcBaseTypeString, int jdbcBaseType) -
createDialect
public static Dialect createDialect(Connection connection, RepositoryDescriptor repositoryDescriptor) Creates aDialect
by connecting to the datasource to check what database is used. -
getConnectionSchema
Gets the schema to use to query metadata about existing tables.- Throws:
SQLException
-
getJDBCTypeAndString
Gets the JDBC type and string from Nuxeo's type abstraction. -
isAllowedConversion
Check mismatches between expected and actual JDBC types read from database introspection. -
getGeneratedId
Gets a generated id if so configured, otherwise returns null.- Throws:
SQLException
-
setId
Sets a prepared statement value that is a Nuxeo main id (usually UUID).- Parameters:
ps
- the prepared statementindex
- the parameter index in the prepared statementvalue
- the value to set- Throws:
SQLException
-
setIdLong
Sets a long id (sequence) from a value that may be a String or already a Long.- Throws:
SQLException
-
setToPreparedStatement
public abstract void setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column) throws SQLException - Throws:
SQLException
-
setToPreparedStatementString
protected void setToPreparedStatementString(PreparedStatement ps, int index, Serializable value, Column column) throws SQLException - Throws:
SQLException
-
setToPreparedStatementTimestamp
public void setToPreparedStatementTimestamp(PreparedStatement ps, int index, Serializable value, Column column) throws SQLException - Throws:
SQLException
-
getTimestampFromCalendar
-
getTimestampFromCalendar
-
getCalendarFromTimestamp
-
getCalendarFromTimestamp
-
getFromResultSet
public abstract Serializable getFromResultSet(ResultSet rs, int index, Column column) throws SQLException - Throws:
SQLException
-
getFromResultSetString
protected Serializable getFromResultSetString(ResultSet rs, int index, Column column) throws SQLException - Throws:
SQLException
-
getFromResultSetTimestamp
protected Serializable getFromResultSetTimestamp(ResultSet rs, int index, Column column) throws SQLException - Throws:
SQLException
-
storesUpperCaseIdentifiers
public boolean storesUpperCaseIdentifiers() -
openQuote
public char openQuote() -
closeQuote
public char closeQuote() -
toBooleanValueString
-
getMaxNameSize
protected int getMaxNameSize() -
getMaxIndexNameSize
protected int getMaxIndexNameSize() -
makeName
-
makeName
-
toHexString
-
getTableName
-
getColumnName
-
getPrimaryKeyConstraintName
-
getForeignKeyConstraintName
-
getIndexName
-
getCreateIndexSql
public String getCreateIndexSql(String indexName, Table.IndexType indexType, Table table, List<Column> columns, Model model) Gets a CREATE INDEX statement for an index.- Parameters:
indexName
- the index name (for fulltext)indexType
- the index typetable
- the tablecolumns
- the columns to indexmodel
- the model
-
getFulltextIndexedColumns
public abstract int getFulltextIndexedColumns()Specifies what columns of the fulltext table have to be indexed.- Returns:
- 0 for none, 1 for the synthetic one, 2 for the individual ones
-
supportsMultipleFulltextIndexes
public boolean supportsMultipleFulltextIndexes()SQL Server supports only one fulltext index. -
getMaterializeFulltextSyntheticColumn
public abstract boolean getMaterializeFulltextSyntheticColumn()Does the fulltext synthetic column have to be materialized. -
getCreateFulltextIndexSql
public abstract String getCreateFulltextIndexSql(String indexName, String quotedIndexName, Table table, List<Column> columns, Model model) Gets a CREATE INDEX statement for a fulltext index. -
getDialectFulltextQuery
Get the dialect-specific version of a fulltext query.- Parameters:
query
- the CMIS-syntax-based fulltext query string- Returns:
- the dialect native fulltext query string
-
getFulltextScoredMatchInfo
public abstract 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. -
getLikeEscaping
Gets the SQL fragment to add after a LIKE match to specify the escaping character.- Since:
- 7.4
-
getMatchMixinType
public String getMatchMixinType(Column mixinsColumn, String mixin, boolean positive, String[] returnParam) Gets the SQL fragment to match a mixin type. -
supportsPaging
public boolean supportsPaging()Indicates if dialect supports paging- Returns:
- true if the dialect supports paging
-
addPagingClause
Returns the SQL query with a paging clause- Since:
- 5.7 (replacing getPagingClause)
-
getFulltextType
public int getFulltextType()Gets the type of a fulltext column has known by JDBC.This is used for setNull.
-
getFreeVariableSetterForType
Gets the JDBC expression setting a free value for this column type.Needed for columns that need an expression around the value being set, usually for conversion (this is the case for PostgreSQL fulltext
TSVECTOR
columns for instance).- Parameters:
type
- the column type- Returns:
- the expression containing a free variable
-
getNoColumnsInsertString
-
getNullColumnString
-
getTableTypeString
-
getAddPrimaryKeyConstraintString
-
getAddForeignKeyConstraintString
-
qualifyIndexName
public boolean qualifyIndexName() -
supportsIfExistsBeforeTableName
public boolean supportsIfExistsBeforeTableName() -
supportsIfExistsAfterTableName
public boolean supportsIfExistsAfterTableName() -
getCascadeDropConstraintsString
-
supportsCircularCascadeDeleteConstraints
public boolean supportsCircularCascadeDeleteConstraints() -
getAddColumnString
-
supportsUpdateFrom
public abstract boolean supportsUpdateFrom()Does the dialect support UPDATE t SET ... FROM t, u WHERE ... ? -
doesUpdateFromRepeatSelf
public abstract boolean doesUpdateFromRepeatSelf()When doing an UPDATE t SET ... FROM t, u WHERE ..., does the FROM clause need to repeate the updated table (t). -
needsOrderByKeysAfterDistinct
public boolean needsOrderByKeysAfterDistinct()When doing a SELECT DISTINCT that uses a ORDER BY, do the keys along which we order have to be mentioned in the DISTINCT clause? -
needsAliasForDerivedTable
public boolean needsAliasForDerivedTable()Whether a derived table (subselect in a FROM statement) needs an alias. -
needsOriginalColumnInGroupBy
public boolean needsOriginalColumnInGroupBy()Whether a GROUP BY can only be used with the original column name and not an alias. -
needsOracleJoins
public boolean needsOracleJoins()Whether implicit Oracle joins (instead of explicit ANSI joins) are needed. -
needsPrepareUserReadAcls
public boolean needsPrepareUserReadAcls()The dialect need an extra SQL statement to populate a user read acl cache before running the query.- Since:
- 5.5
-
needsNullsLastOnDescSort
public boolean needsNullsLastOnDescSort()True if the dialect need an extra NULLS LAST on DESC sort.- Since:
- 5.9
-
getClobCast
When using a CLOB field in an expression, is some casting required and with what pattern?Needed for H2.
- 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
Gets the SQL to use to refer to a column in an expression.Needed for Oracle CLOB.
- Parameters:
column
- the column used in an expression- Returns:
- the SQL to use to refer to it
- Since:
- 10.10
-
getDateCast
Get the expression to use to cast a column to a DATE type.- Returns:
- a pattern for String.format with one parameter for the column name
- Since:
- 5.6
-
castIdToVarchar
Casts an id column to a VARCHAR type.Used for uuid/varchar joins.
- Returns:
- the casted expression
- Since:
- 5.7
-
getIdType
Gets the type of id when stored in the database.- Since:
- 5.7
-
getSecurityCheckSql
Gets the expression to use to check security.- 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
-
supportsAncestorsTable
public boolean supportsAncestorsTable()Checks if the dialect supports an ancestors table. -
supportsFastDescendants
public boolean supportsFastDescendants()Checks whethergetInTreeSql(String, String)
is optimized for fast results (using an ancestors or descendants table).- Since:
- 7.10, 6.0-HF21
-
getInTreeSql
Gets the expression to use to check tree membership.- 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
-
supportsArrays
public boolean supportsArrays()Does the dialect support passing ARRAY values (to stored procedures mostly).If not, we'll simulate them using a string and a separator.
- Returns:
- true if ARRAY values are supported
-
supportsArraysReturnInsteadOfRows
public 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.Oracle needs this.
-
getArrayResult
Gets the array result as a converted array of Serializable.- Throws:
SQLException
- Since:
- 5.9.3
-
supportsSysNameArray
public boolean supportsSysNameArray()Checks if the dialect supports storing arrays of system names (for mixins for instance). -
supportsArrayColumns
public boolean supportsArrayColumns()Does the dialect support storing arrays in table columns.- Returns:
- true if ARRAY columns are supported
-
getArraySubQuery
Gets the dialect-specific subquery for an array column. -
getArrayElementString
Get SQL Array Element Subscripted string. -
getArrayInSql
public String getArrayInSql(Column arrayColumn, String cast, boolean positive, List<Serializable> params) Gets the SQL string for an array column IN expression. -
getArrayLikeSql
public String getArrayLikeSql(Column arrayColumn, String refName, boolean positive, Table dataHierTable) Gets the SQL string for an array column LIKE expression. -
getArrayIlikeSql
public String getArrayIlikeSql(Column arrayColumn, String refName, boolean positive, Table dataHierTable) Gets the SQL string for an array column ILIKE expression. -
createArrayOf
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.)- Parameters:
type
- the SQL type of the elementselements
- the elements of the arrayconnection
- the connection- Returns:
- an Array holding the elements
- Throws:
SQLException
-
getUpsertSql
public abstract String getUpsertSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues) Gets the SQL string for an UPSERT expression.- 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- Since:
- 10.10
-
getInsertOnConflictDoNothingSql
public String getInsertOnConflictDoNothingSql(List<Column> columns, List<Serializable> values, List<Column> outColumns, List<Serializable> outValues) Gets the SQL string for an INSERT ... ON CONFLICT DO NOTHING expression.- 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- Since:
- 11.1
-
getSQLStatementsFilename
Gets the name of the file containing the SQL statements. -
getTestSQLStatementsFilename
-
getSQLStatementsProperties
Gets the properties to use with the SQL statements. -
isClusteringSupported
public boolean isClusteringSupported()Checks that clustering is supported. -
isClusteringDeleteNeeded
public boolean isClusteringDeleteNeeded()Does clustering fetch of invalidations (getClusterGetInvalidations()
) need a separate delete for them. -
getClusterInsertInvalidations
Gets the SQL to send an invalidation to the cluster.- Returns:
- an SQL statement with parameters for: nodeId, id, fragments, kind
-
getClusterGetInvalidations
Gets the SQL to query invalidations for this cluster node.- Returns:
- an SQL statement returning a result set
-
supportsIlike
public boolean supportsIlike()Does the dialect support ILIKE operator -
supportsReadAcl
public boolean supportsReadAcl()Does the dialect support an optimized read security checks -
supportsWith
public boolean supportsWith()Does the dialect support SQL-99 WITH common table expressions. -
hasNullEmptyString
public boolean hasNullEmptyString()Does the dialect have an empty string identical to NULL (Oracle). -
getMaximumArgsForIn
public int getMaximumArgsForIn()Maximum number of values in a IN (?, ?, ...) statement.Beyond this size we'll do the query in several chunks.
PostgreSQL is limited to 65535 values in a prepared statement.
Oracle is limited to 1000 expressions in a list (ORA-01795).
-
getUpdateReadAclsSql
Gets the statement to update the read acls -
getRebuildReadAclsSql
Gets the statement to rebuild the wall read acls -
getReadAclsCheckSql
Gets the expression to check if access is allowed using read acls. The dialect must suppportsReadAcl.- 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
-
getPrepareUserReadAclsSql
Gets the SQL expression to prepare the user read acls cache. This can be used to populate a table cache.- Returns:
- and SQL expression with one parameter (principals)
- Since:
- 5.5
-
getStartupSqls
Gets the sql statements to execute after the repository init (at startup).Used for vacuum-like operations.
- Since:
- 6.0-HF24, 7.10-HF01, 8.1
-
isConcurrentUpdateException
Checks if an exception received means that a concurrent update was detected.- Since:
- 5.8
-
performAdditionalStatements
Let the dialect processes additional statements after tables creation and conditional statements. Can be used for specific upgrade procedure.- Throws:
SQLException
-
getValidationQuery
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.
-
getBlobLengthFunction
Gets the SQL function that returns the length of a blob, in bytes. -
performPostOpenStatements
Let the dialect perform additional statements just after the connection is opened.- Throws:
SQLException
-
getPostCreateIdentityColumnSql
Gets additional SQL statements to execute after the CREATE TABLE when creating an identity column.Oracle needs both a sequence and a trigger.
-
isIdentityAlreadyPrimary
public boolean isIdentityAlreadyPrimary()Checks if an identity column is already defined as a primary key and does not need a separate index added.MySQL defines the identity column directly as primary key.
-
hasIdentityGeneratedKey
public boolean hasIdentityGeneratedKey()True if the dialect returns the generated key for the identity from the insert statement.Oracle needs a separate call to CURRVAL.
-
getIdentityGeneratedKeySql
Gets the SQL query to execute to retrieve the last generated identity key.Oracle needs a separate call to CURRVAL.
-
getAncestorsIdsSql
Gets the SQL query to get the ancestors of a set of ids.- Returns:
- null if not available
-
getDescending
Gets the SQL descending sort direction with option to sort nulls last. Use to unify database behavior.- Returns:
- DESC or DESC NULLS LAST depending on dialects.
-
getIgnoredColumns
Columns ignored if we see them in existing tables. -
getCustomColumnDefinition
Additional column definitions for CREATE TABLE. -
getCustomPostCreateSqls
Additional things to execute after CREATE TABLE. -
getSoftDeleteSql
SQL to soft delete documents. SQL returned has free parameters for the array of ids and time. -
getSoftDeleteCleanupSql
SQL to clean soft-delete documents. SQL returned has free parameters max and beforeTime. -
getBinaryFulltextSql
Return the SQL to get the columns fulltext fields- Since:
- 5.9.3
-
checkStoredProcedure
public abstract List<String> checkStoredProcedure(String procName, String procCreate, String ddlMode, Connection connection, JDBCLogger logger, Map<String, Serializable> properties) throws SQLExceptionChecks 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.- 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
- Since:
- 6.0-HF24, 7.10-HF01, 8.1
-
getDumpStart
Returns the initial DDL statements to add to a DDL dump.- Returns:
- a list of SQL statements, usually empty
- Since:
- 6.0-HF24, 7.10-HF01, 8.1
-
getDumpStop
Returns the final DDL statements to add to a DDL dump.- Returns:
- a list of SQL statements, usually empty
- Since:
- 6.0-HF24, 7.10-HF01, 8.1
-
getSQLForDump
Returns the SQL statement with proper terminator to use in a dump.- Returns:
- the SQL statement
- Since:
- 6.0-HF24, 7.10-HF01, 8.1
-
supportsBatchUpdateCount
public boolean supportsBatchUpdateCount()Does the dialect report accurate update counts for batch updates.- Since:
- 9.2
-
registerReturnParameter
public void registerReturnParameter(PreparedStatement ps, int parameterIndex, int sqlType) throws SQLException Registers return parameters.Used for Oracle "DML Returning".
- Throws:
SQLException
- Since:
- 10.10
-
getReturnResultSet
Gets returnResultSet
.Used for Oracle "DML Returning".
- Throws:
SQLException
- Since:
- 10.10
-