Examples of SQLLongint


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

  {
    REPORT("start transactionalProperties");

    // put a couple of properties in with different values and types

    tc.setProperty("T_Key_Frog", new SQLLongint(479), false);
    tc.setProperty("T_Key_Tiger", "Roar, ROAR", false);


    long lvalue = ((SQLLongint) (tc.getProperty("T_Key_Frog"))).getLong();
    if (lvalue != 479)
      throw T_Fail.testFailMsg("setProperty() - expected 479 - got " + lvalue);

    String svalue = (String) tc.getProperty("T_Key_Tiger");
    if (!svalue.equals("Roar, ROAR"))
      throw T_Fail.testFailMsg("setProperty() - expected 'Roar, ROAR' - got " + svalue);

    tc.commit();

    // should still be accessable after the commit
    lvalue = ((SQLLongint) (tc.getProperty("T_Key_Frog"))).getLong();
    if (lvalue != 479)
      throw T_Fail.testFailMsg("setProperty() - expected 479 - got " + lvalue);

    svalue = (String) tc.getProperty("T_Key_Tiger");
    if (!svalue.equals("Roar, ROAR"))
      throw T_Fail.testFailMsg("setProperty() - expected 'Roar, ROAR' - got " + svalue);

    tc.commit();

    // see if update works
    tc.setProperty("T_Key_Tiger", "mieow, mieow", false);
    svalue = (String) tc.getProperty("T_Key_Tiger");
    if (!svalue.equals("mieow, mieow"))
      throw T_Fail.testFailMsg("setProperty() - expected 'mieow, mieow' - got " + svalue);

    tc.commit();
    svalue = (String) tc.getProperty("T_Key_Tiger");
    if (!svalue.equals("mieow, mieow"))
      throw T_Fail.testFailMsg("setProperty() - expected 'mieow, mieow' - got " + svalue);

    // see if an update to a different type works
    tc.setProperty("T_Key_Tiger", new SQLLongint(570), false);
    lvalue = ((SQLLongint) (tc.getProperty("T_Key_Tiger"))).getLong();

    if (lvalue != 570)
      throw T_Fail.testFailMsg("setProperty() - expected 570 - got " + lvalue);

    tc.commit();

    lvalue = ((SQLLongint) (tc.getProperty("T_Key_Tiger"))).getLong();
    if (lvalue != 570)
      throw T_Fail.testFailMsg("setProperty() - expected 570 - got " + lvalue);

    tc.commit();

    // delete a key
    tc.setProperty("T_Key_Frog", (Serializable) null, false);
    if (tc.getProperty("T_Key_Frog") != null)
      throw T_Fail.testFailMsg("setProperty() - delete failed");
    tc.commit();

    if (tc.getProperty("T_Key_Frog") != null)
      throw T_Fail.testFailMsg("setProperty() - delete failed");

    tc.commit();

    // now see if rollback works.
    tc.setProperty("T_Key_Tiger", new SQLLongint(457), false);

    tc.abort();
    lvalue = ((SQLLongint) (tc.getProperty("T_Key_Tiger"))).getLong();
    if (lvalue != 570)
      throw T_Fail.testFailMsg("setProperty() - expected 570 - got " + lvalue);
View Full Code Here

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

                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_SERIALIZABLE);

    // Create a row.
    T_AccessRow row = new T_AccessRow(1);
    SQLLongint col = new SQLLongint(testValue);
    row.setCol(0, col);

    // Stuff in the test value so we can recognize this conglom later.
    cc.insert(row.getRowArray());
View Full Code Here

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

      null, 0, null, null, 0);

    // 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

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

      null, 0, null, null, 0);

    // 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];
View Full Code Here

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

      null, // stop position - last row in conglomerate
            0);   // unused if stop position is null.

    // An empty row
    T_AccessRow row = new T_AccessRow(1);
    SQLLongint col = new SQLLongint(0);
    row.setCol(0, col);

    // Iterate through and check that the rows are still there.
    // Note this part of the test will inten
    int nrows = 0;
