Class Db2CatalogDAO


  • public class Db2CatalogDAO
    extends java.lang.Object
    Access to the DB2 catalog tables
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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)
      Bolt on a new partition to the given table
      void detachPartition​(java.sql.Connection c, java.lang.String schema, java.lang.String table, java.lang.String partitionName)
      Drop the named partition from the table.
      void dropTable​(java.sql.Connection connection, java.lang.String schemaTable)
      Drop the named table
      java.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 operation
      java.util.List<PartitionInfo> getPartitionList​(java.sql.Connection c, java.lang.String schema, java.lang.String tableName)
      Get the list of partitions.
      static java.lang.String unwrap​(java.lang.String value)
      The high/low values look like this: '2017-01-01-00.00.00.000000'.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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.SQLException
        Bolt 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.SQLException
        Drop 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.SQLException
        Get 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.SQLException
        Drop the named table
        Parameters:
        connection -
        schemaTable - the schema qualified table name
        Throws:
        java.sql.SQLException