Class MySQLDictionary

    • Field Detail

      • DELIMITER_BACK_TICK

        public static final java.lang.String DELIMITER_BACK_TICK
        See Also:
        Constant Field Values
      • tableType

        public java.lang.String tableType
        The MySQL table type to use when creating tables; defaults to innodb.
      • useClobs

        public boolean useClobs
        Whether to use clobs; defaults to true. Set this to false if you have an old version of MySQL which does not handle clobs properly.
      • driverDeserializesBlobs

        public boolean driverDeserializesBlobs
        Whether the driver automatically deserializes blobs.
      • optimizeMultiTableDeletes

        public boolean optimizeMultiTableDeletes
        Whether to inline multi-table bulk-delete operations into MySQL's combined DELETE FROM foo, bar, baz syntax. Defaults to false, since this may fail in the presence of InnoDB tables with foreign keys.
      • tinyBlobTypeName

        public static final java.lang.String tinyBlobTypeName
        See Also:
        Constant Field Values
      • mediumBlobTypeName

        public static final java.lang.String mediumBlobTypeName
        See Also:
        Constant Field Values
      • longBlobTypeName

        public static final java.lang.String longBlobTypeName
        See Also:
        Constant Field Values
      • tinyTextTypeName

        public static final java.lang.String tinyTextTypeName
        See Also:
        Constant Field Values
      • mediumTextTypeName

        public static final java.lang.String mediumTextTypeName
        See Also:
        Constant Field Values
      • longTextTypeName

        public static final java.lang.String longTextTypeName
        See Also:
        Constant Field Values
    • Constructor Detail

      • MySQLDictionary

        public MySQLDictionary()
    • Method Detail

      • connectedConfiguration

        public void connectedConfiguration​(java.sql.Connection conn)
                                    throws java.sql.SQLException
        Description copied from class: DBDictionary
        This method is called when the dictionary first sees any connection. It is used to initialize dictionary metadata if needed. If you override this method, be sure to call super.connectedConfiguration.
        Overrides:
        connectedConfiguration in class DBDictionary
        Throws:
        java.sql.SQLException
      • decorate

        public java.sql.Connection decorate​(java.sql.Connection conn)
                                     throws java.sql.SQLException
        Description copied from class: DBDictionary
        Decorate the given connection if needed. Some databases require special handling for JDBC bugs. This implementation issues any DBDictionary.initializationSQL that has been set for the dictionary but does not decorate the connection.
        Specified by:
        decorate in interface ConnectionDecorator
        Overrides:
        decorate in class DBDictionary
        Throws:
        java.sql.SQLException
      • getCreateTableSQL

        public java.lang.String[] getCreateTableSQL​(Table table)
        Description copied from class: DBDictionary
        Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
        Overrides:
        getCreateTableSQL in class DBDictionary
      • getDropIndexSQL

        public java.lang.String[] getDropIndexSQL​(Index index)
        Description copied from class: DBDictionary
        Return a series of SQL statements to drop the given index. Returns DROP INDEX <index name> by default.
        Overrides:
        getDropIndexSQL in class DBDictionary
      • getDropForeignKeySQL

        public java.lang.String[] getDropForeignKeySQL​(ForeignKey fk,
                                                       java.sql.Connection conn)
        Return ALTER TABLE <table name> DROP FOREIGN KEY <fk name>.
        Overrides:
        getDropForeignKeySQL in class DBDictionary
      • getAddPrimaryKeySQL

        public java.lang.String[] getAddPrimaryKeySQL​(PrimaryKey pk)
        Description copied from class: DBDictionary
        Return a series of SQL statements to add the given primary key to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD <pk cons sql > by default.
        Overrides:
        getAddPrimaryKeySQL in class DBDictionary
      • getDeleteTableContentsSQL

        public java.lang.String[] getDeleteTableContentsSQL​(Table[] tables,
                                                            java.sql.Connection conn)
        Description copied from class: DBDictionary
        Create SQL to delete the contents of the specified tables. The default implementation drops all non-deferred RESTRICT foreign key constraints involving the specified tables, issues DELETE statements against the tables, and then adds the dropped constraints back in. Databases with more optimal ways of deleting the contents of several tables should override this method.
        Overrides:
        getDeleteTableContentsSQL in class DBDictionary
      • appendSelectRange

        protected void appendSelectRange​(SQLBuffer buf,
                                         long start,
                                         long end,
                                         boolean subselect)
        Description copied from class: DBDictionary
        If this dictionary can select ranges, use this method to append the range SQL.
        Overrides:
        appendSelectRange in class DBDictionary
      • newColumn

        protected Column newColumn​(java.sql.ResultSet colMeta)
                            throws java.sql.SQLException
        Description copied from class: DBDictionary
        Create a new column from the information in the schema metadata.
        Overrides:
        newColumn in class DBDictionary
        Throws:
        java.sql.SQLException
      • getBlobObject

        public java.lang.Object getBlobObject​(java.sql.ResultSet rs,
                                              int column,
                                              JDBCStore store)
                                       throws java.sql.SQLException
        Description copied from class: DBDictionary
        Convert the specified column of the SQL ResultSet to the proper java type.
        Overrides:
        getBlobObject in class DBDictionary
        Throws:
        java.sql.SQLException
      • getPreferredType

        public int getPreferredType​(int type)
        Description copied from class: DBDictionary
        Return the preferred Types type for the given one. Returns the given type by default.
        Overrides:
        getPreferredType in class DBDictionary
      • appendXmlComparison

        public void appendXmlComparison​(SQLBuffer buf,
                                        java.lang.String op,
                                        FilterValue lhs,
                                        FilterValue rhs,
                                        boolean lhsxml,
                                        boolean rhsxml)
        Append XML comparison.
        Overrides:
        appendXmlComparison in class DBDictionary
        Parameters:
        buf - the SQL buffer to write the comparison
        op - the comparison operation to perform
        lhs - the left hand side of the comparison
        rhs - the right hand side of the comparison
        lhsxml - indicates whether the left operand maps to XML
        rhsxml - indicates whether the right operand maps to XML
      • matchErrorState

        protected int matchErrorState​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> errorStates,
                                      java.sql.SQLException ex)
        Description copied from class: DBDictionary
        Determine the more appropriate type of store exception by matching the SQL Error State of the the given SQLException to the given Error States categorized by error types. Dictionary subclass can override this method and extract SQLException data to figure out if the exception is recoverable.
        Overrides:
        matchErrorState in class DBDictionary
        Parameters:
        errorStates - classification of SQL error states by their specific nature. The keys of the map represent one of the constants defined in StoreException. The value corresponding to a key represent the set of SQL Error States representing specific category of database error. This supplied map is sourced from sql-error-state-codes.xml and filtered the error states for the current database.
        ex - original SQL Exception as raised by the database driver.
        Returns:
        A constant indicating the category of error as defined in StoreException.
      • isFatalException

        public boolean isFatalException​(int subtype,
                                        java.sql.SQLException ex)
        Description copied from class: DBDictionary
        Determine if the given SQL Exception is fatal or recoverable (such as a timeout). This implementation always returns true (i.e. all exceptions are fatal). The current dictionary implementation can overwrite this method to mark certain exception conditions as recoverable error.
        Overrides:
        isFatalException in class DBDictionary
        Parameters:
        subtype - A constant indicating the category of error as defined in StoreException.
        ex - original SQL Exception as raised by the database driver.
        Returns:
        false if the error is fatal.
      • indexOf

        public void indexOf​(SQLBuffer buf,
                            FilterValue str,
                            FilterValue find,
                            FilterValue start)
        Description copied from class: DBDictionary
        Invoke this database's indexOf function.
        Overrides:
        indexOf in class DBDictionary
        Parameters:
        buf - the SQL buffer to write the indexOf invocation to
        str - a query value representing the target string
        find - a query value representing the search string
        start - a query value representing the start index, or null to start at the beginning