Class H2Dictionary

    • Constructor Detail

      • H2Dictionary

        public H2Dictionary()
    • 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
      • 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
      • 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
      • getDropPrimaryKeySQL

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

        public java.lang.String[] getAddColumnSQL​(Column column)
        Description copied from class: DBDictionary
        Return a series of SQL statements to add the given column to its table. Return an empty array if operation not supported. Returns ALTER TABLE <table name> ADD (<col dec>) by default.
        Overrides:
        getAddColumnSQL in class DBDictionary
      • 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
      • isSystemIndex

        public boolean isSystemIndex​(java.lang.String name,
                                     Table table)
        Description copied from class: DBDictionary
        This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.
        Overrides:
        isSystemIndex in class DBDictionary
        Parameters:
        name - the index name
        table - the index table
      • isSystemIndex

        public boolean isSystemIndex​(DBIdentifier name,
                                     Table table)
        Description copied from class: DBDictionary
        This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.
        Overrides:
        isSystemIndex in class DBDictionary
        Parameters:
        name - the index name
        table - the index table
      • getSequencesSQL

        protected java.lang.String getSequencesSQL​(java.lang.String schemaName,
                                                   java.lang.String sequenceName)
        Description copied from class: DBDictionary
        Return the SQL needed to select the list of sequences.
        Overrides:
        getSequencesSQL in class DBDictionary
      • getColumns

        public Column[] getColumns​(java.sql.DatabaseMetaData meta,
                                   java.lang.String catalog,
                                   java.lang.String schemaName,
                                   java.lang.String tableName,
                                   java.lang.String columnName,
                                   java.sql.Connection conn)
                            throws java.sql.SQLException
        Description copied from class: DBDictionary
        Reflect on the schema to find columns matching the given table and column patterns.
        Overrides:
        getColumns in class DBDictionary
        Throws:
        java.sql.SQLException
      • setLocalDate

        public void setLocalDate​(java.sql.PreparedStatement stmnt,
                                 int idx,
                                 java.time.LocalDate val,
                                 Column col)
                          throws java.sql.SQLException
        Description copied from class: DBDictionary
        Set the given LocalDate value as a parameter to the statement.
        Overrides:
        setLocalDate in class DBDictionary
        Throws:
        java.sql.SQLException
      • getLocalDate

        public java.time.LocalDate getLocalDate​(java.sql.ResultSet rs,
                                                int column)
                                         throws java.sql.SQLException
        Description copied from class: DBDictionary
        Retrieve the specified column of the SQL ResultSet to the proper LocalDate java type.
        Overrides:
        getLocalDate in class DBDictionary
        Throws:
        java.sql.SQLException
      • setLocalTime

        public void setLocalTime​(java.sql.PreparedStatement stmnt,
                                 int idx,
                                 java.time.LocalTime val,
                                 Column col)
                          throws java.sql.SQLException
        Description copied from class: DBDictionary
        Set the given LocalTime value as a parameter to the statement.
        Overrides:
        setLocalTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • getLocalTime

        public java.time.LocalTime getLocalTime​(java.sql.ResultSet rs,
                                                int column)
                                         throws java.sql.SQLException
        Description copied from class: DBDictionary
        Retrieve the specified column of the SQL ResultSet to the proper LocalTime java type.
        Overrides:
        getLocalTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • setLocalDateTime

        public void setLocalDateTime​(java.sql.PreparedStatement stmnt,
                                     int idx,
                                     java.time.LocalDateTime val,
                                     Column col)
                              throws java.sql.SQLException
        Description copied from class: DBDictionary
        Set the given LocalTime value as a parameter to the statement.
        Overrides:
        setLocalDateTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • getLocalDateTime

        public java.time.LocalDateTime getLocalDateTime​(java.sql.ResultSet rs,
                                                        int column)
                                                 throws java.sql.SQLException
        Description copied from class: DBDictionary
        Retrieve the specified column of the SQL ResultSet to the proper LocalDateTime java type.
        Overrides:
        getLocalDateTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • setOffsetDateTime

        public void setOffsetDateTime​(java.sql.PreparedStatement stmnt,
                                      int idx,
                                      java.time.OffsetDateTime val,
                                      Column col)
                               throws java.sql.SQLException
        Description copied from class: DBDictionary
        Set the given LocalTime value as a parameter to the statement.
        Overrides:
        setOffsetDateTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • getInt

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

        public java.time.OffsetDateTime getOffsetDateTime​(java.sql.ResultSet rs,
                                                          int column)
                                                   throws java.sql.SQLException
        h2 does intentionally not support getTimestamp() for 'TIME WITH TIME ZONE' columns. See h2 ticket #413.
        Overrides:
        getOffsetDateTime in class DBDictionary
        Throws:
        java.sql.SQLException
      • 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
      • 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
      • 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.