Package org.apache.derby.iapi.types

Examples of org.apache.derby.iapi.types.RowLocation


    SQLInteger c2 = new SQLInteger(100);
    r1.setCol(0, c1);
    r1.setCol(1, c2);

    // Get a location template
    RowLocation rowloc1 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc1);

        // create another 2 column row. int column = 2.
    // Get a location template
        r1.setCol(0, new SQLInteger(2));
        r1.setCol(1, new SQLInteger(200));
    RowLocation rowloc2 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc2);

        cc.delete(rowloc2);
View Full Code Here


    SQLInteger c2 = new SQLInteger(100);
    r1.setCol(0, c1);
    r1.setCol(1, c2);

    // Get a location template
    RowLocation rowloc1 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc1);

        // create another 2 column row. int column = 2.
    // Get a location template
        r1.setCol(0, new SQLInteger(2));
        r1.setCol(1, new SQLInteger(200));
    RowLocation rowloc2 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc2);

        cc.delete(rowloc2);
View Full Code Here

    SQLInteger c2 = new SQLInteger(100);
    r1.setCol(0, c1);
    r1.setCol(1, c2);

    // Get a location template
    RowLocation rowloc1 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc1);

        cc.close();
View Full Code Here

    SQLInteger c2 = new SQLInteger(100);
    r1.setCol(0, c1);
    r1.setCol(1, c2);

    // Get a location template
    RowLocation rowloc1 = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc1);

        cc.close();
View Full Code Here

    // Create the template for the index. This method "knows" that
    // all rows in the base table have one IntCol
    T_AccessRow template = new T_AccessRow(2);
    SQLLongint col0 = new SQLLongint(0);
    RowLocation col1 = sc.newRowLocationTemplate();
    template.setCol(0, col0);
    template.setCol(1, col1);

        sc.close();
View Full Code Here

    // Create the template for the index. This method "knows" that
    // all rows in the base table have one IntCol
    T_AccessRow template = new T_AccessRow(2);
    SQLLongint col0 = new SQLLongint(0);
    RowLocation col1 = sc.newRowLocationTemplate();
    template.setCol(0, col0);
    template.setCol(1, col1);

    DataValueDescriptor[] baseRow = new DataValueDescriptor[1];
    baseRow[0] = col0;
View Full Code Here

    T_AccessRow r1 = new T_AccessRow(1);
    SQLInteger c1 = new SQLInteger(0);
    r1.setCol(0, c1);

    // Get a location template
    RowLocation rowloc = cc.newRowLocationTemplate();

    // Insert the row and remember its location.
    cc.insertAndFetchLocation(r1.getRowArray(), rowloc);

    // now commit nosync without releasing the row lock
View Full Code Here

            r1  = new T_AccessRow(1);
            c1  = new SQLLongint(i);
            r1.setCol(0, c1);

            // Get a location template
            RowLocation rowloc = cc.newRowLocationTemplate();

            // Insert the row and remember its location.
            cc.insertAndFetchLocation(r1.getRowArray(), rowloc);
        }
       
View Full Code Here

       
        // Move to the first row
        base_scan.next();
               
        // Get the RowLocation for the first row:
        RowLocation firstRow = base_scan.newRowLocationTemplate();
        base_scan.fetchLocation(firstRow);
        base_scan.fetch(accessRow.getRowArray());       
        long key_value = ((SQLLongint) accessRow.getCol(0)).getLong();
        if (key_value != 0) {
            throw T_Fail.testFailMsg
View Full Code Here

            0);   // unused if stop position is null.

        // now delete all the rows and remember the row location of the
        // last row.

        RowLocation deleted_page_rowloc = base_scan.newRowLocationTemplate();


        for (int i = 0; i < 10; i++)
        {
            base_scan.next();
            base_scan.fetchLocation(deleted_page_rowloc);
            base_scan.delete();

            tc.commit();
        }
        base_scan.close();
        tc.commit();

        // at this point the post commit thread should have reclaimed all the 5
        // pages.  Open it, at read uncommitted level.
    cc = tc.openConglomerate(
                orig_conglomid,
                false,
                0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_READ_UNCOMMITTED);

        // Test heap fetch of row on page which does not exist.
        if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null))
        {
            throw T_Fail.testFailMsg(
                "(readUncommitted) fetch should ret false for reclaimed page.");
        }
            
        // Test heap replace of row on page which does not exist.
        FormatableBitSet   update_desc = new FormatableBitSet(1);
        if (cc.replace(deleted_page_rowloc, big_row.getRowArray(), update_desc))
        {
            throw T_Fail.testFailMsg(
                "(readUncommitted) delete should ret false for reclaimed page.");
        }
      
        // Test heap fetch (overloaded call) of row on page which does not exist.
        if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null, true))
        {
            throw T_Fail.testFailMsg(
                "(readUncommitted) fetch should ret false for reclaimed page.");
        }
       
        // Test heap delete of row on page which does not exist.
        if (cc.delete(deleted_page_rowloc))
        {
            throw T_Fail.testFailMsg(
                "(readUncommitted) delete should ret false for reclaimed page.");
        }
               
        cc.close();

        /*
         * TEST 2 - test heap fetch of row on page where row does not exist.
         * <p>
         * Do this by inserting enough rows to put 1 row on the 2nd page.
         * Then delete this one row, which will queue a post commit to reclaim
         * the row and page.  Then insert one more row on the same page in
         * the same xact.  Now commit the xact, which will cause post commit
         * to run which will reclaim the row but not the page.  Then try and
         * fetch the row which was deleted.
         */

        // string column will be 1500 bytes, allowing 2 rows per page to fit.
        SQLChar stringcol = new SQLChar();
        stringcol.setValue(T_AccessFactory.repeatString("012345678901234", 100));
        big_row.setCol(1, stringcol);

    // Create a heap conglomerate.
    orig_conglomid =
            tc.createConglomerate(
                "heap",       // create a heap conglomerate
                big_row.getRowArray(),
        null,   // column sort order not required for heap
                null,         // default properties
                TransactionController.IS_DEFAULT);       // not temporary

    cc = 
            tc.openConglomerate(
                orig_conglomid,
                false,
                TransactionController.OPENMODE_FORUPDATE,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_READ_UNCOMMITTED);

        // add 3 rows, should result in 1 row on second page.

        for (int i = 0; i < 3; i++)
        {
            big_row.setCol(0, new SQLInteger(i));
      cc.insert(big_row.getRowArray());
        }

    // Open another scan on the conglomerate.
    base_scan = tc.openScan(
      orig_conglomid,
      true, // hold cursor open across commit
      TransactionController.OPENMODE_FORUPDATE, // for update
            TransactionController.MODE_RECORD,
            TransactionController.ISOLATION_SERIALIZABLE,
      (FormatableBitSet) null, // all columns, all as objects
      null, // start position - first row in conglomerate
            0,    // unused if start position is null.
      null, // qualifier - accept all rows
      null, // stop position - last row in conglomerate
            0);   // unused if stop position is null.

        // now delete all the rows and remember the row location of the
        // last row.

        RowLocation deleted_row_rowloc  = base_scan.newRowLocationTemplate();

        for (int i = 0; i < 3; i++)
        {
            base_scan.next();
            base_scan.fetchLocation(deleted_row_rowloc);
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.types.RowLocation

Copyright © 2018 www.massapicom. 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.