feat: SQL 语法支持 BETWEEN AND、DROP TABLE IF EXISTS
This commit is contained in:
@@ -103,6 +103,8 @@ export interface CreateTableStatement {
|
||||
export interface DropTableStatement {
|
||||
type: 'DROP_TABLE';
|
||||
name: string;
|
||||
/** IF EXISTS — 表不存在时不报错 */
|
||||
ifExists?: boolean;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -234,6 +234,10 @@ export class QueryExecutor {
|
||||
}
|
||||
|
||||
private async executeDropTable(stmt: DropTableStatement): Promise<void> {
|
||||
if (stmt.ifExists) {
|
||||
const exists = await this.engine.hasTable(stmt.name);
|
||||
if (!exists) return; // IF EXISTS: 表不存在时静默返回
|
||||
}
|
||||
return this.engine.dropTable(stmt.name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user