use of io.crate.sql.tree.DropBlobTable in project crate by crate.
the class DropBlobTableAnalyzerTest method testDeletingNoExistingTableSetsNoopIfIgnoreNonExistentTablesIsSet.
@Test
public void testDeletingNoExistingTableSetsNoopIfIgnoreNonExistentTablesIsSet() throws Exception {
when(schemas.getTableInfo(tableIdent)).thenThrow(new TableUnknownException(tableIdent));
DropBlobTableAnalyzedStatement statement = analyzer.analyze(new DropBlobTable(table, true));
assertThat(statement.noop(), is(true));
}
use of io.crate.sql.tree.DropBlobTable in project crate by crate.
the class DropBlobTableAnalyzerTest method testDeletingNonExistingTableRaisesException.
@Test
public void testDeletingNonExistingTableRaisesException() throws Exception {
when(schemas.getTableInfo(tableIdent)).thenThrow(new TableUnknownException(tableIdent));
expectedException.expect(TableUnknownException.class);
expectedException.expectMessage("Table 'blob.Irrelevant' unknown");
analyzer.analyze(new DropBlobTable(table, false));
}
use of io.crate.sql.tree.DropBlobTable in project crate by crate.
the class TestStatementBuilder method printStatement.
private static void printStatement(String sql) {
println(sql.trim());
println("");
Statement statement = SqlParser.createStatement(sql);
println(statement.toString());
println("");
// TODO: support formatting all statement types
if (statement instanceof Query || statement instanceof CreateTable || statement instanceof CopyFrom || statement instanceof SwapTable || statement instanceof GCDanglingArtifacts || statement instanceof CreateFunction || statement instanceof CreateUser || statement instanceof GrantPrivilege || statement instanceof DenyPrivilege || statement instanceof RevokePrivilege || statement instanceof DropUser || statement instanceof DropAnalyzer || statement instanceof DropFunction || statement instanceof DropTable || statement instanceof DropBlobTable || statement instanceof DropView || statement instanceof DropRepository || statement instanceof DropSnapshot || statement instanceof Update || statement instanceof Insert || statement instanceof SetSessionAuthorizationStatement || statement instanceof Window) {
println(SqlFormatter.formatSql(statement));
println("");
assertFormattedSql(statement);
}
println("=".repeat(60));
println("");
}
Aggregations