mirror of https://github.com/AMT-Cheif/drift.git
Only use the current analysis steps for CRUD statements
This commit is contained in:
parent
0bad842735
commit
3a2646e837
|
@ -2,7 +2,7 @@ part of '../ast.dart';
|
|||
|
||||
/// A "CREATE TABLE" statement, see https://www.sqlite.org/lang_createtable.html
|
||||
/// for the individual components.
|
||||
class CreateTableStatement extends Statement {
|
||||
class CreateTableStatement extends Statement with SchemaStatement {
|
||||
final bool ifNotExists;
|
||||
final String tableName;
|
||||
final List<ColumnDefinition> columns;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
part of '../ast.dart';
|
||||
|
||||
class DeleteStatement extends Statement {
|
||||
class DeleteStatement extends Statement with CrudStatement {
|
||||
final TableReference from;
|
||||
final Expression where;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
part of '../ast.dart';
|
||||
|
||||
class SelectStatement extends Statement with ResultSet {
|
||||
class SelectStatement extends Statement with CrudStatement, ResultSet {
|
||||
final bool distinct;
|
||||
final List<ResultColumn> columns;
|
||||
final List<Queryable> from;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
part of '../ast.dart';
|
||||
|
||||
abstract class Statement extends AstNode {}
|
||||
|
||||
/// Marker mixin for statements that read from an existing table structure.
|
||||
mixin CrudStatement on Statement {}
|
||||
|
||||
/// Marker mixin for statements that change the table structure.
|
||||
mixin SchemaStatement on Statement {}
|
||||
|
|
|
@ -16,7 +16,7 @@ const Map<TokenType, FailureMode> _tokensToMode = {
|
|||
TokenType.ignore: FailureMode.ignore,
|
||||
};
|
||||
|
||||
class UpdateStatement extends Statement {
|
||||
class UpdateStatement extends Statement with CrudStatement {
|
||||
final FailureMode or;
|
||||
final TableReference table;
|
||||
final List<SetComponent> set;
|
||||
|
|
|
@ -57,10 +57,13 @@ class SqlEngine {
|
|||
|
||||
try {
|
||||
ReferenceFinder(globalScope: scope).start(node);
|
||||
node
|
||||
..accept(ColumnResolver(context))
|
||||
..accept(ReferenceResolver(context))
|
||||
..accept(TypeResolvingVisitor(context));
|
||||
|
||||
if (node is CrudStatement) {
|
||||
node
|
||||
..accept(ColumnResolver(context))
|
||||
..accept(ReferenceResolver(context))
|
||||
..accept(TypeResolvingVisitor(context));
|
||||
}
|
||||
} catch (e) {
|
||||
// todo should we do now? AFAIK, everything that causes an exception
|
||||
// is added as an error contained in the context.
|
||||
|
|
Loading…
Reference in New Issue