Package com.nearinfinity.honeycomb.mysql

Examples of com.nearinfinity.honeycomb.mysql.Row


            ByteBuffer nextValue = record.getValue().next();
            if (nextValue != null) {
                records.put(record.getKey(), nextValue);
            }
        }
        return new Row(records.build(), uuids.next());
    }
View Full Code Here


        }

        @Override
        public RowKey next() {
            IndexRowKeyBuilder builder;
            Row row = rows.next();
            builder = IndexRowKeyBuilder
                    .newBuilder(tableIds.next(), indexIds.next())
                    .withRow(row,
                            indexSchemas.next().getIndexName(),
                            tableSchema)
                    .withUUID(row.getUUID());

            return builder.withSortOrder(order.next()).build();
        }
View Full Code Here

    Expected failure
     */
    @Test
    public void testRowInsertNotExcludingFieldsFromIndexKey() {
        ITUtils.insertData(proxy, 1, 1);
        Row row = ITUtils.createRow(1);
        assertTrue(proxy.indexContainsDuplicate(TestConstants.INDEX1, row.serialize()));
    }
View Full Code Here

    @Test
    public void testInsertBuildsIndexCorrectlyOnNullColumns() {
        final Map<String, ByteBuffer> map = Maps.newHashMap();
        map.put(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE));

        final Row row = new Row(map, UUID.randomUUID());
        proxy.insertRow(row.serialize());
        proxy.flush();

        HashMap<String, ByteBuffer> keys = Maps.newHashMap();
        keys.put(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE));
        keys.put(TestConstants.COLUMN2, null);
View Full Code Here

     */
    @Test
    public void testUpdateNotChangingIndicesWhenUpdatedColumnNotInIndex() {
        Map<String, ByteBuffer> values = Maps.newHashMap();
        values.put(TestConstants.COLUMN2, ITUtils.encodeValue(1));
        Row row = new Row(values, UUID.randomUUID());
        proxy.insertRow(row.serialize());
        proxy.flush();

        proxy.startTableScan();
        byte[] nextRow = proxy.getNextRow();
        row = Row.deserialize(nextRow);
        proxy.endScan();
        row.getRecords().put(TestConstants.COLUMN2, ITUtils.encodeValue(2)); // update t1 set c2=2 where c1 is null
        proxy.updateRow(nextRow, row.serialize());

        Map<String, ByteBuffer> searchMap = Maps.newHashMap();
        searchMap.put(TestConstants.COLUMN1, null);
        QueryKey key = new QueryKey(TestConstants.INDEX1, QueryType.EXACT_KEY, searchMap);
        proxy.startIndexScan(key.serialize());
        Row result = Row.deserialize(proxy.getNextRow());
        assertEquals(result.getRecords().get(TestConstants.COLUMN2).getLong(), ITUtils.encodeValue(2).getLong());
        proxy.endScan();
    }
View Full Code Here

    @Test
    public void testNullsAreNotDuplicatesInUniqueIndex() {
        ITUtils.insertNullData(proxy, 1);
        Map<String, ByteBuffer> values = Maps.newHashMap();
        values.put(TestConstants.COLUMN2, ITUtils.encodeValue(1));
        Row row = new Row(values, UUID.randomUUID());
        assertFalse(proxy.indexContainsDuplicate(TestConstants.INDEX3, row.serialize()));
    }
View Full Code Here

        final Map<String, ByteBuffer> map = Maps.newHashMap();
        map.put(TestConstants.COLUMN1, encodeValue(keyColumnValue));

        for (int x = 0; x < rowCount; x++) {
            map.put(TestConstants.COLUMN2, encodeValue(x));
            final Row row = new Row(map, uuid);
            proxy.insertRow(row.serialize());
        }

        proxy.flush();
    }
View Full Code Here

        final Map<String, ByteBuffer> map = Maps.newHashMap();

        for (int x = 0; x < rowCount; x++) {
            map.put(columnName, encodeValue(x));
            final Row row = new Row(map, UUID.randomUUID());
            proxy.insertRow(row.serialize());
        }

        proxy.flush();
    }
View Full Code Here

    }

    public static Row createRow(final int columnValue) {
        final Map<String, ByteBuffer> map = Maps.newHashMap();
        map.put(TestConstants.COLUMN1, encodeValue(columnValue));
        return new Row(map, UUID.randomUUID());
    }
View Full Code Here

        // Add data rows to index
        ITUtils.insertData(proxy, ROW_COUNT, keyValue);

        // Verify that we can get a row from the index scan
        proxy.startIndexScan(key.serialize());
        final Row row = Row.deserialize(proxy.getNextRow());
        byte[] result = proxy.getRow(Util.UUIDToBytes(row.getUUID()));

        assertNotNull(row);
        assertEquals(Row.deserialize(result).getUUID(), row.getUUID());

        proxy.endScan();

        // Drop the index from the table
        proxy.dropIndex(TestConstants.INDEX1);

        // Verify that the data row is still available after the index has been removed
        result = proxy.getRow(Util.UUIDToBytes(row.getUUID()));
        assertEquals(Row.deserialize(result).getUUID(), row.getUUID());

        // Verify that the scan is unable to execute
        proxy.startIndexScan(key.serialize());
    }
View Full Code Here

TOP

Related Classes of com.nearinfinity.honeycomb.mysql.Row

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.