public class DialectMySQL extends Dialect
Dialect.ArraySubQuery, Dialect.DialectIdType, Dialect.FulltextMatchInfo, Dialect.JDBCInfo
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 |
---|
DialectMySQL(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
|
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 |
getAddForeignKeyConstraintString(String constraintName,
String[] foreignKeys,
String referencedTable,
String[] primaryKeys,
boolean referencesPrimaryKey) |
String |
getBinaryFulltextSql(List<String> columns)
Return the SQL to get the columns fulltext fields
|
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 |
getDialectFulltextQuery(String query)
Get the dialect-specific version of a fulltext query.
|
Collection<? extends String> |
getDumpStart()
Returns the initial DDL statements to add to a DDL dump.
|
Collection<? extends String> |
getDumpStop()
Returns the final DDL statements to add to a DDL dump.
|
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.
|
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.
|
boolean |
getMaterializeFulltextSyntheticColumn()
Does the fulltext synthetic column have to be materialized.
|
protected int |
getMaxNameSize() |
String |
getSecurityCheckSql(String idColumnName)
Gets the expression to use to check security.
|
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.
|
String |
getTableTypeString(Table table) |
String |
getTestSQLStatementsFilename() |
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.
|
boolean |
isIdentityAlreadyPrimary()
Checks if an identity column is already defined as a primary key and does not need a separate index added.
|
boolean |
needsAliasForDerivedTable()
Whether a derived table (subselect in a FROM statement) needs an alias.
|
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?
|
protected static String |
normalizeString(String string) |
char |
openQuote() |
boolean |
qualifyIndexName() |
void |
setToPreparedStatement(PreparedStatement ps,
int index,
Serializable value,
Column column) |
boolean |
supportsIfExistsBeforeTableName() |
boolean |
supportsPaging()
Indicates if dialect supports paging
|
boolean |
supportsUpdateFrom()
Does the dialect support UPDATE t SET ...
|
protected static void |
translateForMySQL(FulltextQueryAnalyzer.FulltextQuery ft,
FulltextQueryAnalyzer.Op superOp,
StringBuilder buf) |
castIdToVarchar, createArrayOf, createDialect, getAddColumnString, getAddPrimaryKeyConstraintString, getAncestorsIdsSql, getArrayElementString, getArrayIlikeSql, getArrayInSql, getArrayLikeSql, getArrayResult, getArraySubQuery, getBlobLengthFunction, getCalendarFromTimestamp, getCalendarFromTimestamp, getCascadeDropConstraintsString, getClobCast, getColumnName, getConnectionSchema, getCreateIndexSql, getCustomColumnDefinition, getCustomPostCreateSqls, getDateCast, getDescending, getForeignKeyConstraintName, getFreeVariableSetterForType, getFromResultSetString, getFromResultSetTimestamp, getFulltextType, getGeneratedId, getIdentityGeneratedKeySql, getIdType, getIgnoredColumns, getIndexName, getLikeEscaping, getMatchMixinType, getMaximumArgsForIn, getMaxIndexNameSize, getNoColumnsInsertString, getNullColumnString, getPostCreateIdentityColumnSql, getPrepareUserReadAclsSql, getPrimaryKeyConstraintName, getReadAclsCheckSql, getRebuildReadAclsSql, getSoftDeleteCleanupSql, getSoftDeleteSql, getStartupSqls, getTableName, getTimestampFromCalendar, getTimestampFromCalendar, getUpdateReadAclsSql, getValidationQuery, hasIdentityGeneratedKey, hasNullEmptyString, jdbcInfo, jdbcInfo, jdbcInfo, jdbcInfo, makeName, makeName, needsNullsLastOnDescSort, needsOracleJoins, needsOriginalColumnInGroupBy, needsPrepareUserReadAcls, performAdditionalStatements, performPostOpenStatements, setId, setIdLong, setToPreparedStatementString, setToPreparedStatementTimestamp, storesUpperCaseIdentifiers, supportsAncestorsTable, supportsArrayColumns, supportsArrays, supportsArraysReturnInsteadOfRows, supportsCircularCascadeDeleteConstraints, supportsFastDescendants, supportsIfExistsAfterTableName, supportsIlike, supportsMultipleFulltextIndexes, supportsReadAcl, supportsScroll, supportsSysNameArray, supportsWith, toBooleanValueString, toHexString
public DialectMySQL(DatabaseMetaData metadata, RepositoryDescriptor repositoryDescriptor)
public char closeQuote()
closeQuote
in class Dialect
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKeys, String referencedTable, String[] primaryKeys, boolean referencesPrimaryKey)
getAddForeignKeyConstraintString
in class Dialect
public boolean qualifyIndexName()
qualifyIndexName
in class Dialect
public boolean supportsIfExistsBeforeTableName()
supportsIfExistsBeforeTableName
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 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 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 stringprotected static void translateForMySQL(FulltextQueryAnalyzer.FulltextQuery ft, FulltextQueryAnalyzer.Op superOp, StringBuilder buf)
public Dialect.FulltextMatchInfo getFulltextScoredMatchInfo(String fulltextQuery, String indexName, int nthMatch, Column mainColumn, Model model, Database database)
Dialect
getFulltextScoredMatchInfo
in class Dialect
public boolean getMaterializeFulltextSyntheticColumn()
Dialect
getMaterializeFulltextSyntheticColumn
in class Dialect
public int getFulltextIndexedColumns()
Dialect
getFulltextIndexedColumns
in class Dialect
public String getTableTypeString(Table table)
getTableTypeString
in class Dialect
public boolean supportsUpdateFrom()
Dialect
supportsUpdateFrom
in class Dialect
public boolean doesUpdateFromRepeatSelf()
Dialect
doesUpdateFromRepeatSelf
in class Dialect
public boolean needsOrderByKeysAfterDistinct()
Dialect
needsOrderByKeysAfterDistinct
in class Dialect
public boolean needsAliasForDerivedTable()
Dialect
needsAliasForDerivedTable
in class Dialect
public String getSecurityCheckSql(String idColumnName)
Dialect
getSecurityCheckSql
in class Dialect
idColumnName
- the quoted name of the id column to usepublic 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
public boolean isConcurrentUpdateException(Throwable t)
Dialect
isConcurrentUpdateException
in class Dialect
public boolean isClusteringSupported()
Dialect
isClusteringSupported
in class Dialect
public boolean isClusteringDeleteNeeded()
Dialect
Dialect.getClusterGetInvalidations()
) need a separate delete for them.isClusteringDeleteNeeded
in class Dialect
public String getClusterInsertInvalidations()
Dialect
getClusterInsertInvalidations
in class Dialect
public String getClusterGetInvalidations()
Dialect
getClusterGetInvalidations
in class Dialect
public boolean supportsPaging()
Dialect
supportsPaging
in class Dialect
public String addPagingClause(String sql, long limit, long offset)
Dialect
addPagingClause
in class Dialect
public boolean isIdentityAlreadyPrimary()
Dialect
MySQL defines the identity column directly as primary key.
isIdentityAlreadyPrimary
in class Dialect
public String getBinaryFulltextSql(List<String> columns)
Dialect
getBinaryFulltextSql
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 Collection<? extends String> getDumpStart()
Dialect
getDumpStart
in class Dialect
public Collection<? extends String> getDumpStop()
Dialect
getDumpStop
in class Dialect
public String getSQLForDump(String sql)
Dialect
getSQLForDump
in class Dialect
Copyright © 2016 Nuxeo SA. All rights reserved.