@Override public boolean hasValue() { return _oldColumn.hasValue(); } }
@Override public boolean hasValue() { return _oldColumn.hasValue(); } }
@Override public String getStringValue(C columnName, String defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getStringValue(); }
@Override public ByteBuffer getByteBufferValue(C columnName, ByteBuffer defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getByteBufferValue(); }
@Override public String getCompressedStringValue(C columnName, String defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getCompressedStringValue(); }
@Override public Double getDoubleValue(C columnName, Double defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getDoubleValue(); }
@Override public UUID getUUIDValue(C columnName, UUID defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getUUIDValue(); }
@Override public Long getLongValue(C columnName, Long defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getLongValue(); }
@Override public Date getDateValue(C columnName, Date defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getDateValue(); }
@Override public <T> T getValue(C columnName, Serializer<T> serializer, T defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getValue(serializer); }
@Override public Integer getIntegerValue(C columnName, Integer defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getIntegerValue(); }
@Override public byte[] getByteArrayValue(C columnName, byte[] defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getByteArrayValue(); }
@Override public Boolean getBooleanValue(C columnName, Boolean defaultValue) { Column<C> column = getColumnByName(columnName); if (column == null || !column.hasValue()) return defaultValue; return column.getBooleanValue(); }
if (foundColumn.hasValue() != nextColumn.hasValue()) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint"); if (foundColumn.hasValue() && !nextColumn.getByteBufferValue().equals((foundColumn.getByteBufferValue()))) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint");
if (foundColumn.hasValue() != nextColumn.hasValue()) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint"); if (foundColumn.hasValue() && !nextColumn.getByteBufferValue().equals((foundColumn.getByteBufferValue()))) { throw new NotUniqueException("The provided rows are not part of the same uniquness constraint");
private void performSimpleRowSingleColumnQueryForRow(String rowKey, boolean rowDeleted, String expectedChar) throws Exception { Column<String> col = keyspace.prepareQuery(CF_ACCOUNTS).getRow(rowKey).getColumn("user").execute().getResult(); if (rowDeleted) { Assert.assertNull(col); } else { Assert.assertTrue(col.hasValue()); Assert.assertEquals("user" + expectedChar, col.getStringValue()); } col = keyspace.prepareQuery(CF_ACCOUNTS).getRow(rowKey).getColumn("pswd").execute().getResult(); if (rowDeleted) { Assert.assertNull(col); } else { Assert.assertTrue(col.hasValue()); Assert.assertEquals("pswd" + expectedChar, col.getStringValue()); } }
private void testReadSingleRowSingleColumn(boolean rowDeleted) throws Exception { for (int year = 2001; year <= 2014; year++) { Column<Population> result = keyspace.prepareQuery(CF_POPULATION) .getRow(year) .getColumn(SanFrancisco.clone()) .execute().getResult(); if (rowDeleted) { Assert.assertNull(result); continue; } else { Assert.assertTrue(result.hasValue()); } Assert.assertEquals(SanFrancisco, result.getName()); } }
@Test public void testHasValue() throws Exception { MutationBatch m = keyspace.prepareMutationBatch(); m.withRow(CF_USER_INFO, "acct1234") .putColumn("firstname", "john", null) .putColumn("lastname", "smith", null) .putColumn("address", "555 Elm St", null) .putColumn("age", 30, null) .putEmptyColumn("empty"); m.execute(); ColumnList<String> response = keyspace.prepareQuery(CF_USER_INFO).getRow("acct1234").execute().getResult(); Assert.assertEquals("firstname", response.getColumnByName("firstname").getName()); Assert.assertEquals("firstname", response.getColumnByName("firstname").getName()); Assert.assertEquals("john", response.getColumnByName("firstname").getStringValue()); Assert.assertEquals("john", response.getColumnByName("firstname").getStringValue()); Assert.assertEquals(true, response.getColumnByName("firstname").hasValue()); Assert.assertEquals(false, response.getColumnByName("empty").hasValue()); }