View Full Code Here

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

                TransactionController.ISOLATION_SERIALIZABLE);

        // insert 5 rows

        T_AccessRow r1        = null;
    SQLLongint c1   = null;

        for (int i = 1; i < 5; i++)
        {
            // Create a row.
            r1  = new T_AccessRow(1);
            c1  = new SQLLongint(i);
            r1.setCol(0, c1);

            // Get a location template
            RowLocation rowloc = cc.newRowLocationTemplate();
View Full Code Here

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

        T_AccessRow  accessRow  = null;
        for (int i = 1; i < 5; i++)
        {
            // Create a row.
            accessRow  = new T_AccessRow(1);
            SQLLongint c1  = new SQLLongint(i);
            accessRow.setCol(0, c1);
           
            // Insert the row and remember its location.
            cc.insert(accessRow.getRowArray());
        }
View Full Code Here

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

                fetch_row_validColumns.set(i);
            }
        }

        // point key at the right column in the fetch_template
        SQLLongint key_column = (SQLLongint) fetch_template[2];

        /**********************************************************************
         * Forward scan test case
         **********************************************************************
         */

        if (!ordered)
        {
            set = create_hash_set(input_expect_key, expect_numrows, order);
        }

        ScanController scan =
            tc.openScan(
                conglomid, false,
                0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_SERIALIZABLE,
                (FormatableBitSet) fetch_row_validColumns,
                start_key, start_op,
                qualifier,
                stop_key, stop_op);

        int  expect_key = input_expect_key;
        long key        = -42;
        long key2       = -42;
        long numrows    = 0;

        while (scan.fetchNext(fetch_template))
        {
            // see if we are getting the right keys.
            key = key_column.getLong();

            // make sure a subsequent fetch also works.
            key_column.setValue(-42);

            scan.fetch(fetch_template);
            key2 = key_column.getLong();

            if (ordered)
            {
                if ((key != expect_key) || (key2 != expect_key))
                {
View Full Code Here

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

        // run through a predicates as described in the openScan() interface,
        // and implement them in qualifiers rather than start and stop.
        //

        // Use the following SQLLongint's for qualifier values //
        SQLLongint qual_col1 = new SQLLongint(-1);
        SQLLongint qual_col2 = new SQLLongint(-1);
        SQLLongint qual_col3 = new SQLLongint(-1);
        SQLLongint qual_col4 = new SQLLongint(-1);
        SQLLongint qual_col5 = new SQLLongint(-1);
        SQLLongint qual_col6 = new SQLLongint(-1);
        SQLLongint qual_col7 = new SQLLongint(-1);


        // test predicate x = 5
        //
        //     result set should be: {5,2,16}, {5,4,17}, {5,6,18}
        //
        progress("qual scan (x = 5)");
        qual_col1.setValue(5);
        Qualifier q1[][] =
        {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_EQUALS,
                            false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q1,
                   null,  ScanController.NA,
                   3, 16, init_order))
        {
            ret_val = false;
        }
                  
        //  +---------------------------------------------------------+
        //  |pred  |start|key|stop |key|rows returned |rows locked    |
        //  |      |value|op |value|op |              |(serialization)|
        //  +------+-----+---+-----+---+--------------+---------------+
        //  |x > 5 |{5}  |GT |null |   |{6,1} .. {9,1}|{5,6} .. {9,1} |
        //  +-----------------------------------------+---------------+
        progress("qual scan (x > 5)");
        qual_col1.setValue(5);
        Qualifier q2[][] =
        {
            {
                new QualifierUtil(
                    0, qual_col1, Orderable.ORDER_OP_LESSOREQUALS,
                    true, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q2,
                   null,  ScanController.NA,
                   3, 19, init_order))
        {
            ret_val = false;
        }

        //  +---------------------------------------------------------+
        //  |pred  |start|key|stop |key|rows returned |rows locked    |
        //  |      |value|op |value|op |              |(serialization)|
        //  +------+-----+---+-----+---+--------------+---------------+
        //  |x >= 5|{5}  |GE |null |   |{5,2} .. {9,1}|{4,6} .. {9,1} |
        //  +-----------------------------------------+---------------+
        progress("qual scan (x >= 5)");
        qual_col1.setValue(5);
        Qualifier q3[][] =
        {
            {
                new QualifierUtil(0, qual_col1,
                                Orderable.ORDER_OP_LESSTHAN,
                                true, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q3,
                   null, ScanController.NA,
                   6, 16, init_order))
        {
            ret_val = false;
        }

        //
        //  +---------------------------------------------------------+
        //  |pred  |start|key|stop |key|rows returned |rows locked    |
        //  |      |value|op |value|op |              |(serialization)|
        //  +------+-----+---+-----+---+--------------+---------------+
        //  |x <= 5|null |   |{5}  |GT |{1,1} .. {5,6}|first .. {5,6} |
        //  +-----------------------------------------+---------------+
        progress("qual scan (x <= 5)");
        qual_col1.setValue(5);
        Qualifier q4[][] =
        {
            {
                new QualifierUtil(0, qual_col1,
                                Orderable.ORDER_OP_LESSOREQUALS,
                                false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q4,
                   null, ScanController.NA,
                   8, 11, init_order))
        {
            ret_val = false;
        }

        //
        //  +---------------------------------------------------------+
        //  |pred  |start|key|stop |key|rows returned |rows locked    |
        //  |      |value|op |value|op |              |(serialization)|
        //  +------+-----+---+-----+---+--------------+---------------+
        //   |x < 5 |null |   |{5}  |GE |{1,1} .. {4,6}|first .. {4,6} |
        //  +-----------------------------------------+---------------+
        progress("qual scan (x < 5)");
        qual_col1.setValue(5);
        Qualifier q5[][] =
        {
            {
                new QualifierUtil(0, qual_col1,
                                Orderable.ORDER_OP_LESSTHAN,
                                false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q5,
                   null, ScanController.NA,
                   5, 11, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
      //  |x >= 5 and x <= 7|{5},  |GE|{7}  |GT|{5,2} .. {7,1}|{4,6} .. {7,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x >= 5 and x <= 7)");
        qual_col1.setValue(5);
        qual_col2.setValue(7);
        Qualifier q6[][] = {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_LESSTHAN,
                            true, true, true),
                new QualifierUtil(0, qual_col2,
                            Orderable.ORDER_OP_LESSOREQUALS,
                            false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q6,
                   null, ScanController.NA,
                   5, 16, init_order))
        {
            ret_val = false;
        }

        // passing qualifier in q6[0][0], q6[0][1] should evaluate same as
        // passing in q6[0][0], q6[1][0]

        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
      //  |x >= 5 and x <= 7|{5},  |GE|{7}  |GT|{5,2} .. {7,1}|{4,6} .. {7,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x >= 5 and x <= 7)");
        qual_col1.setValue(5);
        qual_col2.setValue(7);
        Qualifier q6_2[][] = {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_LESSTHAN,
                            true, true, true)
            },
            {
                new QualifierUtil(0, qual_col2,
                            Orderable.ORDER_OP_LESSOREQUALS,
                            false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q6_2,
                   null, ScanController.NA,
                   5, 16, init_order))
        {
            ret_val = false;
        }


        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
      //  |x = 5 and y > 2  |{5,2} |GT|{5}  |GT|{5,4} .. {5,6}|{5,2} .. {9,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x = 5 and y > 2)");
        qual_col1.setValue(5);
        qual_col2.setValue(2);
        Qualifier q7[][] = {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_EQUALS,
                            false, true, true),
                new QualifierUtil(1, qual_col2,
                            Orderable.ORDER_OP_LESSOREQUALS,
                            true, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q7,
                   null, ScanController.NA,
                   2, 17, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
        //   |x = 5 and y >= 2 | {5,2}|GE| {5} |GT|{5,2} .. {5,6}|{4,6} .. {9,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x = 5 and y >= 2)");
        qual_col1.setValue(5);
        qual_col2.setValue(2);
        Qualifier q8[][] = {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_EQUALS,
                            false, true, true),
                new QualifierUtil(1, qual_col2,
                            Orderable.ORDER_OP_LESSTHAN,
                            true, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q8,
                   null, ScanController.NA,
                   3, 16, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
        //   |x = 5 and y < 5  | {5}  |GE|{5,5}|GE|{5,2} .. {5,4}|{4,6} .. {5,4}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x = 5 and y < 5)");
        qual_col1.setValue(5);
        qual_col2.setValue(5);
        Qualifier q9[][] = {
            {
                new QualifierUtil(0, qual_col1,
                            Orderable.ORDER_OP_EQUALS,
                            false, true, true),
                new QualifierUtil(1, qual_col1,
                            Orderable.ORDER_OP_LESSTHAN,
                            false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q9,
                   null, ScanController.NA,
                   2, 16, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred             |start|key|stop |key|rows returned|rows locked   |
        //  |                 |value|op |value|op |             |(serialized)  |
        //  +-----------------+------+--+-----+--+--------------+--------------+
        //   |x = 2            | {2}  |GE| {2} |GT|none          |{1,1} .. {1,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x = 2)");
        qual_col1.setValue(2);
        Qualifier q10[][] = {
            {
                new QualifierUtil(0, qual_col1,
                                Orderable.ORDER_OP_EQUALS,
                                false, true, true)
            }
        };
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q10,
                   null, ScanController.NA,
                   0, 0, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred            |start|key|stop |key|rows returned |rows locked   |
        //  |                |value|op |value|op |              |(serialized)  |
        //  +----------------+-----+---+-----+-- +--------------+--------------+
        //   |x >= 5 or y = 6 | null|   | null|   |{4,6} .. {9,1}|{1,1} .. {9,1}|
        //   +------------------------------------------------------------------+
        progress("qual scan (x >= 5) or (y = 6)");
        qual_col1.setValue(5);
        qual_col2.setValue(6);
        Qualifier q11[][] new Qualifier[2][];
        q11[0] = new Qualifier[0];
        q11[1] = new Qualifier[2];

        q11[1][0] =
                new QualifierUtil(
                        0, qual_col1,
                        Orderable.ORDER_OP_GREATEROREQUALS,
                        false, true, true);
        q11[1][1] =
                new QualifierUtil(
                        1, qual_col2,
                        Orderable.ORDER_OP_EQUALS,
                        false, true, true);
       
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q11,
                   null, ScanController.NA,
                   7, 15, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred            |start|key|stop |key|rows returned |rows locked   |
        //  |                |value|op |value|op |              |(serialized)  |
        //  +----------------+-----+---+-----+-- +--------------+--------------+
        //   |(x = 1 or y = 1 or y = 6)|
        //   |     and        |
        //   |(x > 5 or y = 1)|
        //   |     and        |
        //   |(x = 9 or x = 7)|null |   | null|   |{7,1} .. {9,1}|{1,1} .. {9,1}|
        //   +------------------------------------------------------------------+

        progress("qual scan (x = 1 or y = 1 or y = 6) and (x > 5 or y = 1) and (x = 9 or x = 7)");
        qual_col1.setValue(1);
        qual_col2.setValue(1);
        qual_col3.setValue(6);
        qual_col4.setValue(5);
        qual_col5.setValue(1);
        qual_col6.setValue(9);
        qual_col7.setValue(7);

        Qualifier q12[][] = new Qualifier[4][];
        q12[0] = new Qualifier[0];
        q12[1] = new Qualifier[3];
        q12[2] = new Qualifier[2];
        q12[3] = new Qualifier[2];


        q12[1][0] =
            new QualifierUtil(
                    0, qual_col1,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);

        q12[1][1] =
            new QualifierUtil(
                    1, qual_col2,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);

        q12[1][2] =
            new QualifierUtil(
                    1, qual_col3,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);

        q12[2][0] =
            new QualifierUtil(
                    0, qual_col4,
                    Orderable.ORDER_OP_GREATERTHAN,
                    false, true, true);

        q12[2][1] =
            new QualifierUtil(
                    1, qual_col5,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);

        q12[3][0] =
            new QualifierUtil(
                    0, qual_col6,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);

        q12[3][1] =
            new QualifierUtil(
                    0, qual_col7,
                    Orderable.ORDER_OP_EQUALS,
                    false, true, true);
       
        if (!t_scan(tc, conglomid, openscan_template, fetch_template,
                   null, ScanController.NA,
                   q12,
                   null, ScanController.NA,
                   2, 20, init_order))
        {
            ret_val = false;
        }

        //  +------------------------------------------------------------------+
        //  |pred            |start|key|stop |key|rows returned |rows locked   |
        //  |                |value|op |value|op |              |(serialized)  |
        //  +----------------+-----+---+-----+-- +--------------+--------------+
        //   |(y = 4 or y = 1)|
        //   |     and        |
        //   |(x = 1 or x = 4 or x= 9)|
        //   |     and        |
        //   |(z = 15 or z = 14)|null |   | null|   |{4,4} .. {4,4}| ALL        |
        //   +------------------------------------------------------------------+

        progress("qual scan (x = 1 or x = 4 or x= 9) and (y = 4 or y = 1) and (z = 15 or z = 14)");

        qual_col1.setValue(4);
        qual_col2.setValue(1);
        qual_col3.setValue(1);
        qual_col4.setValue(4);
        qual_col5.setValue(9);
        qual_col6.setValue(15);
        qual_col7.setValue(14);

        Qualifier q13[][] = new Qualifier[4][];
        q13[0] = new Qualifier[0];
        q13[1] = new Qualifier[2];
        q13[2] = new Qualifier[3];
View Full Code Here

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

    }

    currentRow = rowArray[0].getNewNullRow();
    indexRow = new DataValueDescriptor[2];
    indexRow[0] = new SQLLongint(position);
    indexRow[1] =   heapCC.newRowLocationTemplate();

    DataValueDescriptor[] searchRow =  new DataValueDescriptor[1];
    searchRow[0] = new SQLLongint(position);

    if(indexsc == null)
    {
      indexsc = tc.openScan(positionIndexConglomId,
                  false,                           // don't hold open across commit
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.