Examples of assertTableStats()


Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        //Drop the statistics on index I1 and then add it back by calling
        // update statistics
        s.execute("CALL SYSCS_UTIL.SYSCS_DROP_STATISTICS('APP','T1','I1')");
        stats.assertTableStats(tbl1, 1);
        s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','T1','I1')");
        stats.assertTableStats(tbl1, 2);
        //Drop all the statistics on table T1 and then recreate all the
        // statisitcs back again
        s.execute("CALL SYSCS_UTIL.SYSCS_DROP_STATISTICS('APP','T1',null)");
        stats.assertNoStatsTable(tbl1);
        s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','T1',null)");
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        //Drop all the statistics on table T1 and then recreate all the
        // statisitcs back again
        s.execute("CALL SYSCS_UTIL.SYSCS_DROP_STATISTICS('APP','T1',null)");
        stats.assertNoStatsTable(tbl1);
        s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','T1',null)");
        stats.assertTableStats(tbl1, 2);
        //Dropping the index should get rid of it's statistics
        s.executeUpdate("DROP INDEX I1");
        stats.assertTableStats(tbl1, 1);

        //calls to system procedure for update and drop statistics are
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        stats.assertNoStatsTable(tbl1);
        s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','T1',null)");
        stats.assertTableStats(tbl1, 2);
        //Dropping the index should get rid of it's statistics
        s.executeUpdate("DROP INDEX I1");
        stats.assertTableStats(tbl1, 1);

        //calls to system procedure for update and drop statistics are
        // internally converted into ALTER TABLE ... sql but that generated
        // sql format is not available to end user to issue directly. Write a
        // test case for these internal sql syntaxes
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

            "PRIMARY KEY (c11)");
        stats.assertNoStatsTable("TEST_TAB_1");

        //Test - non-unique index
        s.executeUpdate("CREATE INDEX TEST_TAB_1_NUNQ_1 ON TEST_TAB_1(c12)");
        stats.assertTableStats("TEST_TAB_1",1);
        s.executeUpdate("DROP INDEX TEST_TAB_1_NUNQ_1");
        stats.assertNoStatsTable("TEST_TAB_1");
        s.executeUpdate("ALTER TABLE TEST_TAB_1 "+
                "DROP CONSTRAINT TEST_TAB_1_PK_1");
        stats.assertNoStatsTable("TEST_TAB_1");
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        //Test - unique key constraint on nullable column & non-nullable column
        s.executeUpdate("ALTER TABLE TEST_TAB_1 "+
                "ADD CONSTRAINT TEST_TAB_1_UNQ_2 "+
            "UNIQUE (c12, c13)");
        stats.assertTableStats("TEST_TAB_1",2);
        s.executeUpdate("ALTER TABLE TEST_TAB_1 "+
                "DROP CONSTRAINT TEST_TAB_1_UNQ_2");
        stats.assertNoStatsTable("TEST_TAB_1");
        s.executeUpdate("ALTER TABLE TEST_TAB_1 "+
                "DROP CONSTRAINT TEST_TAB_1_PK_1");
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        s.executeUpdate("CREATE TABLE TEST_TAB_3 (c31 int not null)");
        s.executeUpdate("INSERT INTO TEST_TAB_3 VALUES(1),(2)");
        s.executeUpdate("ALTER TABLE TEST_TAB_3 "+
                "ADD CONSTRAINT TEST_TAB_3_FK_1 "+
            "FOREIGN KEY(c31) REFERENCES TEST_TAB_1(c11)");
        stats.assertTableStats("TEST_TAB_3",1);
        s.executeUpdate("ALTER TABLE TEST_TAB_3 "+
                "DROP CONSTRAINT TEST_TAB_3_FK_1");
        stats.assertNoStatsTable("TEST_TAB_3");

        //Test - foreign key and primary key constraint
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        //DERBY-5702 Like primary key earlier, adding foreign key constraint
        // didn't automatically add a statistics row for it. Have to run update
        // statistics manually to get a row added for it's stat
        stats.assertNoStatsTable("TEST_TAB_2");
        s.execute("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('APP','TEST_TAB_2', null)");
        stats.assertTableStats("TEST_TAB_2",1);
        //Number of statistics row for TEST_TAB_1 will remain unchanged since
        // it has only primary key defined on it
        stats.assertNoStatsTable("TEST_TAB_1");
        s.executeUpdate("ALTER TABLE TEST_TAB_2 "+
                "DROP CONSTRAINT TEST_TAB_2_FK_1");
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        setAutoCommit(true);
        IndexStatsUtil stats = new IndexStatsUtil(getConnection());
        // Expected FK table: 0
        // Expected main table: 2xPK, 1 non-unique, 1 FK = 4
        stats.assertNoStatsTable(tbl_fk);
        stats.assertTableStats(tbl, 4);
        IndexStatsUtil.IdxStats[] tbl_stats_0 = stats.getStatsTable(tbl);

        // Run the update statistics procedure.
        // Sleep at least one tick to ensure the timestamps differ.
        sleepAtLeastOneTick();
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        ps.setString(1, tbl_fk);
        ps.execute();

        // Check the counts.
        stats.assertNoStatsTable(tbl_fk);
        stats.assertTableStats(tbl, 4);
        // Check the timestamps (i.e. were they actually updated?).
        IndexStatsUtil.IdxStats[] tbl_stats_1 = stats.getStatsTable(tbl);
        assertEquals(tbl_stats_0.length, tbl_stats_1.length);
        for (int i=0; i < tbl_stats_1.length; i++) {
            assertTrue(tbl_stats_1[i].after(tbl_stats_0[i]));
View Full Code Here

Examples of org.apache.derbyTesting.junit.IndexStatsUtil.assertTableStats()

        // Just use any of the previous stats as a reference point.
        IndexStatsUtil.IdxStats nonUniqueIdx = stats.getStatsIndex(nuIdx)[0];
        assertTrue(nonUniqueIdx.after(tbl_stats_1[0]));
        // Check the counts again.
        stats.assertNoStatsTable(tbl_fk);
        stats.assertTableStats(tbl, 4);

        // Cleanup
        dropTable(tbl);
        dropTable(tbl_fk);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.