/** * Start building a new DROP KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be dropped. * @return an in-construction DROP KEYSPACE statement. */ public static DropKeyspace dropKeyspace(String keyspaceName) { return new DropKeyspace(keyspaceName); }
protected void clearKeyspace() { // Drop keyspace with non-keyspace-session Statement stmt = SchemaBuilder.dropKeyspace(this.keyspace).ifExists(); LOG.debug("Drop keyspace: {}", stmt); Session session = this.cluster().connect(); try { session.execute(stmt); } finally { if (!session.isClosed()) { session.close(); } } }
public DropKeyspace(String keyspaceName) { this.keyspaceName = keyspaceName; this.ifExists = false; validateNotEmpty(keyspaceName, "Keyspace name"); validateNotKeyWord( keyspaceName, String.format( "The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); }
public DropKeyspace(String keyspaceName) { this.keyspaceName = keyspaceName; this.ifExists = false; validateNotEmpty(keyspaceName, "Keyspace name"); validateNotKeyWord(keyspaceName, String.format("The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); }
@Test(groups = "unit") public void should_drop_keyspace_if_exists() throws Exception { // When SchemaStatement statement = dropKeyspace("test").ifExists(); // Then assertThat(statement.getQueryString()).isEqualTo("DROP KEYSPACE IF EXISTS test"); } }
/** * Start building a new DROP KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be dropped. * @return an in-construction DROP KEYSPACE statement. */ public static DropKeyspace dropKeyspace(String keyspaceName) { return new DropKeyspace(keyspaceName); }
public DropKeyspace(String keyspaceName) { this.keyspaceName = keyspaceName; this.ifExists = false; validateNotEmpty(keyspaceName, "Keyspace name"); validateNotKeyWord(keyspaceName, String.format("The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); }
@Override public void deleteAll() throws Exception { state.tableExistsCache.clear(); state.preparedRangeReadsPerTable.clear(); state.preparedRowReadPerTable.clear(); state.preparedWritesPerTable.clear(); session.execute(SchemaBuilder.dropKeyspace(gwNamespace).ifExists()); }
/** * Start building a new DROP KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be dropped. * @return an in-construction DROP KEYSPACE statement. */ public static DropKeyspace dropKeyspace(String keyspaceName) { return new DropKeyspace(keyspaceName); }
public DropKeyspace(String keyspaceName) { this.keyspaceName = keyspaceName; this.ifExists = false; validateNotEmpty(keyspaceName, "Keyspace name"); validateNotKeyWord(keyspaceName, String.format("The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); }
protected void clearKeyspace() { // Drop keyspace with non-keyspace-session Statement stmt = SchemaBuilder.dropKeyspace(this.keyspace).ifExists(); LOG.debug("Drop keyspace: {}", stmt); Session session = this.cluster().connect(); try { session.execute(stmt); } finally { if (!session.isClosed()) { session.close(); } } }
/** * Start building a new DROP KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be dropped. * @return an in-construction DROP KEYSPACE statement. */ public static DropKeyspace dropKeyspace(String keyspaceName) { return new DropKeyspace(keyspaceName); }
@Test(groups = "unit") public void should_drop_keyspace_if_exists() throws Exception { // When SchemaStatement statement = dropKeyspace("test").ifExists(); // Then assertThat(statement.getQueryString()).isEqualTo("DROP KEYSPACE IF EXISTS test"); } }