Class AbstractDatabasePlatform

  • All Implemented Interfaces:
    DatabasePlatform, DatabasePlatformX

    public abstract class AbstractDatabasePlatform
    extends java.lang.Object
    implements DatabasePlatformX
    Provides information for interacting with a database.

    This information includes:

    1. The correct SQL for performing specific operations
    2. Information about the tables, columns, etc. in the database

    The responsibility of this class is to give you information about the underlying database. It should not be performing any data manipulation operations on IJC data (this is the responsibility of TableManager).

    To support a new database subclass this to provide the appropriate information for your database.

    This class also makes available an instance of DBDatabaseInfo which is provides static information about the database that can be used for information that does not need the database to be queries each time.

    Author:
    Tim Dudgeon
    See Also:
    DBDatabaseInfo
    • Constructor Detail

      • AbstractDatabasePlatform

        protected AbstractDatabasePlatform​(javax.sql.DataSource dds)
    • Method Detail

      • getLoadingSchemaContext

        public static java.util.Map<?,​?> getLoadingSchemaContext()
      • isLoadingSchema

        public static boolean isLoadingSchema()
      • getFilteringNodesContext

        public static java.util.Map<?,​?> getFilteringNodesContext()
      • isFilteringNodes

        public static boolean isFilteringNodes()
      • clearAllCaches

        public static void clearAllCaches​(java.lang.String jdbcConnectionURL)
      • getJdbcTemplate

        public final org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
        Specified by:
        getJdbcTemplate in interface DatabasePlatform
      • buildJChemPropertyTableNames

        public java.util.Set<java.lang.String> buildJChemPropertyTableNames()
        Description copied from interface: DatabasePlatform
        Build the known JChem property table names. These are cached until this method is called again. When the property tables change this method should be called to refresh the cache.
        Specified by:
        buildJChemPropertyTableNames in interface DatabasePlatform
        Returns:
        The names of JChem property tables.
      • getMetaTableNames

        public java.util.Set<java.lang.String> getMetaTableNames()
        Specified by:
        getMetaTableNames in interface DatabasePlatform
        Returns:
        The names of tables, that hold the schema metadata information
      • getTransactionManager

        public final org.springframework.jdbc.datasource.DataSourceTransactionManager getTransactionManager()
        Specified by:
        getTransactionManager in interface DatabasePlatform
      • getLobHandler

        public org.springframework.jdbc.support.lob.LobHandler getLobHandler()
        Specified by:
        getLobHandler in interface DatabasePlatform
      • preInitValidate

        protected void preInitValidate()
      • createDatabaseInfo

        protected abstract DBDatabaseInfo createDatabaseInfo​(java.lang.String dbIdentifierQuoteString)
      • sqlCreateTable

        public java.lang.String sqlCreateTable​(java.lang.String schemaPlusTable,
                                               java.util.List<DBDatabaseInfo.NativeType> columnDefs,
                                               java.util.List<java.lang.String> columnNames)
        Description copied from interface: DatabasePlatform
        Creates a table with the given name and the fields. The list of columnDefs cannot be empty or null; the table must contain at least one column. The list of column names must be the same size as column definitions; name at index "i" will be used for column defined by definition at index "i".
        Specified by:
        sqlCreateTable in interface DatabasePlatform
        Specified by:
        sqlCreateTable in interface DatabasePlatformX
        Parameters:
        schemaPlusTable - identifier of the table
        columnDefs - The column definitions
        columnNames - The column names
        Returns:
        SQL statement to create the table
      • getSchemaNames

        public java.util.List<java.lang.String> getSchemaNames()
        Description copied from interface: DatabasePlatform
        Get the list of schema names that are accessible to the user. If DB does not support schemas then an empty list is returned.
        Specified by:
        getSchemaNames in interface DatabasePlatform
        Returns:
        The names of the schemas
      • getUsedSchemas

        public java.util.List<java.lang.String> getUsedSchemas()
        Description copied from interface: DatabasePlatform
        Only used on sequences, please do not use this method.
        Specified by:
        getUsedSchemas in interface DatabasePlatform
        Returns:
        used schema by IJC schema
      • setUsedSchemas

        public void setUsedSchemas​(java.util.List<java.lang.String> usedSchemas)
      • getTableNames

        public java.lang.String[] getTableNames​(java.lang.String schema)
        Description copied from interface: DatabasePlatform
        Get the table names for the specified schema
        Specified by:
        getTableNames in interface DatabasePlatform
        Parameters:
        schema - The schema to look in. Should be null if the database does not support schemas
        Returns:
        The tables in this schema.
      • getViewNames

        public java.lang.String[] getViewNames​(java.lang.String schema)
        Description copied from interface: DatabasePlatform
        Get the view names for the specified schema
        Specified by:
        getViewNames in interface DatabasePlatform
        Parameters:
        schema - The schema to look in. Should be null if the database does not support schemas
        Returns:
        The views in this schema.
      • findPrimaryKeyColumnNames

        protected java.lang.String[] findPrimaryKeyColumnNames​(java.sql.DatabaseMetaData meta,
                                                               java.lang.String schema,
                                                               java.lang.String table,
                                                               boolean useCache)
                                                        throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • addPseudoColumnInfos

        public void addPseudoColumnInfos​(java.util.List<DBColInfo> cols,
                                         java.lang.String columnPattern)
        Add any magical pseudo columns such as Oracle's ROWID columns.
        Parameters:
        cols - collection to which pseudocolumns will be added
        columnPattern - Pattern for the columns. Can be null, in which case all pseudo columns are added. If a pattern is present then only pseudo columns conforming to the pattern are added. NOTE: columnPattern currently only supports a specific column name. Wildcards are not supported
      • buildColumnInfosForSchema

        public final java.util.Map<java.lang.String,​java.util.List<DBColInfo>> buildColumnInfosForSchema​(java.lang.String dbSchemaName)
      • buildColumnInfosForTable

        public final java.util.List<DBColInfo> buildColumnInfosForTable​(java.lang.String dbSchemaName,
                                                                        java.lang.String tableName)
        Description copied from interface: DatabasePlatform
        Build the DBColInfos for the table.
        Specified by:
        buildColumnInfosForTable in interface DatabasePlatform
        Parameters:
        dbSchemaName - The schema name
        tableName - The table name
        Returns:
        A list of DBColInfos for the table
      • buildColumnInfoForColumn

        public final DBColInfo buildColumnInfoForColumn​(java.lang.String dbSchemaName,
                                                        java.lang.String tableName,
                                                        java.lang.String columnName)
        Description copied from interface: DatabasePlatform
        Build the DBColInfos for the particlaar column.
        Specified by:
        buildColumnInfoForColumn in interface DatabasePlatform
        Parameters:
        dbSchemaName - The schema name
        tableName - The table name
        columnName - The column name to match
        Returns:
        The DBColInfo
      • doBuildColumnInfosImpl

        protected java.util.Map<java.lang.String,​java.util.List<DBColInfo>> doBuildColumnInfosImpl​(java.lang.String dbSchemaName,
                                                                                                         java.lang.String tableName,
                                                                                                         java.lang.String columnName)
      • buildSequenceInfo

        public java.util.List<DBSequenceInfo> buildSequenceInfo​(java.lang.String schema)
        Default implementation assumes sequences are not supported and returns an empty list.
        Specified by:
        buildSequenceInfo in interface DatabasePlatform
        Parameters:
        schema - schema for which the sequence infos should be built
        Returns:
        All the sequences from schema
      • buildSequenceInfo

        public DBSequenceInfo buildSequenceInfo​(java.lang.String schema,
                                                java.lang.String seqName)
        Default implementation assumes sequences are not supported and returns null.
        Specified by:
        buildSequenceInfo in interface DatabasePlatform
        Parameters:
        schema - schema to look into
        seqName - sequence name
        Returns:
        Null
      • buildForeignKeyInfosForSchema

        protected java.util.Map<java.lang.String,​com.im.commons.Pair<java.util.List<DBForeignKeyInfo>,​java.util.List<DBForeignKeyInfo>>> buildForeignKeyInfosForSchema​(java.lang.String schemaName,
                                                                                                                                                                                   boolean useCache)
      • buildImportedForeignKeyInfoForTable

        public java.util.List<DBForeignKeyInfo> buildImportedForeignKeyInfoForTable​(java.lang.String schemaName,
                                                                                    java.lang.String tableName,
                                                                                    boolean useCache)
        Description copied from interface: DatabasePlatform
        Build imported foreign key info.
        Specified by:
        buildImportedForeignKeyInfoForTable in interface DatabasePlatform
        Parameters:
        schemaName - The schema name
        tableName - The table name
        useCache - use SQL select caching
        Returns:
        The imported foreign keys
      • buildExportedForeignKeyInfoForTable

        public java.util.List<DBForeignKeyInfo> buildExportedForeignKeyInfoForTable​(java.lang.String schemaName,
                                                                                    java.lang.String tableName,
                                                                                    boolean useCache)
        Description copied from interface: DatabasePlatform
        Build exported foreign key info.
        Specified by:
        buildExportedForeignKeyInfoForTable in interface DatabasePlatform
        Parameters:
        schemaName - The schema name
        tableName - The table name
        useCache - use SQL select caching
        Returns:
        The exported foreign keys
      • buildIndexInfosForSchema

        protected java.util.Map<java.lang.String,​java.util.List<DBIndexInfo>> buildIndexInfosForSchema​(java.lang.String schemaName,
                                                                                                             boolean useCache)
      • buildIndexInfoForTable

        public java.util.List<DBIndexInfo> buildIndexInfoForTable​(java.lang.String schemaName,
                                                                  java.lang.String tableName,
                                                                  boolean useCache)
        Description copied from interface: DatabasePlatform
        Build index info for the specified table.
        Specified by:
        buildIndexInfoForTable in interface DatabasePlatform
        Parameters:
        schemaName - The schema name
        tableName - The table name
        useCache - use SQL select caching
        Returns:
        The indexes for the specified table
      • buildIndexInfoImpl

        protected com.im.commons.util.CaseInsensitiveMap<java.util.List<DBIndexInfo>> buildIndexInfoImpl​(java.lang.String schemaName,
                                                                                                         java.lang.String tableName,
                                                                                                         boolean useCache)
      • readValue

        @Deprecated
        public java.lang.Object readValue​(java.sql.ResultSet rs,
                                          java.lang.String columnName,
                                          java.lang.Class columnClass,
                                          int jdbcType)
                                   throws java.sql.SQLException
        Deprecated.
        Description copied from interface: DatabasePlatform
        Read the value from the ResultSet. The DatabasePlatform method is used so that custom methods of reading the values (e.g from Blob or Clob columns) can be implemented for a particular database type
        Specified by:
        readValue in interface DatabasePlatform
        Throws:
        java.sql.SQLException
      • executeDDL

        public final void executeDDL​(java.lang.String[] sql,
                                     boolean log)
        Description copied from interface: DatabasePlatform
        Executes a list of SQL statement.
        Specified by:
        executeDDL in interface DatabasePlatform
        Parameters:
        sql - The SQL statements to execute.
        log - Ignored, SQL logging is done automatically by Log4Jdbc4 connection wrapper.
      • executeDDL

        public final void executeDDL​(java.lang.String sql,
                                     boolean log)
        Description copied from interface: DatabasePlatform
        Executes a SQL statement.
        Specified by:
        executeDDL in interface DatabasePlatform
        Parameters:
        sql - The SQL statement to execute.
        log - Ignored, SQL logging is done automatically by Log4Jdbc4 connection wrapper.
      • sqlUpdateIJCViewsTable

        public java.lang.String[] sqlUpdateIJCViewsTable()
        Specified by:
        sqlUpdateIJCViewsTable in interface DatabasePlatform
        Returns:
        SQL statements to upgrade the IJC_Views table
      • sqlCreateSecurityTables

        public java.lang.String[] sqlCreateSecurityTables()
        Get the SQL that creates the database-based security tables.
        Specified by:
        sqlCreateSecurityTables in interface DatabasePlatform
        Returns:
        An array of SQL statements that will be executed in order.
      • sqlUpgradeCommand

        public java.lang.String sqlUpgradeCommand​(java.lang.String version,
                                                  java.lang.String key)
        Specified by:
        sqlUpgradeCommand in interface DatabasePlatform
      • sqlCreateFakeIJCViewsTable

        public java.lang.String sqlCreateFakeIJCViewsTable()
        Description copied from interface: DatabasePlatformX
        During upgrade to 5.12, the IJC_VIEWS was renamed to IJC_VIEWS_BACKUP. When old IJC tries to connect, it creates IJC_VIEWS before checking whether it should perform an upgrade. It fails on existing constraint names.

        The workaround is to create empty IJC_VIEWS table, unusable by the old IJC, which would prevent the creation.

        Specified by:
        sqlCreateFakeIJCViewsTable in interface DatabasePlatformX
        Returns:
        sql for fake IJC_VIEWS
      • sqlCreateIJCGenericsTableV512

        public java.lang.String sqlCreateIJCGenericsTableV512()
        Specified by:
        sqlCreateIJCGenericsTableV512 in interface DatabasePlatformX
        Returns:
        SQL for creating IJC_CUSTOM_ITEMS with PK not on SCHEMA, PARENT, ID, but only on SCHEMA, ID
      • sqlCreateTable

        public final java.lang.String sqlCreateTable​(java.lang.String schemaPlusTable,
                                                     java.lang.String idColumnName,
                                                     java.lang.String extraCols)
        Specified by:
        sqlCreateTable in interface DatabasePlatformX
      • sqlCreateSequence

        public java.lang.String sqlCreateSequence​(java.lang.String schemaPlusSequenceName)
        Specified by:
        sqlCreateSequence in interface DatabasePlatform
      • sqlUpdateRow

        public java.lang.String sqlUpdateRow​(SchemaQualifiedName schemaPlusTable,
                                             java.lang.String updateClause,
                                             java.lang.String whereClause)
        Specified by:
        sqlUpdateRow in interface DatabasePlatform
        Parameters:
        schemaPlusTable - The schema and name of the table to update
        updateClause - The values to update e.g. col1 = 'hello world', col2 = 77
        whereClause - The where clause to defeind the row(s) e.g. id = 999
        Returns:
        The SQL
      • sqlInsertRow

        public java.lang.String sqlInsertRow​(SchemaQualifiedName schemaPlusTable,
                                             java.util.List columnNames)
        Creates insert row sql for a prepared statement. It has the form of INSERT INTO table_name (col_1, col_2...) VALUES (?,?...)
        Specified by:
        sqlInsertRow in interface DatabasePlatform
        Parameters:
        schemaPlusTable - The schema and name of the table
        columnNames - The names of the columns with data
        Returns:
        The SQL
      • sqlInsertRowDefaults

        public java.lang.String sqlInsertRowDefaults​(SchemaQualifiedName schemaPlusTable,
                                                     java.lang.String[] idColumnNames)
        Creates insert row sql that inserts the default value for these columns. Useful when inserting empty rows when at least one column (the PK column) has to be specified.
        Specified by:
        sqlInsertRowDefaults in interface DatabasePlatform
        Parameters:
        schemaPlusTable - The schema and name of the table
        idColumnNames - The names of the columns to insert the default
        Returns:
        The SQL
      • sqlDropIndex

        public java.lang.String sqlDropIndex​(java.lang.String schemaPlusTable,
                                             java.lang.String indexName)
        Specified by:
        sqlDropIndex in interface DatabasePlatform
      • sqlDropColumn

        public java.lang.String sqlDropColumn​(java.lang.String schemaPlusTable,
                                              java.lang.String columnName)
        Specified by:
        sqlDropColumn in interface DatabasePlatformX
      • sqlDropTable

        public java.lang.String sqlDropTable​(java.lang.String schemaPlusTable)
        Specified by:
        sqlDropTable in interface DatabasePlatform
      • sqlCreateView

        public java.lang.String sqlCreateView​(java.lang.String schemaPlusView,
                                              java.lang.String sql)
        Specified by:
        sqlCreateView in interface DatabasePlatformX
      • sqlDropView

        public java.lang.String sqlDropView​(java.lang.String schemaPlusView)
        Specified by:
        sqlDropView in interface DatabasePlatformX
      • sqlDropSequence

        public java.lang.String sqlDropSequence​(java.lang.String schemaPlusSequence)
        Specified by:
        sqlDropSequence in interface DatabasePlatform
      • sqlAddColumn

        public java.lang.String sqlAddColumn​(java.lang.String schemaPlusTable,
                                             java.lang.String colName,
                                             java.lang.String colClass,
                                             java.lang.String nativeType,
                                             java.lang.String columnDefinition,
                                             java.lang.String defaultValue,
                                             boolean isNotNull)
        Specified by:
        sqlAddColumn in interface DatabasePlatform
      • sqlFullColumnDefinition

        public java.lang.String sqlFullColumnDefinition​(java.lang.String colClassName,
                                                        java.lang.String nativeType,
                                                        java.lang.String columnDefinition,
                                                        java.lang.String defaultValue,
                                                        boolean isNotNull)
        Generate the full column definition, including the defintion of any default value and the NULL/NOT NULL. e.g. VARCHAR(100) DEFAULT 'foo' NOT NULL
        Specified by:
        sqlFullColumnDefinition in interface DatabasePlatform
        Parameters:
        colClassName - The name of the columns data type e.g. java.lang.String
        nativeType - THe column type e.g. VARCHAR
        columnDefinition -
        defaultValue -
        isNotNull -
        Returns:
        The column definition
      • sqlDeleteRow

        public java.lang.String sqlDeleteRow​(java.lang.String schemaPlusTable,
                                             java.lang.String whereClause)
        Description copied from interface: DatabasePlatform
        Generate SQL to delete a row. The ? placeholder will be used for the ID(s) of the row to delete
        Specified by:
        sqlDeleteRow in interface DatabasePlatform
        Parameters:
        schemaPlusTable - The schema and name of the table to delete from
        whereClause - The "WHERE" part of the SQL delete command.
        Returns:
        SQL in the from of DELETE FROM <table> WHERE <col> = ? [AND <filter>]
      • sqlAlterTableName

        public java.lang.String sqlAlterTableName​(java.lang.String oldSchemaPlusTable,
                                                  java.lang.String newSchemaPlusTable)
        Specified by:
        sqlAlterTableName in interface DatabasePlatformX
      • sqlAlterColumnName

        public java.lang.String sqlAlterColumnName​(java.lang.String schemaPlusTable,
                                                   java.lang.String oldName,
                                                   java.lang.String newName,
                                                   java.lang.String definition)
        Specified by:
        sqlAlterColumnName in interface DatabasePlatformX
      • sqlAlterColumnSize

        public java.lang.String sqlAlterColumnSize​(java.lang.String schemaPlusTable,
                                                   java.lang.String columnName,
                                                   java.lang.String columnDefinition)
        Specified by:
        sqlAlterColumnSize in interface DatabasePlatformX
      • sqlAddIndex

        public java.lang.String sqlAddIndex​(java.lang.String indexName,
                                            java.lang.String indexType,
                                            java.lang.String schemaPlusTable,
                                            java.lang.String[] columns,
                                            boolean[] asc)
        Add an index to the table.
        Specified by:
        sqlAddIndex in interface DatabasePlatform
        Parameters:
        indexName - The name for the index.
        indexType - The type of index. e.g. UNIQUE. Consult the supportedIndexTypes() method to find out which types your DB supports. Can be null for a regular index.
        schemaPlusTable - The schema and name of the table for the index
        columns - The columns
        asc - Is the index for this column ascending or descending. true means ASC, false means DESC. Can be null, but if specified must have the same size as the columns Must be the same number of values as there are columns.
        Returns:
        The SQL for adding the index
      • sqlAddUniqueConstraint

        public java.lang.String sqlAddUniqueConstraint​(java.lang.String consName,
                                                       java.lang.String schemaPlusTable,
                                                       java.lang.String[] columns)
        Add unique constraint for some columns in the table. Usually that will imply creation of an unique-valued index in the database.
        Specified by:
        sqlAddUniqueConstraint in interface DatabasePlatform
        Parameters:
        consName - The c onstraint name
        schemaPlusTable - The schema and name of the table
        columns - The c olumns which will form the unique key. Order is important.
        Returns:
        SQL statement to create the unique key
      • getColumnListCommaSeparated

        public java.lang.String getColumnListCommaSeparated​(java.lang.String[] columns)
        Specified by:
        getColumnListCommaSeparated in interface DatabasePlatformX
        Parameters:
        columns - column names
        Returns:
        The comma-separated list of column names
      • sqlDropPrimaryConstraint

        public java.lang.String sqlDropPrimaryConstraint​(java.lang.String schemaPlusTable,
                                                         java.lang.String consName,
                                                         java.lang.String[] columns)
        Specified by:
        sqlDropPrimaryConstraint in interface DatabasePlatform
      • sqlDropUniqueConstraint

        public java.lang.String sqlDropUniqueConstraint​(java.lang.String schemaPlusTable,
                                                        java.lang.String consName,
                                                        java.lang.String[] columns)
        Specified by:
        sqlDropUniqueConstraint in interface DatabasePlatform
      • stringArrayContains

        public static boolean stringArrayContains​(java.lang.String[] hayStack,
                                                  java.lang.String needle)
      • sqlViewMetaDataNextIndex

        public java.lang.String sqlViewMetaDataNextIndex()
      • sqlAddForeignKey

        public java.lang.String sqlAddForeignKey​(java.lang.String fkName,
                                                 java.lang.String parentSchemaPlusTable,
                                                 java.lang.String dependentSchemaPlusTable,
                                                 java.lang.String[] parentCols,
                                                 java.lang.String[] dependentCols,
                                                 java.lang.String onDeleteRule,
                                                 java.lang.String onUpdateRule)
        Specified by:
        sqlAddForeignKey in interface DatabasePlatform
      • sqlDropForeignKey

        public java.lang.String sqlDropForeignKey​(java.lang.String schemaPlusTable,
                                                  java.lang.String fkName)
        Specified by:
        sqlDropForeignKey in interface DatabasePlatform
      • sqlDropConstraint

        protected java.lang.String sqlDropConstraint​(java.lang.String schemaPlusTable,
                                                     java.lang.String constraintName)
      • translateSQLException

        public org.springframework.dao.DataAccessException translateSQLException​(java.lang.String message,
                                                                                 java.lang.String sql,
                                                                                 java.sql.SQLException ex)
        Specified by:
        translateSQLException in interface DatabasePlatform
      • sqlSelectDuplicateRows

        public java.lang.String sqlSelectDuplicateRows​(java.lang.String schemaPlusTable,
                                                       java.lang.String[] columns)
        Specified by:
        sqlSelectDuplicateRows in interface DatabasePlatform
      • buildTableInfos

        public java.util.Map<java.lang.String,​DBTableInfo> buildTableInfos​(java.lang.String dbSchemaName,
                                                                                 java.util.Collection<java.lang.String> tablesToInit,
                                                                                 LazyLoader lazyLoader,
                                                                                 com.im.commons.progress.DFFeedback feedback)
        Description copied from interface: DatabasePlatform
        Builds information about database tables.
        Specified by:
        buildTableInfos in interface DatabasePlatform
        Parameters:
        dbSchemaName - The database schema name to scan for tables and views.
        tablesToInit - The schema qualified names of tables that have to be fully loaded. The rest of the tables in the database schema can be loaded lazily.
        lazyLoader - The loader that will perform the lazy loading.
        feedback - The progress indicator.
        Returns:
        A map of DBTableInfos keyed by the schema qualified table/view name
      • buildTableInfosEager

        public java.util.Map<java.lang.String,​DBTableInfo> buildTableInfosEager​(java.lang.String dbSchemaName,
                                                                                      com.im.commons.progress.DFFeedback feedback)
        Specified by:
        buildTableInfosEager in interface DatabasePlatform
      • sqlGetTablesWithPropertyColumns

        protected java.lang.String sqlGetTablesWithPropertyColumns()
      • findJChemPropertyTables

        protected java.util.Set<java.lang.String> findJChemPropertyTables()
      • readPropertyTables

        protected abstract void readPropertyTables​(java.util.Set<java.lang.String> tables,
                                                   java.sql.ResultSet rs)
                                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • readPropertyTablesNoSchema

        protected void readPropertyTablesNoSchema​(java.util.Set<java.lang.String> tables,
                                                  java.sql.ResultSet rs)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • readPropertyTablesWithSchema

        protected void readPropertyTablesWithSchema​(java.util.Set<java.lang.String> tables,
                                                    java.sql.ResultSet rs)
                                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • buildTableInfo

        public DBTableInfo buildTableInfo​(java.lang.String dbSchemaName,
                                          java.lang.String tableName,
                                          LazyLoader lazyLoader,
                                          com.im.commons.progress.DFFeedback feedback)
        Description copied from interface: DatabasePlatform
        Build the full table info for this table. The table info contains all the information about the table.
        Specified by:
        buildTableInfo in interface DatabasePlatform
        Parameters:
        dbSchemaName - The schema in which the table resides
        tableName - The table name
        Returns:
        The database table info The method can return null if the table does not exist.
      • readDatabaseViewDefinitions

        protected java.util.Map<java.lang.String,​java.lang.String> readDatabaseViewDefinitions​(java.lang.String catalog,
                                                                                                     java.lang.String dbSchemaName,
                                                                                                     java.lang.String viewName)
                                                                                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • buildConstraintInfosForSchema

        protected java.util.Map<java.lang.String,​java.util.List<DBConstraintInfo>> buildConstraintInfosForSchema​(java.lang.String dbSchemaName,
                                                                                                                       boolean useCache)
        Build constraint info for the specified schema.
        Parameters:
        dbSchemaName - schema name
        useCache - use SQL select caching
        Returns:
        A Map of constraints, keyed by the table name
      • buildConstraintInfosImpl

        protected java.util.List<DBConstraintInfo> buildConstraintInfosImpl​(java.lang.String dbSchemaName,
                                                                            java.lang.String tableName,
                                                                            java.util.List<DBColInfo> collsInTable,
                                                                            boolean useCache)
        Build constraint info for the specified table.
        Parameters:
        dbSchemaName - The schema
        tableName - The table
        collsInTable - The columns
        useCache - use SQL select caching
        Returns:
        The constraint info
      • getCartridgeOwner

        public java.lang.String getCartridgeOwner()
        Description copied from interface: DatabasePlatformX
        Get the user that owns the JChem cartridge functions. Will return null if the database is not Oracle or the cartridge is not installed and appropriate grants not made to the current user/schema.
        Specified by:
        getCartridgeOwner in interface DatabasePlatformX
        Returns:
        db user or null
      • updateHeartbeat

        public final void updateHeartbeat​(java.lang.String userName,
                                          java.lang.String schemaId)
        Description copied from interface: DatabasePlatform
        Updates when the last time user accessed the database for purpose of changing the data.
        Specified by:
        updateHeartbeat in interface DatabasePlatform
        Parameters:
        userName - current logged in user
        schemaId - current schema
      • sqlDataColumn

        public java.lang.String sqlDataColumn()
        Hook for optimized CLOB loading in Oracle.
        Specified by:
        sqlDataColumn in interface DatabasePlatformX
        Returns:
        DATA or DATA, DATA_STR, DATA_LEN
      • getInClause

        public java.lang.String getInClause​(int numItems)
        Creates IN (...) clause for usage in prepared statement. If there is only one item, the clause is optimized into "= ?". Database platforms may override this to provide more optimized version which would have the same semantics.
        Specified by:
        getInClause in interface DatabasePlatformX
        Parameters:
        numItems - how many placeholders should be in the clause
        Returns:
        "IN (?, ?, ...)" or "= ?"
      • getInClauseDefaultImpl

        protected static java.lang.String getInClauseDefaultImpl​(int numItems)
      • sqlDeleteSharing

        public java.lang.String sqlDeleteSharing()
        Specified by:
        sqlDeleteSharing in interface DatabasePlatformX
        Returns:
        Approx. the following:

        DELETE FROM ijc_custom_items_sharing WHERE schema_id = ? AND custom_item_id = ?

      • sqlInsertSharing

        public java.lang.String sqlInsertSharing()
        Specified by:
        sqlInsertSharing in interface DatabasePlatformX
        Returns:
        Approx. the following:

        INSERT INTO ijc_custom_items_sharing (schema_id, custom_items_id, authority, priv) VALUES (?, ?, ?, ?)

      • sqlQueryForCustomItemSharing

        public java.lang.String sqlQueryForCustomItemSharing()
        Specified by:
        sqlQueryForCustomItemSharing in interface DatabasePlatformX
        Returns:
        Approx. the following:

        SELECT authority, priv FROM ijc_custom_items_sharing WHERE schema_id = ? AND custom_item_id = ?

      • sqlUpdatePasswordColumn

        public java.lang.String sqlUpdatePasswordColumn​(int size)
        Specified by:
        sqlUpdatePasswordColumn in interface DatabasePlatformX
        Parameters:
        size - the new size of the column
        Returns:
        the sql statement for updating the password column in ijc_security_users table