[jOOQ/jOOQ#2370] [jOOQ/jOOQ#8528] Interpret DROP TEMP TABLE

This commit is contained in:
Lukas Eder 2019-10-31 16:25:42 +01:00
parent faad3f34a3
commit 4e0fedd5a4
2 changed files with 11 additions and 3 deletions

View File

@ -531,6 +531,7 @@ final class DDLInterpreter {
private final void accept0(DropTableImpl query) {
Table<?> table = query.$table();
MutableSchema schema = getSchema(table.getSchema());
// TODO schema == null
@ -543,6 +544,8 @@ final class DDLInterpreter {
}
else if (!table(existing.type))
throw objectNotTable(table);
else if (query.$temporary() && existing.type != TableType.TEMPORARY)
throw objectNotTemporaryTable(table);
drop(schema.tables, existing, query.$cascade());
}
@ -756,6 +759,10 @@ final class DDLInterpreter {
return new DataDefinitionException("Object is not a table: " + table.getQualifiedName());
}
private static final DataDefinitionException objectNotTemporaryTable(Table<?> table) {
return new DataDefinitionException("Object is not a temporary table: " + table.getQualifiedName());
}
private static final DataDefinitionException objectNotView(Table<?> table) {
return new DataDefinitionException("Object is not a view: " + table.getQualifiedName());
}

View File

@ -106,9 +106,10 @@ final class DropTableImpl extends AbstractRowCountQuery implements
this.temporary = temporary;
}
final Table<?> $table() { return table; }
final boolean $ifExists() { return ifExists; }
final Cascade $cascade() { return cascade; }
final Table<?> $table() { return table; }
final boolean $temporary() { return temporary; }
final boolean $ifExists() { return ifExists; }
final Cascade $cascade() { return cascade; }
// ------------------------------------------------------------------------
// XXX: DSL API