Package com.foundationdb.server.rowdata

Examples of com.foundationdb.server.rowdata.RowDef


        // Check the updates (should be a NiceRow)
        assertEquals(1, legacyRow.get(cA));
        assertEquals(1, legacyRow.get(cB));
        assertEquals(1, legacyRow.get(cC));
        // Convert to LegacyRow and check NiceRow created from the legacy row's RowData
        RowDef rowDef = getRowDef(t);
        niceRow = (NiceRow) NiceRow.fromRowData(legacyRow.toRowData(), rowDef);
        assertEquals(1, niceRow.get(cA));
        assertEquals(1, niceRow.get(cB));
        assertEquals(1, niceRow.get(cC));
        // Convert back to NiceRow and check state again
View Full Code Here


        this.hKeyCache = new HKeyCache<>(adapter);
    }

    public void set(Key key, RowData rowData) {
        this.rowData = rowData;
        RowDef rowDef = adapter.schema().ais().getTable(rowData.getRowDefId()).rowDef();
        row = new LegacyRowWrapper(rowDef, rowData);

        currentHKey = hKeyCache.hKey(rowDef.table());
        if(key != null) {
            currentHKey.copyFrom(key);
        }
    }
View Full Code Here

        return new ValuesHKey(schema.newHKeyRowType(hKeyMetadata), store.getTypesRegistry());
    }

    @Override
    public void updateRow(Row oldRow, Row newRow) {
        RowDef rowDef = oldRow.rowType().table().rowDef();
        RowDef rowDefNewRow = newRow.rowType().table().rowDef();
        if (rowDef.getRowDefId() != rowDefNewRow.getRowDefId()) {
            throw new IllegalArgumentException(String.format("%s != %s", rowDef, rowDefNewRow));
        }
        RowData oldRowData = rowData(rowDef, oldRow, new RowDataCreator());
        RowData newRowData = rowData(rowDefNewRow, newRow, new RowDataCreator());
        try {
View Full Code Here

        }
    }

    @Override
    public void writeRow(Row newRow, Collection<TableIndex> indexes, Collection<GroupIndex> groupIndexes) {
        RowDef rowDef = newRow.rowType().table().rowDef();
        RowData newRowData = rowData(rowDef, newRow, new RowDataCreator());
        try {
            store.writeRow(getSession(), rowDef, newRowData, indexes, groupIndexes);
        } catch(InvalidOperationException e) {
            rollbackIfNeeded(getSession(), e);
View Full Code Here

        }
    }

    @Override
    public void deleteRow(Row oldRow, boolean cascadeDelete) {
        RowDef rowDef = oldRow.rowType().table().rowDef();
        RowData oldRowData = rowData(rowDef, oldRow, new RowDataCreator());
        try {
            store.deleteRow(getSession(), rowDef, oldRowData, cascadeDelete);
        } catch(InvalidOperationException e) {
            rollbackIfNeeded(getSession(), e);
View Full Code Here

        this.keepParent = options.contains(KEEP_PARENT);
        this.keepChild = options.contains(KEEP_CHILD);
       
        List<HKeySegment> childHKeySegments = childType.hKey().segments();
        HKeySegment lastChildHKeySegment = childHKeySegments.get(childHKeySegments.size() - 1);
        RowDef childRowDef = lastChildHKeySegment.table().rowDef();
        this.childOrdinal = childRowDef.table().getOrdinal();
    }
View Full Code Here

    @Test
    public void testSimple() throws Exception {
        AkibanInformationSchema ais = ais(
          "CREATE TABLE t(id INT PRIMARY KEY NOT NULL, s VARCHAR(128), d DOUBLE)");
        Group g = ais.getGroup(new TableName(SCHEMA, "t"));
        RowDef tRowDef = g.getRoot().rowDef();
        ProtobufRowDataConverter converter = converter(g);
        encodeDecode(ais, converter, tRowDef,
                     1L, "Fred", 3.14);
    }
View Full Code Here

        AkibanInformationSchema ais = ais(
          "CREATE TABLE c(cid INT PRIMARY KEY NOT NULL, name VARCHAR(128));" +
          "CREATE TABLE o(oid INT PRIMARY KEY NOT NULL, cid INT, GROUPING FOREIGN KEY(cid) REFERENCES c(cid));" +
          "CREATE TABLE i(iid INT PRIMARY KEY NOT NULL, oid INT, GROUPING FOREIGN KEY(oid) REFERENCES o(oid), sku VARCHAR(16));");
        Group coi = ais.getGroup(new TableName(SCHEMA, "c"));
        RowDef cRowDef = ais.getTable(new TableName(SCHEMA, "c")).rowDef();
        RowDef oRowDef = ais.getTable(new TableName(SCHEMA, "o")).rowDef();
        RowDef iRowDef = ais.getTable(new TableName(SCHEMA, "i")).rowDef();
        ProtobufRowDataConverter converter = converter(coi);
        encodeDecode(ais, converter, cRowDef,
                     1L, "Fred");
        encodeDecode(ais, converter, oRowDef,
                     101L, 1L);
View Full Code Here

    @Test
    public void testDecimal() throws Exception {
        AkibanInformationSchema ais = ais(
          "CREATE TABLE t(id INT PRIMARY KEY NOT NULL, n1 DECIMAL(6,2), n2 DECIMAL(20,10))");
        Group g = ais.getGroup(new TableName(SCHEMA, "t"));
        RowDef tRowDef = g.getRoot().rowDef();
        ProtobufRowDataConverter converter = converter(g);
        encodeDecode(ais, converter, tRowDef,
                     1L, new BigDecimal("3.14"), new BigDecimal("1234567890.0987654321"));
    }
View Full Code Here

    @Test
    public void testNulls() throws Exception {
        AkibanInformationSchema ais = ais(
          "CREATE TABLE t(id INT PRIMARY KEY NOT NULL, s VARCHAR(128) DEFAULT 'abc')");
        Group g = ais.getGroup(new TableName(SCHEMA, "t"));
        RowDef tRowDef = g.getRoot().rowDef();
        ProtobufRowDataConverter converter = converter(g);
        encodeDecode(ais, converter, tRowDef,
                     1L, "Barney");
        encodeDecode(ais, converter, tRowDef,
                     2L, null);
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.