Package com.nearinfinity.honeycomb.mysql

Examples of com.nearinfinity.honeycomb.mysql.Row.serialize()


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

    /*
    DROP TABLE if exists t1;
    CREATE TABLE t1(c1 BIGINT SIGNED NULL,c2 BIGINT SIGNED NULL , INDEX(c1, c2));
View Full Code Here


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

        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());
View Full Code Here

    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()));
    }


    /**
     * Provides the {@link com.nearinfinity.honeycomb.mysql.schema.TableSchema} to use for a test case
View Full Code Here

        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

        final Map<String, ByteBuffer> map = Maps.newHashMap();
        map.put(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE));
        map.put(TestConstants.COLUMN2, ITUtils.encodeValue(6));

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

        final QueryKey key = ITUtils.createKey(INDEX_COL_VALUE, QueryType.EXACT_KEY);
        proxy.startIndexScan(key.serialize());
View Full Code Here

        final Map<String, ByteBuffer> map = Maps.newHashMap();
        map.put(TestConstants.COLUMN1, ITUtils.encodeValue(INDEX_COL_VALUE));
        map.put(TestConstants.COLUMN2, ITUtils.encodeValue(6));

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

        final QueryKey key = ITUtils.createKey(INDEX_COL_VALUE, QueryType.EXACT_KEY);
        proxy.startIndexScan(key.serialize());
        final Row r = Row.deserialize(proxy.getNextRow());
View Full Code Here

        proxy.startIndexScan(key.serialize());
        final Row r = Row.deserialize(proxy.getNextRow());

        map.put(TestConstants.COLUMN1, ITUtils.encodeValue(3));
        final Row newRow = new Row(map, r.getUUID());
        proxy.updateRow(r.serialize(), newRow.serialize());
        proxy.flush();

        final byte[] result = proxy.getRow(Util.UUIDToBytes(r.getUUID()));

        assertThat(Row.deserialize(result), equalTo(newRow));
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.