Package com.ibm.fhir.database.utils.db2
Class Db2CatalogDAO
- java.lang.Object
-
- com.ibm.fhir.database.utils.db2.Db2CatalogDAO
-
public class Db2CatalogDAO extends java.lang.ObjectAccess to the DB2 catalog tables
-
-
Constructor Summary
Constructors Constructor Description Db2CatalogDAO(IDatabaseTranslator w)Db2CatalogDAO(IDatabaseTranslator w, java.lang.String catalogSchema)So that we can test in Derby
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPartition(java.sql.Connection c, java.lang.String prefix, java.lang.String schema, java.lang.String table, java.util.Date lowValue, java.util.Date highValue)Bolt on a new partition to the given tablevoiddetachPartition(java.sql.Connection c, java.lang.String schema, java.lang.String table, java.lang.String partitionName)Drop the named partition from the table.voiddropTable(java.sql.Connection connection, java.lang.String schemaTable)Drop the named tablejava.util.List<java.lang.String>getDetachedTableList(java.sql.Connection connection, java.lang.String schema, java.lang.String table)Get a list of all the table names which come from the detach partition operationjava.util.List<PartitionInfo>getPartitionList(java.sql.Connection c, java.lang.String schema, java.lang.String tableName)Get the list of partitions.static java.lang.Stringunwrap(java.lang.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, java.lang.String catalogSchema)
So that we can test in Derby- Parameters:
catalogSchema-
-
-
Method Detail
-
getPartitionList
public java.util.List<PartitionInfo> getPartitionList(java.sql.Connection c, java.lang.String schema, java.lang.String tableName) throws java.sql.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:
java.sql.SQLException
-
unwrap
public static java.lang.String unwrap(java.lang.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(java.sql.Connection c, java.lang.String prefix, java.lang.String schema, java.lang.String table, java.util.Date lowValue, java.util.Date highValue) throws java.sql.SQLExceptionBolt on a new partition to the given table- Parameters:
c-prefix-schema-table-lowValue-highValue-- Throws:
java.sql.SQLException
-
detachPartition
public void detachPartition(java.sql.Connection c, java.lang.String schema, java.lang.String table, java.lang.String partitionName) throws java.sql.SQLExceptionDrop the named partition from the table. Obtains a table (exclusive) lock before proceeding- Parameters:
c-schema-table-partitionName-- Throws:
java.sql.SQLException
-
getDetachedTableList
public java.util.List<java.lang.String> getDetachedTableList(java.sql.Connection connection, java.lang.String schema, java.lang.String table) throws java.sql.SQLExceptionGet a list of all the table names which come from the detach partition operation- Parameters:
connection-schema-table-- Returns:
- Throws:
java.sql.SQLException
-
dropTable
public void dropTable(java.sql.Connection connection, java.lang.String schemaTable) throws java.sql.SQLExceptionDrop the named table- Parameters:
connection-schemaTable- the schema qualified table name- Throws:
java.sql.SQLException
-
-