Package com.ibm.fhir.database.utils.db2
Class Db2CatalogDAO
- java.lang.Object
-
- com.ibm.fhir.database.utils.db2.Db2CatalogDAO
-
public class Db2CatalogDAO extends Object
Access to the DB2 catalog tables
-
-
Constructor Summary
Constructors Constructor Description Db2CatalogDAO(IDatabaseTranslator w)
Db2CatalogDAO(IDatabaseTranslator w, String catalogSchema)
So that we can test in Derby
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPartition(Connection c, String prefix, String schema, String table, Date lowValue, Date highValue)
Bolt on a new partition to the given tablevoid
detachPartition(Connection c, String schema, String table, String partitionName)
Drop the named partition from the table.void
dropTable(Connection connection, String schemaTable)
Drop the named tableList<String>
getDetachedTableList(Connection connection, String schema, String table)
Get a list of all the table names which come from the detach partition operationList<PartitionInfo>
getPartitionList(Connection c, String schema, String tableName)
Get the list of partitions.static String
unwrap(String value)
The high/low values look like this: '2017-01-01-00.00.00.000000'.
-
-
-
Constructor Detail
-
Db2CatalogDAO
public Db2CatalogDAO(IDatabaseTranslator w)
-
Db2CatalogDAO
public Db2CatalogDAO(IDatabaseTranslator w, String catalogSchema)
So that we can test in Derby- Parameters:
catalogSchema
-
-
-
Method Detail
-
getPartitionList
public List<PartitionInfo> getPartitionList(Connection c, String schema, String tableName) throws SQLException
Get the list of partitions. Take special note of the low and high values, because they include string markers e.g.PNAME SEQNO LOWINCLUSIVE LOWVALUE HIGHINCLUSIVE HIGHVALUE ---------------- ----------- ------------ -------------------------------- ------------- -------------------------------- PART0 0 Y '2017-01-01-00.00.00.000000' N '2017-02-01-00.00.00.000000' PART1 1 Y '2017-02-01-00.00.00.000000' N '2017-03-01-00.00.00.000000' PART2 2 Y '2017-03-01-00.00.00.000000' N '2017-04-01-00.00.00.000000'
- Parameters:
c
-tableName
-- Returns:
- Throws:
SQLException
-
unwrap
public static String unwrap(String value)
The high/low values look like this: '2017-01-01-00.00.00.000000'. We want this: 2017-01-01- Parameters:
value
-- Returns:
-
addPartition
public void addPartition(Connection c, String prefix, String schema, String table, Date lowValue, Date highValue) throws SQLException
Bolt on a new partition to the given table- Parameters:
c
-prefix
-schema
-table
-lowValue
-highValue
-- Throws:
SQLException
-
detachPartition
public void detachPartition(Connection c, String schema, String table, String partitionName) throws SQLException
Drop the named partition from the table. Obtains a table (exclusive) lock before proceeding- Parameters:
c
-schema
-table
-partitionName
-- Throws:
SQLException
-
getDetachedTableList
public List<String> getDetachedTableList(Connection connection, String schema, String table) throws SQLException
Get a list of all the table names which come from the detach partition operation- Parameters:
connection
-schema
-table
-- Returns:
- Throws:
SQLException
-
dropTable
public void dropTable(Connection connection, String schemaTable) throws SQLException
Drop the named table- Parameters:
connection
-schemaTable
- the schema qualified table name- Throws:
SQLException
-
-