Package com.foundationdb.server.rowdata

Examples of com.foundationdb.server.rowdata.RowDef


    }

    protected boolean anyColumnChanged(Session session, RowData oldRow, RowData newRow,
                                       List<Column> columns) {
        RowDef rowDef = columns.get(0).getTable().rowDef();
        for (Column column : columns) {
            if (!AbstractStore.fieldEqual(rowDef, oldRow, rowDef, newRow,
                                          column.getPosition())) {
                return true;
            }
View Full Code Here


public final class NiceRowTest {
    @Test
    public void toRowDataBasic() throws Exception
    {
        RowDef rowDef = createRowDef(2);

        Object[] objects = new Object[2];
        objects[0] = 5;
        objects[1] = "Bob";
View Full Code Here

    @Test
    public void toRowDataLarge() throws Exception
    {
        final int NUM = 30;
        RowDef rowDef = createRowDef(NUM);

        Object[] objects = new Object[NUM];
        objects[0] = 15;
        objects[1] = "Robert";
        for (int i=2; i < NUM; ++i) {
View Full Code Here

    @Test
    public void toRowDataSparse() throws Exception
    {
        final int NUM = 30;
        RowDef rowDef = createRowDef(NUM);

        Object[] objects = new Object[NUM];
        objects[0] = 15;
        objects[1] = "Robert";
        int nulls = 0;
View Full Code Here

            bytes[i] = (byte)i;
        }
        String str = new String(bytes, "utf8");

        String ddl = "create table test.t(id int not null primary key, v varchar(255) character set utf8)";
        RowDef rowDef = SCHEMA_FACTORY.aisWithRowDefs(ddl).getTable("test", "t").rowDef();

        Object[] objects = { 1, str };
        RowData rowData = create(rowDef, objects);
        NewRow newRow = NiceRow.fromRowData(rowData, rowDef);

        assertEquals("fields count", 2, newRow.getFields().size());
        assertEquals("field[0]", 1, newRow.get(0));
        assertEquals("field[1]", str, newRow.get(1));
        assertEquals("field[1] charset", "UTF8", rowDef.getFieldDef(1).column().getCharsetName());

        compareRowDatas(rowData, newRow.toRowData());
    }
View Full Code Here

        assertEquals("char 4 high surrogate", true, Character.isHighSurrogate(TEST_STR.charAt(4)));
        assertEquals("char 5 low surrogate", true, Character.isLowSurrogate(TEST_STR.charAt(5)));
        assertEquals("utf8 byte length", 12, TEST_STR.getBytes("UTF-8").length);

        String ddl = "create table test.t(id int not null primary key, v varchar(32) character set utf8)";
        RowDef rowDef = SCHEMA_FACTORY.aisWithRowDefs(ddl).getTable("test", "t").rowDef();

        Object[] objects = { 1, TEST_STR };
        RowData rowData = create(rowDef, objects);
        NewRow newRow = NiceRow.fromRowData(rowData, rowDef);

        assertEquals("fields count", 2, newRow.getFields().size());
        assertEquals("field[0]", 1, newRow.get(0));
        assertEquals("field[1]", TEST_STR, newRow.get(1));
        assertEquals("field[1] charset", "UTF8", rowDef.getFieldDef(1).column().getCharsetName());

        compareRowDatas(rowData, newRow.toRowData());
    }
View Full Code Here

        IndexRow parentPKIndexRow = null;

        // All columns of all segments of the HKey
        for(HKeySegment hKeySegment : table.hKey().segments()) {
            // Ordinal for this segment
            RowDef segmentRowDef = hKeySegment.table().rowDef();
            hKeyAppender.append(segmentRowDef.table().getOrdinal());
            // Segment's columns
            for(HKeyColumn hKeyColumn : hKeySegment.columns()) {
                Table hKeyColumnTable = hKeyColumn.column().getTable();
                if(hKeyColumnTable != table) {
                    // HKey column from row of parent table
                    if (parentStoreData == null) {
                        // Initialize parent metadata and state
                        RowDef parentRowDef = rowDef.table().getParentTable().rowDef();
                        TableIndex parentPkIndex = parentRowDef.getPKIndex();
                        indexToHKey = parentPkIndex.indexToHKey();
                        parentStoreData = createStoreData(session, parentPkIndex);
                        parentPKIndexRow = readIndexRow(session, parentPkIndex, parentStoreData, rowDef, rowData);
                        i2hPosition = hKeyColumn.positionInHKey();
                    }
View Full Code Here

    }

    @Override
    public void writeRow(Session session, RowData rowData, Collection<TableIndex> tableIndexes,
                         Collection<GroupIndex> groupIndexes) {
        RowDef rowDef = getGlobalRowDef(session, rowData);
        writeRow(session, rowDef, rowData, tableIndexes, groupIndexes);
    }
View Full Code Here

        }
    }

    @Override
    public void deleteRow(Session session, RowData rowData, boolean cascadeDelete) {
        RowDef rowDef = getGlobalRowDef(session, rowData);
        deleteRow(session, rowDef, rowData, cascadeDelete);
    }
View Full Code Here

    }


    @Override
    public void updateRow(Session session, RowData oldRow, RowData newRow, ColumnSelector selector) {
        RowDef rowDef = getGlobalRowDef(session, oldRow);
        updateRow(session, rowDef, oldRow, rowDef, newRow, selector);
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.rowdata.RowDef

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.