public class DialectSQLServer extends Dialect
Dialect.ArraySubQuery, Dialect.DialectIdType, Dialect.FulltextMatchInfo, Dialect.JDBCInfo
Modifier and Type | Field and Description |
---|---|
protected boolean |
azure |
static String |
CLUSTER_INDEX_COL
Column containing an IDENTITY used to create a clustered index.
|
protected int |
engineEdition
5 = Azure
|
protected String |
fulltextAnalyzer |
protected String |
fulltextCatalog |
protected String |
idSequenceName |
protected Dialect.DialectIdType |
idType |
protected int |
majorVersion
9 = SQL Server 2005, 10 = SQL Server 2008, 11 = SQL Server 2012 / Azure
|
protected boolean |
pathOptimizationsEnabled |
protected String |
usersSeparator |
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 and Description |
---|
DialectSQLServer(DatabaseMetaData metadata,
RepositoryDescriptor repositoryDescriptor) |
Modifier and Type | Method and Description |
---|---|
String |
addPagingClause(String sql,
long limit,
long offset)
Returns the SQL query with a paging clause
|
String |
castIdToVarchar(String expr)
Casts an id column to a VARCHAR type.
|
protected void |
checkDatabaseConfiguration(Connection connection) |
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.
|
char |
closeQuote() |
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.
|
String |
getBlobLengthFunction()
Gets the SQL function that returns the length of a blob, in bytes.
|
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 |
getCreateFulltextIndexSql(String indexName,
String quotedIndexName,
Table table,
List<Column> columns,
Model model)
Gets a CREATE INDEX statement for a fulltext index.
|
String |
getCustomColumnDefinition(Table table)
Additional column definitions for CREATE TABLE.
|
List<String> |
getCustomPostCreateSqls(Table table)
Additional things to execute after CREATE TABLE.
|
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.
|
protected int |
getEngineEdition(Connection connection) |
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.
|
Dialect.DialectIdType |
getIdType()
Gets the type of id when stored in the database.
|
List<String> |
getIgnoredColumns(Table table)
Columns ignored if we see them in existing tables.
|
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 |
getMaxNameSize() |
protected String |
getMd5HashString() |
String |
getNoColumnsInsertString(Column idColumn) |
String |
getNullColumnString() |
String |
getPrepareUserReadAclsSql()
Gets the SQL expression to prepare the user read acls cache.
|
protected String |
getQuotedFulltextAnalyzer() |
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 acls
|
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 acls
|
String |
getUsersSeparator() |
boolean |
isAllowedConversion(int expected,
int actual,
String actualName,
int actualSize)
Check mismatches between expected and actual JDBC types read from database introspection.
|
boolean |
isClusteringSupported()
Checks that clustering is supported.
|
boolean |
isConcurrentUpdateException(Throwable t)
Checks if an exception received means that a concurrent update was detected.
|
boolean |
needsAliasForDerivedTable()
Whether a derived table (subselect in a FROM statement) needs an alias.
|
protected boolean |
needsClusteredColumn(Table table)
Tables created for directories don't need a clustered column automatically defined.
|
boolean |
needsOriginalColumnInGroupBy()
Whether a GROUP BY can only be used with the original column name and not an alias.
|
protected static String |
normalizeString(String string) |
char |
openQuote() |
void |
performPostOpenStatements(Connection connection)
Set transaction isolation level to snapshot
|
boolean |
qualifyIndexName() |
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 |
supportsCircularCascadeDeleteConstraints() |
boolean |
supportsFastDescendants()
Checks whether
#getInTreeSQL is optimized for fast results (using an ancestors or descendants table). |
protected boolean |
supportsLockEscalationDisable() |
boolean |
supportsMultipleFulltextIndexes()
SQL Server supports only one fulltext index.
|
boolean |
supportsPaging()
Indicates if dialect supports paging
|
boolean |
supportsReadAcl()
Does the dialect support an optimized read security checks
|
boolean |
supportsUpdateFrom()
Does the dialect support UPDATE t SET ...
|
createArrayOf, createDialect, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getArrayElementString, getArrayIlikeSql, getArrayInSql, getArrayLikeSql, getArrayResult, getArraySubQuery, getBinaryFulltextSql, getCalendarFromTimestamp, getCalendarFromTimestamp, getCascadeDropConstraintsString, getClobCast, getColumnName, getConnectionSchema, getCreateIndexSql, getDescending, getDumpStart, getDumpStop, getForeignKeyConstraintName, getFreeVariableSetterForType, getFromResultSetString, getFromResultSetTimestamp, getFulltextType, getIdentityGeneratedKeySql, getIndexName, getMatchMixinType, getMaximumArgsForIn, getMaxIndexNameSize, getPostCreateIdentityColumnSql, getPrimaryKeyConstraintName, getTableName, getTableTypeString, getTimestampFromCalendar, getTimestampFromCalendar, getValidationQuery, hasIdentityGeneratedKey, hasNullEmptyString, isClusteringDeleteNeeded, isIdentityAlreadyPrimary, jdbcInfo, jdbcInfo, jdbcInfo, jdbcInfo, makeName, makeName, needsNullsLastOnDescSort, needsOracleJoins, needsOrderByKeysAfterDistinct, needsPrepareUserReadAcls, performAdditionalStatements, setIdLong, setToPreparedStatementString, setToPreparedStatementTimestamp, storesUpperCaseIdentifiers, supportsAncestorsTable, supportsArrayColumns, supportsArrays, supportsArraysReturnInsteadOfRows, supportsIfExistsAfterTableName, supportsIfExistsBeforeTableName, supportsIlike, supportsSysNameArray, supportsWith, toBooleanValueString, toHexString
public static final String CLUSTER_INDEX_COL
protected final String fulltextAnalyzer
protected final String fulltextCatalog
protected final String usersSeparator
protected final Dialect.DialectIdType idType
protected String idSequenceName
protected boolean pathOptimizationsEnabled
protected int majorVersion
protected int engineEdition
protected boolean azure
public DialectSQLServer(DatabaseMetaData metadata, RepositoryDescriptor repositoryDescriptor)
public boolean supportsPaging()
Dialect
supportsPaging
in class Dialect
public String addPagingClause(String sql, long limit, long offset)
Dialect
addPagingClause
in class Dialect
protected int getEngineEdition(Connection connection) throws SQLException
SQLException
protected void checkDatabaseConfiguration(Connection connection) throws SQLException
SQLException
public char closeQuote()
closeQuote
in class Dialect
public String getNoColumnsInsertString(Column idColumn)
getNoColumnsInsertString
in class Dialect
public String getNullColumnString()
getNullColumnString
in class Dialect
public boolean qualifyIndexName()
qualifyIndexName
in class Dialect
public String getAddColumnString()
getAddColumnString
in class Dialect
public Dialect.JDBCInfo getJDBCTypeAndString(ColumnType type)
Dialect
getJDBCTypeAndString
in class Dialect
public boolean isAllowedConversion(int expected, int actual, String actualName, int actualSize)
Dialect
isAllowedConversion
in class Dialect
public void setId(PreparedStatement ps, int index, Serializable value) throws SQLException
Dialect
setId
in class Dialect
ps
- the prepared statementindex
- the parameter index in the prepared statementvalue
- the value to setSQLException
public void setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column) throws SQLException
setToPreparedStatement
in class Dialect
SQLException
public Serializable getFromResultSet(ResultSet rs, int index, Column column) throws SQLException
getFromResultSet
in class Dialect
SQLException
protected int getMaxNameSize()
getMaxNameSize
in class Dialect
public boolean getMaterializeFulltextSyntheticColumn()
Dialect
getMaterializeFulltextSyntheticColumn
in class Dialect
public int getFulltextIndexedColumns()
Dialect
getFulltextIndexedColumns
in class Dialect
public boolean supportsMultipleFulltextIndexes()
Dialect
supportsMultipleFulltextIndexes
in class Dialect
public String getCreateFulltextIndexSql(String indexName, String quotedIndexName, Table table, List<Column> columns, Model model)
Dialect
getCreateFulltextIndexSql
in class Dialect
public String getDialectFulltextQuery(String query)
Dialect
getDialectFulltextQuery
in class Dialect
query
- the CMIS-syntax-based fulltext query stringpublic Dialect.FulltextMatchInfo getFulltextScoredMatchInfo(String fulltextQuery, String indexName, int nthMatch, Column mainColumn, Model model, Database database)
Dialect
getFulltextScoredMatchInfo
in class Dialect
protected String getQuotedFulltextAnalyzer()
public String getLikeEscaping()
Dialect
getLikeEscaping
in class Dialect
public boolean supportsCircularCascadeDeleteConstraints()
supportsCircularCascadeDeleteConstraints
in class Dialect
public boolean supportsUpdateFrom()
Dialect
supportsUpdateFrom
in class Dialect
public boolean doesUpdateFromRepeatSelf()
Dialect
doesUpdateFromRepeatSelf
in class Dialect
public boolean needsAliasForDerivedTable()
Dialect
needsAliasForDerivedTable
in class Dialect
public boolean needsOriginalColumnInGroupBy()
Dialect
needsOriginalColumnInGroupBy
in class Dialect
public String getSecurityCheckSql(String idColumnName)
Dialect
getSecurityCheckSql
in class Dialect
idColumnName
- the quoted name of the id column to usepublic boolean supportsFastDescendants()
Dialect
#getInTreeSQL
is optimized for fast results (using an ancestors or descendants table).supportsFastDescendants
in class Dialect
public String getInTreeSql(String idColumnName, String id)
Dialect
getInTreeSql
in class Dialect
idColumnName
- the quoted name of the id column to useid
- the id, to check syntax with respect to specialized id column typesnull
if the query cannot matchpublic String getSQLStatementsFilename()
Dialect
getSQLStatementsFilename
in class Dialect
public String getTestSQLStatementsFilename()
getTestSQLStatementsFilename
in class Dialect
public Map<String,Serializable> getSQLStatementsProperties(Model model, Database database)
Dialect
getSQLStatementsProperties
in class Dialect
protected String getMd5HashString()
protected boolean supportsLockEscalationDisable()
public boolean supportsReadAcl()
Dialect
supportsReadAcl
in class Dialect
public String getPrepareUserReadAclsSql()
Dialect
getPrepareUserReadAclsSql
in class Dialect
public String getReadAclsCheckSql(String userIdCol)
Dialect
getReadAclsCheckSql
in class Dialect
userIdCol
- the quoted name of the aclr_user_map user_id column to usepublic String getUpdateReadAclsSql()
Dialect
getUpdateReadAclsSql
in class Dialect
public String getRebuildReadAclsSql()
Dialect
getRebuildReadAclsSql
in class Dialect
public List<String> getStartupSqls(Model model, Database database)
Dialect
Used for vacuum-like operations.
getStartupSqls
in class Dialect
public boolean isClusteringSupported()
Dialect
isClusteringSupported
in class Dialect
public String getClusterInsertInvalidations()
Dialect
getClusterInsertInvalidations
in class Dialect
public String getClusterGetInvalidations()
Dialect
getClusterGetInvalidations
in class Dialect
public boolean isConcurrentUpdateException(Throwable t)
Dialect
isConcurrentUpdateException
in class Dialect
public String getBlobLengthFunction()
Dialect
getBlobLengthFunction
in class Dialect
public String getUsersSeparator()
public Serializable getGeneratedId(Connection connection) throws SQLException
Dialect
getGeneratedId
in class Dialect
SQLException
public void performPostOpenStatements(Connection connection) throws SQLException
performPostOpenStatements
in class Dialect
SQLException
public String getAncestorsIdsSql()
Dialect
getAncestorsIdsSql
in class Dialect
public String getDateCast()
Dialect
getDateCast
in class Dialect
public String castIdToVarchar(String expr)
Dialect
Used for uuid/varchar joins.
castIdToVarchar
in class Dialect
public Dialect.DialectIdType getIdType()
Dialect
public List<String> getIgnoredColumns(Table table)
Dialect
getIgnoredColumns
in class Dialect
protected boolean needsClusteredColumn(Table table)
public String getCustomColumnDefinition(Table table)
Dialect
getCustomColumnDefinition
in class Dialect
public List<String> getCustomPostCreateSqls(Table table)
Dialect
getCustomPostCreateSqls
in class Dialect
public String getSoftDeleteSql()
Dialect
getSoftDeleteSql
in class Dialect
public String getSoftDeleteCleanupSql()
Dialect
getSoftDeleteCleanupSql
in class Dialect
public List<String> checkStoredProcedure(String procName, String procCreate, String ddlMode, Connection connection, JDBCLogger logger, Map<String,Serializable> properties) throws SQLException
Dialect
There are 3 cases to deal with, and actions to perform:
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.
checkStoredProcedure
in class Dialect
procName
- the stored procedure nameprocCreate
- the creation SQL for the stored procedureddlMode
- the DDL modeconnection
- the connectionlogger
- the loggerproperties
- the statement execution propertiesSQLException
protected static String normalizeString(String string)
public String getSQLForDump(String sql)
Dialect
getSQLForDump
in class Dialect
Copyright © 2016 Nuxeo SA. All rights reserved.