Class DialectMySQL


  • public class DialectMySQL
    extends Dialect
    MySQL-specific dialect.
    Author:
    Florent Guillaume
    • Field Detail

      • disableVersionACL

        protected final boolean disableVersionACL
      • disableReadVersionPermission

        protected final boolean disableReadVersionPermission
    • Method Detail

      • 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 class Dialect
      • getDialectFulltextQuery

        public String getDialectFulltextQuery​(String query)
        Description copied from class: Dialect
        Get the dialect-specific version of a fulltext query.
        Specified by:
        getDialectFulltextQuery in class Dialect
        Parameters:
        query - the CMIS-syntax-based fulltext query string
        Returns:
        the dialect native fulltext query string
      • getMaterializeFulltextSyntheticColumn

        public boolean getMaterializeFulltextSyntheticColumn()
        Description copied from class: Dialect
        Does the fulltext synthetic column have to be materialized.
        Specified by:
        getMaterializeFulltextSyntheticColumn in class Dialect
      • getFulltextIndexedColumns

        public int getFulltextIndexedColumns()
        Description copied from class: Dialect
        Specifies what columns of the fulltext table have to be indexed.
        Specified by:
        getFulltextIndexedColumns in class Dialect
        Returns:
        0 for none, 1 for the synthetic one, 2 for the individual ones
      • supportsUpdateFrom

        public boolean supportsUpdateFrom()
        Description copied from class: Dialect
        Does the dialect support UPDATE t SET ... FROM t, u WHERE ... ?
        Specified by:
        supportsUpdateFrom in class Dialect
      • 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 class Dialect
      • needsOrderByKeysAfterDistinct

        public boolean needsOrderByKeysAfterDistinct()
        Description copied from class: Dialect
        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?
        Overrides:
        needsOrderByKeysAfterDistinct in class Dialect
      • needsAliasForDerivedTable

        public boolean needsAliasForDerivedTable()
        Description copied from class: Dialect
        Whether a derived table (subselect in a FROM statement) needs an alias.
        Overrides:
        needsAliasForDerivedTable in class Dialect
      • getSecurityCheckSql

        public String getSecurityCheckSql​(String idColumnName)
        Description copied from class: Dialect
        Gets the expression to use to check security.
        Specified by:
        getSecurityCheckSql in class Dialect
        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
      • 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 class Dialect
        Parameters:
        idColumnName - the quoted name of the id column to use
        id - 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 class Dialect
        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 statement
        outValues - 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 class Dialect
        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 statement
        outValues - the values to use in the prepared statement
      • getSQLStatementsFilename

        public String getSQLStatementsFilename()
        Description copied from class: Dialect
        Gets the name of the file containing the SQL statements.
        Specified by:
        getSQLStatementsFilename in class Dialect
      • 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 class Dialect
      • isClusteringSupported

        public boolean isClusteringSupported()
        Description copied from class: Dialect
        Checks that clustering is supported.
        Overrides:
        isClusteringSupported in class Dialect
      • getClusterInsertInvalidations

        public String getClusterInsertInvalidations()
        Description copied from class: Dialect
        Gets the SQL to send an invalidation to the cluster.
        Overrides:
        getClusterInsertInvalidations in class Dialect
        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 class Dialect
        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 class Dialect
        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 class Dialect
      • isIdentityAlreadyPrimary

        public boolean isIdentityAlreadyPrimary()
        Description copied from class: Dialect
        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.

        Overrides:
        isIdentityAlreadyPrimary in class Dialect
      • 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 class Dialect
        Parameters:
        procName - the stored procedure name
        procCreate - the creation SQL for the stored procedure
        ddlMode - the DDL mode
        connection - the connection
        logger - the logger
        properties - the statement execution properties
        Returns:
        a list of SQL statements
        Throws:
        SQLException
      • normalizeString

        protected static String normalizeString​(String string)
      • getDumpStart

        public Collection<? extends String> getDumpStart()
        Description copied from class: Dialect
        Returns the initial DDL statements to add to a DDL dump.
        Overrides:
        getDumpStart in class Dialect
        Returns:
        a list of SQL statements, usually empty
      • getDumpStop

        public Collection<? extends String> getDumpStop()
        Description copied from class: Dialect
        Returns the final DDL statements to add to a DDL dump.
        Overrides:
        getDumpStop in class Dialect
        Returns:
        a list of SQL statements, usually empty
      • 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 class Dialect
        Returns:
        the SQL statement