@Test public void testDelete() throws Exception { insertRow(); final Status status = client.delete(TABLE, DEFAULT_ROW_KEY); assertThat(status, is(Status.OK)); final Select selectStmt = QueryBuilder.select("field0", "field1") .from(TABLE) .where(QueryBuilder.eq(CassandraCQLClient.YCSB_KEY, DEFAULT_ROW_KEY)) .limit(1); final ResultSet rs = session.execute(selectStmt); final Row row = rs.one(); assertThat(row, nullValue()); }
@Override public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; }
CassandraCQLClient extends DB { @Override public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; } }
CassandraCQLClient extends DB { @Override public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; }  }
CassandraCQLClient extends DB { @Override public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; }  @Override void init(); @Override void cleanup(); @Override Status read(String table, String key, Set<String> fields,
      Map<String, ByteIterator> result); @Override Status scan(String table, String startkey, int recordcount,
      Set<String> fields, Vector<HashMap<String, ByteIterator>> result); @Override Status update(String table, String key, Map<String, ByteIterator> values); @Override Status insert(String table, String key, Map<String, ByteIterator> values); @Override Status delete(String table, String key); }
CassandraCQLClient extends DB { @Override public Status delete(String table, String key) { try { PreparedStatement stmt = deleteStmt.get(); if (stmt == null) { stmt = session.prepare(QueryBuilder.delete().from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker()))); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = deleteStmt.getAndSet(stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); session.execute(stmt.bind(key)); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error deleting key: {}", key).getMessage(), e); } return Status.ERROR; }  @Override void init(); @Override void cleanup(); @Override Status read(String table, String key, Set<String> fields,
      Map<String, ByteIterator> result); @Override Status scan(String table, String startkey, int recordcount,
      Set<String> fields, Vector<HashMap<String, ByteIterator>> result); @Override Status update(String table, String key, Map<String, ByteIterator> values); @Override Status insert(String table, String key, Map<String, ByteIterator> values); @Override Status delete(String table, String key); static final String YCSB_KEY; static final String KEYSPACE_PROPERTY; static final String KEYSPACE_PROPERTY_DEFAULT; static final String USERNAME_PROPERTY; static final String PASSWORD_PROPERTY; static final String HOSTS_PROPERTY; static final String PORT_PROPERTY; static final String PORT_PROPERTY_DEFAULT; static final String READ_CONSISTENCY_LEVEL_PROPERTY; static final String READ_CONSISTENCY_LEVEL_PROPERTY_DEFAULT; static final String WRITE_CONSISTENCY_LEVEL_PROPERTY; static final String WRITE_CONSISTENCY_LEVEL_PROPERTY_DEFAULT; static final String MAX_CONNECTIONS_PROPERTY; static final String CORE_CONNECTIONS_PROPERTY; static final String CONNECT_TIMEOUT_MILLIS_PROPERTY; static final String READ_TIMEOUT_MILLIS_PROPERTY; static final String TRACING_PROPERTY; static final String TRACING_PROPERTY_DEFAULT; static final String USE_SSL_CONNECTION; }