Class AbstractDatabasePlatform
- java.lang.Object
-
- com.im.commons.db.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:
- The correct SQL for performing specific operations
- 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
-
-
Field Summary
-
Fields inherited from interface com.im.commons.db.DatabasePlatform
IJC_API_KEYS_TABLE_NAME, IJC_CONNECT_ITEMS_TABLE_NAME, IJC_CONNECT_STRUCTURES_TABLE_NAME, IJC_SCHEMA_OTHER_SHARING_TABLE_NAME, IJC_SCHEMA_OTHER_TABLE_NAME, NAME_PRIMARY_KEY_CONSTRAINT
-
Fields inherited from interface com.im.commons.db.DatabasePlatformX
IJC_AUTHORITIES_TABLE_NAME, IJC_CHANGE_LOG_TABLE_NAME, IJC_INVOCATION_LOG_TABLE_NAME, IJC_ITEM_INFO_TABLE_NAME, IJC_ITEM_USER_TABLE_NAME, IJC_SCHEMA_AUTHORITIES_TABLE_NAME, IJC_SCHEMA_TABLE_NAME, IJC_SECURITY_AUTHORITIES_TABLE_NAME, IJC_SECURITY_INFO_TABLE_NAME, IJC_SECURITY_USERS_TABLE_NAME, IJC_USER_TABLE_NAME, IJC_VIEWS_BACKUP_TABLE_NAME, IJC_VIEWS_SEQUENCE_NAME, IJC_VIEWS_TABLE_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDatabasePlatform(javax.sql.DataSource dds)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addPseudoColumnInfos(java.util.List<DBColInfo> cols, java.lang.String columnPattern)
Add any magical pseudo columns such as Oracle's ROWID columns.DBColInfo
buildColumnInfoForColumn(java.lang.String dbSchemaName, java.lang.String tableName, java.lang.String columnName)
Build the DBColInfos for the particlaar column.java.util.Map<java.lang.String,java.util.List<DBColInfo>>
buildColumnInfosForSchema(java.lang.String dbSchemaName)
java.util.List<DBColInfo>
buildColumnInfosForTable(java.lang.String dbSchemaName, java.lang.String tableName)
Build the DBColInfos for the table.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.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.java.util.List<DBForeignKeyInfo>
buildExportedForeignKeyInfoForTable(java.lang.String schemaName, java.lang.String tableName, boolean useCache)
Build exported foreign key info.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)
java.util.List<DBForeignKeyInfo>
buildImportedForeignKeyInfoForTable(java.lang.String schemaName, java.lang.String tableName, boolean useCache)
Build imported foreign key info.java.util.List<DBIndexInfo>
buildIndexInfoForTable(java.lang.String schemaName, java.lang.String tableName, boolean useCache)
Build index info for the specified table.protected com.im.commons.util.CaseInsensitiveMap<java.util.List<DBIndexInfo>>
buildIndexInfoImpl(java.lang.String schemaName, java.lang.String tableName, boolean useCache)
protected java.util.Map<java.lang.String,java.util.List<DBIndexInfo>>
buildIndexInfosForSchema(java.lang.String schemaName, boolean useCache)
java.util.Set<java.lang.String>
buildJChemPropertyTableNames()
Build the known JChem property table names.java.util.List<DBSequenceInfo>
buildSequenceInfo(java.lang.String schema)
Default implementation assumes sequences are not supported and returns an empty list.DBSequenceInfo
buildSequenceInfo(java.lang.String schema, java.lang.String seqName)
Default implementation assumes sequences are not supported and returns null.DBTableInfo
buildTableInfo(java.lang.String dbSchemaName, java.lang.String tableName, LazyLoader lazyLoader, com.im.commons.progress.DFFeedback feedback)
Build the full table info for this table.DBTableInfo
buildTableInfoFull(java.lang.String dbSchemaName, java.lang.String tableName, LazyLoader lazyLoader, com.im.commons.progress.DFFeedback feedback)
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)
Builds information about database tables.java.util.Map<java.lang.String,DBTableInfo>
buildTableInfosEager(java.lang.String dbSchemaName, com.im.commons.progress.DFFeedback feedback)
java.util.Map<java.lang.String,DBTableInfo>
buildTableInfosLazy(java.lang.String dbSchemaName, LazyLoader lazyLoader, com.im.commons.progress.DFFeedback feedback)
void
checkSchemaExistence(java.lang.String schemaId)
Checks whether an schema exists in the IJC metadata registry (IJC_SCHEMA table) or not also checks whether the database/ IJC_SCHEMA table exists or not.static void
clearAllCaches(java.lang.String jdbcConnectionURL)
static DatabasePlatform
create(BaseDataSource bds)
protected abstract DBDatabaseInfo
createDatabaseInfo(java.lang.String dbIdentifierQuoteString)
java.lang.String
createIdColumnNameFromTableName(java.lang.String tableName)
protected java.util.Map<java.lang.String,java.util.List<DBColInfo>>
doBuildColumnInfosImpl(java.lang.String dbSchemaName, java.lang.String tableName, java.lang.String columnName)
void
executeDDL(java.lang.String[] sql, boolean log)
Executes a list of SQL statement.void
executeDDL(java.lang.String sql, boolean log)
Executes a SQL statement.protected java.util.Set<java.lang.String>
findJChemPropertyTables()
protected java.lang.String[]
findPrimaryKeyColumnNames(java.sql.DatabaseMetaData meta, java.lang.String schema, java.lang.String table, boolean useCache)
java.lang.String
getAddAuthoritySql()
java.lang.String
getAddUserRoleSql()
java.lang.String
getAddUserSql()
java.lang.String
getCartridgeOwner()
Get the user that owns the JChem cartridge functions.java.lang.String
getCatalog()
java.lang.String
getColumnListCommaSeparated(java.lang.String[] columns)
javax.sql.DataSource
getDataSource()
DBDatabaseInfo
getDBInfo()
java.lang.String
getDefaultSchemaName()
java.lang.String
getDeleteAuthoritiesSql()
java.lang.String
getDeleteUserSql()
static java.util.Map<?,?>
getFilteringNodesContext()
java.lang.String
getInClause(int numItems)
Creates IN (...) clause for usage in prepared statement.protected static java.lang.String
getInClauseDefaultImpl(int numItems)
java.util.Set<java.lang.String>
getJChemPropertyTableNames()
Returns cached JChem property table names.org.springframework.jdbc.core.JdbcTemplate
getJdbcTemplate()
static java.util.Map<?,?>
getLoadingSchemaContext()
org.springframework.jdbc.support.lob.LobHandler
getLobHandler()
java.util.Set<java.lang.String>
getMetaTableNames()
java.util.List<java.lang.String>
getMetaTableNamesSorted()
java.util.List<java.lang.String>
getSchemaNames()
Get the list of schema names that are accessible to the user.java.lang.String
getSetEnabledSql()
java.lang.String[]
getTableNames(java.lang.String schema)
Get the table names for the specified schemaorg.springframework.jdbc.datasource.DataSourceTransactionManager
getTransactionManager()
java.lang.String
getUpdatePasswordSql()
java.util.List<java.lang.String>
getUsedSchemas()
Only used on sequences, please do not use this method.java.lang.String[]
getViewNames(java.lang.String schema)
Get the view names for the specified schemastatic boolean
isFilteringNodes()
static boolean
isLoadingSchema()
protected void
preInitValidate()
protected java.util.Map<java.lang.String,java.lang.String>
readDatabaseViewDefinitions(java.lang.String catalog, java.lang.String dbSchemaName, java.lang.String viewName)
protected abstract void
readPropertyTables(java.util.Set<java.lang.String> tables, java.sql.ResultSet rs)
protected void
readPropertyTablesNoSchema(java.util.Set<java.lang.String> tables, java.sql.ResultSet rs)
protected void
readPropertyTablesWithSchema(java.util.Set<java.lang.String> tables, java.sql.ResultSet rs)
java.lang.Object
readValue(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class columnClass, int jdbcType)
Deprecated.void
setUsedSchemas(java.util.List<java.lang.String> usedSchemas)
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)
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)
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.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.java.lang.String
sqlAlterColumnName(java.lang.String schemaPlusTable, java.lang.String oldName, java.lang.String newName, java.lang.String definition)
java.lang.String
sqlAlterColumnSize(java.lang.String schemaPlusTable, java.lang.String columnName, java.lang.String columnDefinition)
java.lang.String
sqlAlterTableName(java.lang.String oldSchemaPlusTable, java.lang.String newSchemaPlusTable)
java.lang.String
sqlCreateFakeIJCViewsTable()
During upgrade to 5.12, the IJC_VIEWS was renamed to IJC_VIEWS_BACKUP.java.lang.String
sqlCreateIJCApiKeysTable()
java.lang.String
sqlCreateIJCAuthoritiesTable()
java.lang.String[]
sqlCreateIJCChangesLogTable()
java.lang.String[]
sqlCreateIJCConnectCustomItemsTable()
java.lang.String
sqlCreateIJCConnectStructureMappingTable()
java.lang.String
sqlCreateIJCGenericsSharingTable()
java.lang.String
sqlCreateIJCGenericsTable()
Deprecated.java.lang.String
sqlCreateIJCGenericsTableV512()
java.lang.String[]
sqlCreateIJCInvocationLogTable()
java.lang.String
sqlCreateIJCItemInfoTable()
java.lang.String
sqlCreateIJCItemUserTable()
java.lang.String
sqlCreateIJCSchemaAuthoritiesTable()
java.lang.String
sqlCreateIJCSchemaTable()
java.lang.String
sqlCreateIJCSecurityAuthoritiesAuthoritiesFK()
java.lang.String
sqlCreateIJCSecurityInfoTable()
java.lang.String
sqlCreateIJCUserTable()
java.lang.String
sqlCreateIJCViewsTable()
Deprecated.java.lang.String[]
sqlCreateSecurityTables()
Get the SQL that creates the database-based security tables.java.lang.String[]
sqlCreateSecurityTablesExternalConstraints()
Constraints from the security tables to the other tables.java.lang.String
sqlCreateSequence(java.lang.String schemaPlusSequenceName)
java.lang.String
sqlCreateTable(java.lang.String schemaPlusTable, java.lang.String idColumnName, java.lang.String extraCols)
java.lang.String
sqlCreateTable(java.lang.String schemaPlusTable, java.util.List<DBDatabaseInfo.NativeType> columnDefs, java.util.List<java.lang.String> columnNames)
Creates a table with the given name and the fields.java.lang.String
sqlCreateView(java.lang.String schemaPlusView, java.lang.String sql)
java.lang.String
sqlDataColumn()
Hook for optimized CLOB loading in Oracle.java.lang.String
sqlDeleteRow(java.lang.String schemaPlusTable, java.lang.String whereClause)
Generate SQL to delete a row.java.lang.String
sqlDeleteSharing()
java.lang.String
sqlDropColumn(java.lang.String schemaPlusTable, java.lang.String columnName)
protected java.lang.String
sqlDropConstraint(java.lang.String schemaPlusTable, java.lang.String constraintName)
java.lang.String
sqlDropForeignKey(java.lang.String schemaPlusTable, java.lang.String fkName)
java.lang.String
sqlDropIndex(java.lang.String schemaPlusTable, java.lang.String indexName)
java.lang.String
sqlDropPrimaryConstraint(java.lang.String schemaPlusTable, java.lang.String consName, java.lang.String[] columns)
java.lang.String
sqlDropSequence(java.lang.String schemaPlusSequence)
java.lang.String
sqlDropTable(java.lang.String schemaPlusTable)
java.lang.String
sqlDropUniqueConstraint(java.lang.String schemaPlusTable, java.lang.String consName, java.lang.String[] columns)
java.lang.String
sqlDropView(java.lang.String schemaPlusView)
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.java.lang.String
sqlGenericItemInsertV511()
Deprecated.java.lang.String
sqlGetDBSchemaVersion()
protected java.lang.String
sqlGetTablesWithPropertyColumns()
java.lang.String
sqlInsertRow(SchemaQualifiedName schemaPlusTable, java.util.List columnNames)
Creates insert row sql for a prepared statement.java.lang.String
sqlInsertRowDefaults(SchemaQualifiedName schemaPlusTable, java.lang.String[] idColumnNames)
Creates insert row sql that inserts the default value for these columns.java.lang.String
sqlInsertSharing()
java.lang.String
sqlQueryForCustomItemSharing()
java.lang.String
sqlRetrieveSequence(java.lang.String schemPlusSequence)
java.lang.String
sqlSchemaMetaDataInsert()
java.lang.String
sqlSchemaMetaDataNextIndex()
java.lang.String
sqlSelectDuplicateRows(java.lang.String schemaPlusTable, java.lang.String[] columns)
java.lang.String
sqlSelectFromIjcAuthorities()
java.lang.String
sqlSelectFromIjcCustomItems()
java.lang.String
sqlSelectFromIjcItemInfo()
java.lang.String
sqlSelectFromIjcItemUser()
java.lang.String
sqlSelectFromIjcItemUserByUser()
java.lang.String
sqlSelectFromIjcSchema()
java.lang.String
sqlSelectFromIjcSchemaByType()
java.lang.String
sqlSelectFromIjcSecurityInfo()
java.lang.String
sqlSetDBSchemaVersion(boolean insert)
java.lang.String[]
sqlUpdateIJCViewsTable()
java.lang.String
sqlUpdatePasswordColumn(int size)
java.lang.String
sqlUpdateRow(SchemaQualifiedName schemaPlusTable, java.lang.String updateClause, java.lang.String whereClause)
java.lang.String
sqlUpgradeCommand(java.lang.String version, java.lang.String key)
java.lang.String
sqlViewMetaDataInsert()
Deprecated.java.lang.String
sqlViewMetaDataNextIndex()
static boolean
stringArrayContains(java.lang.String[] hayStack, java.lang.String needle)
org.springframework.dao.DataAccessException
translateSQLException(java.lang.String message, java.lang.String sql, java.sql.SQLException ex)
void
updateHeartbeat(java.lang.String userName, java.lang.String schemaId)
Updates when the last time user accessed the database for purpose of changing the data.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.im.commons.db.DatabasePlatform
buildConstraintInfosForTable, sqlAlterColumnRequired, sqlNow, sqlRebuildIndex
-
Methods inherited from interface com.im.commons.db.DatabasePlatformX
sqlAlterColumnDefault, sqlAlterColumnDefault
-
-
-
-
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)
-
getDataSource
public final javax.sql.DataSource getDataSource()
- Specified by:
getDataSource
in interfaceDatabasePlatform
-
getJdbcTemplate
public final org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
- Specified by:
getJdbcTemplate
in interfaceDatabasePlatform
-
create
public static DatabasePlatform create(BaseDataSource bds)
-
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 interfaceDatabasePlatform
- Returns:
- The names of JChem property tables.
-
getJChemPropertyTableNames
public java.util.Set<java.lang.String> getJChemPropertyTableNames()
Description copied from interface:DatabasePlatform
Returns cached JChem property table names. To get updated values or to update the cache useDatabasePlatform.buildJChemPropertyTableNames()
.- Specified by:
getJChemPropertyTableNames
in interfaceDatabasePlatform
- Returns:
- The cached names of JChem property tables.
-
getMetaTableNames
public java.util.Set<java.lang.String> getMetaTableNames()
- Specified by:
getMetaTableNames
in interfaceDatabasePlatform
- Returns:
- The names of tables, that hold the schema metadata information
-
getMetaTableNamesSorted
public java.util.List<java.lang.String> getMetaTableNamesSorted()
- Specified by:
getMetaTableNamesSorted
in interfaceDatabasePlatformX
-
getTransactionManager
public final org.springframework.jdbc.datasource.DataSourceTransactionManager getTransactionManager()
- Specified by:
getTransactionManager
in interfaceDatabasePlatform
-
getLobHandler
public org.springframework.jdbc.support.lob.LobHandler getLobHandler()
- Specified by:
getLobHandler
in interfaceDatabasePlatform
-
getDefaultSchemaName
public java.lang.String getDefaultSchemaName()
- Specified by:
getDefaultSchemaName
in interfaceDatabasePlatform
- Returns:
- The default schema to be used
-
getCatalog
public java.lang.String getCatalog()
- Specified by:
getCatalog
in interfaceDatabasePlatformX
-
preInitValidate
protected void preInitValidate()
-
createDatabaseInfo
protected abstract DBDatabaseInfo createDatabaseInfo(java.lang.String dbIdentifierQuoteString)
-
getDBInfo
public final DBDatabaseInfo getDBInfo()
- Specified by:
getDBInfo
in interfaceDatabasePlatform
-
createIdColumnNameFromTableName
public java.lang.String createIdColumnNameFromTableName(java.lang.String tableName)
- Specified by:
createIdColumnNameFromTableName
in interfaceDatabasePlatformX
-
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 interfaceDatabasePlatform
- Specified by:
sqlCreateTable
in interfaceDatabasePlatformX
- Parameters:
schemaPlusTable
- identifier of the tablecolumnDefs
- The column definitionscolumnNames
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 addedcolumnPattern
- 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 interfaceDatabasePlatform
- Parameters:
dbSchemaName
- The schema nametableName
- 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 interfaceDatabasePlatform
- Parameters:
dbSchemaName
- The schema nametableName
- The table namecolumnName
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- Parameters:
schema
- schema to look intoseqName
- 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 interfaceDatabasePlatform
- Parameters:
schemaName
- The schema nametableName
- The table nameuseCache
- 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 interfaceDatabasePlatform
- Parameters:
schemaName
- The schema nametableName
- The table nameuseCache
- 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 interfaceDatabasePlatform
- Parameters:
schemaName
- The schema nametableName
- The table nameuseCache
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- 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 interfaceDatabasePlatform
- Returns:
- An array of SQL statements that will be executed in order.
-
sqlCreateSecurityTablesExternalConstraints
public java.lang.String[] sqlCreateSecurityTablesExternalConstraints()
Description copied from interface:DatabasePlatform
Constraints from the security tables to the other tables. Can only be added if the other tables are present- Specified by:
sqlCreateSecurityTablesExternalConstraints
in interfaceDatabasePlatform
-
sqlSelectFromIjcSchema
public java.lang.String sqlSelectFromIjcSchema()
- Specified by:
sqlSelectFromIjcSchema
in interfaceDatabasePlatformX
-
sqlSelectFromIjcSchemaByType
public java.lang.String sqlSelectFromIjcSchemaByType()
- Specified by:
sqlSelectFromIjcSchemaByType
in interfaceDatabasePlatformX
-
sqlSelectFromIjcCustomItems
public java.lang.String sqlSelectFromIjcCustomItems()
- Specified by:
sqlSelectFromIjcCustomItems
in interfaceDatabasePlatformX
-
sqlSelectFromIjcItemInfo
public java.lang.String sqlSelectFromIjcItemInfo()
- Specified by:
sqlSelectFromIjcItemInfo
in interfaceDatabasePlatformX
-
sqlSelectFromIjcSecurityInfo
public java.lang.String sqlSelectFromIjcSecurityInfo()
- Specified by:
sqlSelectFromIjcSecurityInfo
in interfaceDatabasePlatformX
-
sqlSelectFromIjcItemUserByUser
public java.lang.String sqlSelectFromIjcItemUserByUser()
- Specified by:
sqlSelectFromIjcItemUserByUser
in interfaceDatabasePlatformX
-
sqlSelectFromIjcItemUser
public java.lang.String sqlSelectFromIjcItemUser()
- Specified by:
sqlSelectFromIjcItemUser
in interfaceDatabasePlatformX
-
sqlSelectFromIjcAuthorities
public java.lang.String sqlSelectFromIjcAuthorities()
- Specified by:
sqlSelectFromIjcAuthorities
in interfaceDatabasePlatformX
-
sqlGetDBSchemaVersion
public java.lang.String sqlGetDBSchemaVersion()
- Specified by:
sqlGetDBSchemaVersion
in interfaceDatabasePlatformX
-
sqlSetDBSchemaVersion
public java.lang.String sqlSetDBSchemaVersion(boolean insert)
- Specified by:
sqlSetDBSchemaVersion
in interfaceDatabasePlatformX
-
sqlUpgradeCommand
public java.lang.String sqlUpgradeCommand(java.lang.String version, java.lang.String key)
- Specified by:
sqlUpgradeCommand
in interfaceDatabasePlatform
-
sqlCreateIJCSchemaTable
public java.lang.String sqlCreateIJCSchemaTable()
- Specified by:
sqlCreateIJCSchemaTable
in interfaceDatabasePlatformX
-
sqlCreateIJCItemInfoTable
public java.lang.String sqlCreateIJCItemInfoTable()
- Specified by:
sqlCreateIJCItemInfoTable
in interfaceDatabasePlatformX
-
sqlCreateIJCViewsTable
@Deprecated public java.lang.String sqlCreateIJCViewsTable()
Deprecated.- Specified by:
sqlCreateIJCViewsTable
in interfaceDatabasePlatformX
- Returns:
-
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 interfaceDatabasePlatformX
- Returns:
- sql for fake IJC_VIEWS
-
sqlCreateIJCGenericsTable
@Deprecated public java.lang.String sqlCreateIJCGenericsTable()
Deprecated.- Specified by:
sqlCreateIJCGenericsTable
in interfaceDatabasePlatformX
-
sqlCreateIJCConnectStructureMappingTable
public java.lang.String sqlCreateIJCConnectStructureMappingTable()
- Specified by:
sqlCreateIJCConnectStructureMappingTable
in interfaceDatabasePlatformX
-
sqlCreateIJCConnectCustomItemsTable
public java.lang.String[] sqlCreateIJCConnectCustomItemsTable()
- Specified by:
sqlCreateIJCConnectCustomItemsTable
in interfaceDatabasePlatformX
-
sqlCreateIJCApiKeysTable
public java.lang.String sqlCreateIJCApiKeysTable()
- Specified by:
sqlCreateIJCApiKeysTable
in interfaceDatabasePlatformX
-
sqlCreateIJCGenericsTableV512
public java.lang.String sqlCreateIJCGenericsTableV512()
- Specified by:
sqlCreateIJCGenericsTableV512
in interfaceDatabasePlatformX
- Returns:
- SQL for creating IJC_CUSTOM_ITEMS with PK not on SCHEMA, PARENT, ID, but only on SCHEMA, ID
-
sqlCreateIJCGenericsSharingTable
public java.lang.String sqlCreateIJCGenericsSharingTable()
- Specified by:
sqlCreateIJCGenericsSharingTable
in interfaceDatabasePlatformX
-
sqlCreateIJCUserTable
public java.lang.String sqlCreateIJCUserTable()
- Specified by:
sqlCreateIJCUserTable
in interfaceDatabasePlatformX
-
sqlCreateIJCItemUserTable
public java.lang.String sqlCreateIJCItemUserTable()
- Specified by:
sqlCreateIJCItemUserTable
in interfaceDatabasePlatformX
-
sqlCreateIJCSecurityInfoTable
public java.lang.String sqlCreateIJCSecurityInfoTable()
- Specified by:
sqlCreateIJCSecurityInfoTable
in interfaceDatabasePlatformX
-
sqlCreateIJCInvocationLogTable
public java.lang.String[] sqlCreateIJCInvocationLogTable()
- Specified by:
sqlCreateIJCInvocationLogTable
in interfaceDatabasePlatformX
-
sqlCreateIJCChangesLogTable
public java.lang.String[] sqlCreateIJCChangesLogTable()
- Specified by:
sqlCreateIJCChangesLogTable
in interfaceDatabasePlatformX
-
sqlCreateIJCAuthoritiesTable
public java.lang.String sqlCreateIJCAuthoritiesTable()
- Specified by:
sqlCreateIJCAuthoritiesTable
in interfaceDatabasePlatformX
-
sqlCreateIJCSchemaAuthoritiesTable
public java.lang.String sqlCreateIJCSchemaAuthoritiesTable()
- Specified by:
sqlCreateIJCSchemaAuthoritiesTable
in interfaceDatabasePlatformX
-
sqlCreateIJCSecurityAuthoritiesAuthoritiesFK
public java.lang.String sqlCreateIJCSecurityAuthoritiesAuthoritiesFK()
- Specified by:
sqlCreateIJCSecurityAuthoritiesAuthoritiesFK
in interfaceDatabasePlatformX
-
sqlCreateTable
public final java.lang.String sqlCreateTable(java.lang.String schemaPlusTable, java.lang.String idColumnName, java.lang.String extraCols)
- Specified by:
sqlCreateTable
in interfaceDatabasePlatformX
-
sqlCreateSequence
public java.lang.String sqlCreateSequence(java.lang.String schemaPlusSequenceName)
- Specified by:
sqlCreateSequence
in interfaceDatabasePlatform
-
sqlRetrieveSequence
public java.lang.String sqlRetrieveSequence(java.lang.String schemPlusSequence)
- Specified by:
sqlRetrieveSequence
in interfaceDatabasePlatformX
-
sqlUpdateRow
public java.lang.String sqlUpdateRow(SchemaQualifiedName schemaPlusTable, java.lang.String updateClause, java.lang.String whereClause)
- Specified by:
sqlUpdateRow
in interfaceDatabasePlatform
- Parameters:
schemaPlusTable
- The schema and name of the table to updateupdateClause
- The values to update e.g. col1 = 'hello world', col2 = 77whereClause
- 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 ofINSERT INTO table_name (col_1, col_2...) VALUES (?,?...)
- Specified by:
sqlInsertRow
in interfaceDatabasePlatform
- Parameters:
schemaPlusTable
- The schema and name of the tablecolumnNames
- 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 interfaceDatabasePlatform
- Parameters:
schemaPlusTable
- The schema and name of the tableidColumnNames
- 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 interfaceDatabasePlatform
-
sqlDropColumn
public java.lang.String sqlDropColumn(java.lang.String schemaPlusTable, java.lang.String columnName)
- Specified by:
sqlDropColumn
in interfaceDatabasePlatformX
-
sqlDropTable
public java.lang.String sqlDropTable(java.lang.String schemaPlusTable)
- Specified by:
sqlDropTable
in interfaceDatabasePlatform
-
sqlCreateView
public java.lang.String sqlCreateView(java.lang.String schemaPlusView, java.lang.String sql)
- Specified by:
sqlCreateView
in interfaceDatabasePlatformX
-
sqlDropView
public java.lang.String sqlDropView(java.lang.String schemaPlusView)
- Specified by:
sqlDropView
in interfaceDatabasePlatformX
-
sqlDropSequence
public java.lang.String sqlDropSequence(java.lang.String schemaPlusSequence)
- Specified by:
sqlDropSequence
in interfaceDatabasePlatform
-
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 interfaceDatabasePlatform
-
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 interfaceDatabasePlatform
- Parameters:
colClassName
- The name of the columns data type e.g. java.lang.StringnativeType
- THe column type e.g. VARCHARcolumnDefinition
-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 interfaceDatabasePlatform
- Parameters:
schemaPlusTable
- The schema and name of the table to delete fromwhereClause
- 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 interfaceDatabasePlatformX
-
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 interfaceDatabasePlatformX
-
sqlAlterColumnSize
public java.lang.String sqlAlterColumnSize(java.lang.String schemaPlusTable, java.lang.String columnName, java.lang.String columnDefinition)
- Specified by:
sqlAlterColumnSize
in interfaceDatabasePlatformX
-
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 interfaceDatabasePlatform
- 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 indexcolumns
- The columnsasc
- 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 interfaceDatabasePlatform
- Parameters:
consName
- The c onstraint nameschemaPlusTable
- The schema and name of the tablecolumns
- 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 interfaceDatabasePlatformX
- 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 interfaceDatabasePlatform
-
sqlDropUniqueConstraint
public java.lang.String sqlDropUniqueConstraint(java.lang.String schemaPlusTable, java.lang.String consName, java.lang.String[] columns)
- Specified by:
sqlDropUniqueConstraint
in interfaceDatabasePlatform
-
stringArrayContains
public static boolean stringArrayContains(java.lang.String[] hayStack, java.lang.String needle)
-
sqlViewMetaDataInsert
@Deprecated public java.lang.String sqlViewMetaDataInsert()
Deprecated.- Specified by:
sqlViewMetaDataInsert
in interfaceDatabasePlatformX
- Returns:
-
sqlSchemaMetaDataNextIndex
public java.lang.String sqlSchemaMetaDataNextIndex()
- Specified by:
sqlSchemaMetaDataNextIndex
in interfaceDatabasePlatformX
-
sqlViewMetaDataNextIndex
public java.lang.String sqlViewMetaDataNextIndex()
-
sqlSchemaMetaDataInsert
public java.lang.String sqlSchemaMetaDataInsert()
- Specified by:
sqlSchemaMetaDataInsert
in interfaceDatabasePlatformX
-
sqlGenericItemInsertV511
@Deprecated public java.lang.String sqlGenericItemInsertV511()
Deprecated.- Specified by:
sqlGenericItemInsertV511
in interfaceDatabasePlatformX
-
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 interfaceDatabasePlatform
-
sqlDropForeignKey
public java.lang.String sqlDropForeignKey(java.lang.String schemaPlusTable, java.lang.String fkName)
- Specified by:
sqlDropForeignKey
in interfaceDatabasePlatform
-
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 interfaceDatabasePlatform
-
getAddUserSql
public java.lang.String getAddUserSql()
- Specified by:
getAddUserSql
in interfaceDatabasePlatform
-
getDeleteUserSql
public java.lang.String getDeleteUserSql()
- Specified by:
getDeleteUserSql
in interfaceDatabasePlatform
-
getUpdatePasswordSql
public java.lang.String getUpdatePasswordSql()
- Specified by:
getUpdatePasswordSql
in interfaceDatabasePlatform
-
getSetEnabledSql
public java.lang.String getSetEnabledSql()
- Specified by:
getSetEnabledSql
in interfaceDatabasePlatform
-
getAddAuthoritySql
public java.lang.String getAddAuthoritySql()
- Specified by:
getAddAuthoritySql
in interfaceDatabasePlatform
-
getAddUserRoleSql
public java.lang.String getAddUserRoleSql()
- Specified by:
getAddUserRoleSql
in interfaceDatabasePlatform
-
getDeleteAuthoritiesSql
public java.lang.String getDeleteAuthoritiesSql()
- Specified by:
getDeleteAuthoritiesSql
in interfaceDatabasePlatform
-
sqlSelectDuplicateRows
public java.lang.String sqlSelectDuplicateRows(java.lang.String schemaPlusTable, java.lang.String[] columns)
- Specified by:
sqlSelectDuplicateRows
in interfaceDatabasePlatform
-
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 interfaceDatabasePlatform
- 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
-
buildTableInfosLazy
public java.util.Map<java.lang.String,DBTableInfo> buildTableInfosLazy(java.lang.String dbSchemaName, LazyLoader lazyLoader, com.im.commons.progress.DFFeedback feedback)
- Specified by:
buildTableInfosLazy
in interfaceDatabasePlatform
-
buildTableInfosEager
public java.util.Map<java.lang.String,DBTableInfo> buildTableInfosEager(java.lang.String dbSchemaName, com.im.commons.progress.DFFeedback feedback)
- Specified by:
buildTableInfosEager
in interfaceDatabasePlatform
-
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 interfaceDatabasePlatform
- Parameters:
dbSchemaName
- The schema in which the table residestableName
- The table name- Returns:
- The database table info The method can return null if the table does not exist.
-
buildTableInfoFull
public DBTableInfo buildTableInfoFull(java.lang.String dbSchemaName, java.lang.String tableName, LazyLoader lazyLoader, com.im.commons.progress.DFFeedback feedback)
- Specified by:
buildTableInfoFull
in interfaceDatabasePlatform
-
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 nameuseCache
- 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 schematableName
- The tablecollsInTable
- The columnsuseCache
- 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 interfaceDatabasePlatformX
- Returns:
- db user or null
-
checkSchemaExistence
public void checkSchemaExistence(java.lang.String schemaId) throws SchemaDoesNotExistException
Description copied from interface:DatabasePlatform
Checks whether an schema exists in the IJC metadata registry (IJC_SCHEMA table) or not also checks whether the database/ IJC_SCHEMA table exists or not.- Specified by:
checkSchemaExistence
in interfaceDatabasePlatform
- Throws:
SchemaDoesNotExistException
-
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 interfaceDatabasePlatform
- Parameters:
userName
- current logged in userschemaId
- current schema
-
sqlDataColumn
public java.lang.String sqlDataColumn()
Hook for optimized CLOB loading in Oracle.- Specified by:
sqlDataColumn
in interfaceDatabasePlatformX
- 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 interfaceDatabasePlatformX
- 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 interfaceDatabasePlatformX
- 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 interfaceDatabasePlatformX
- 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 interfaceDatabasePlatformX
- 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 interfaceDatabasePlatformX
- Parameters:
size
- the new size of the column- Returns:
- the sql statement for updating the password column in ijc_security_users table
-
-