diff --git a/db/db.go b/db/db.go index e0d0f43c..3acd413a 100644 --- a/db/db.go +++ b/db/db.go @@ -158,16 +158,16 @@ func execute(ctx *fibre.Context, ast *sql.Query, chn chan<- interface{}) { case *sql.RecordStatement: res, err = executeRecordStatement(txn, stm) - case *sql.DefineRulesStatement: - res, err = executeDefineRulesStatement(txn, stm) - case *sql.RemoveRulesStatement: - res, err = executeRemoveRulesStatement(txn, stm) - case *sql.DefineTableStatement: res, err = executeDefineTableStatement(txn, stm) case *sql.RemoveTableStatement: res, err = executeRemoveTableStatement(txn, stm) + case *sql.DefineRulesStatement: + res, err = executeDefineRulesStatement(txn, stm) + case *sql.RemoveRulesStatement: + res, err = executeRemoveRulesStatement(txn, stm) + case *sql.DefineFieldStatement: res, err = executeDefineFieldStatement(txn, stm) case *sql.RemoveFieldStatement: diff --git a/sql/define.go b/sql/define.go index edf8e15a..c4c489d6 100644 --- a/sql/define.go +++ b/sql/define.go @@ -17,13 +17,13 @@ package sql func (p *parser) parseDefineStatement(explain bool) (Statement, error) { // Inspect the next token. - tok, _, err := p.shouldBe(RULES, TABLE, FIELD, INDEX) + tok, _, err := p.shouldBe(TABLE, RULES, FIELD, INDEX) switch tok { - case RULES: - return p.parseDefineRulesStatement(explain) case TABLE: return p.parseDefineTableStatement(explain) + case RULES: + return p.parseDefineRulesStatement(explain) case FIELD: return p.parseDefineFieldStatement(explain) case INDEX: diff --git a/sql/remove.go b/sql/remove.go index 56a5273f..4e6aa472 100644 --- a/sql/remove.go +++ b/sql/remove.go @@ -17,13 +17,13 @@ package sql func (p *parser) parseRemoveStatement(explain bool) (Statement, error) { // Inspect the next token. - tok, _, err := p.shouldBe(RULES, TABLE, FIELD, INDEX) + tok, _, err := p.shouldBe(TABLE, RULES, FIELD, INDEX) switch tok { - case RULES: - return p.parseRemoveRulesStatement(explain) case TABLE: return p.parseRemoveTableStatement(explain) + case RULES: + return p.parseRemoveRulesStatement(explain) case FIELD: return p.parseRemoveFieldStatement(explain) case INDEX: diff --git a/sql/sql_test.go b/sql/sql_test.go index 1dbb9d9a..53331a04 100644 --- a/sql/sql_test.go +++ b/sql/sql_test.go @@ -1313,7 +1313,7 @@ func Test_Parse_Queries_Define(t *testing.T) { var tests = []tester{ { sql: `DEFINE`, - err: "Found `` but expected `RULES, TABLE, FIELD, INDEX`", + err: "Found `` but expected `TABLE, RULES, FIELD, INDEX`", }, // ---------------------------------------------------------------------- { @@ -1853,7 +1853,7 @@ func Test_Parse_Queries_Remove(t *testing.T) { var tests = []tester{ { sql: `REMOVE`, - err: "Found `` but expected `RULES, TABLE, FIELD, INDEX`", + err: "Found `` but expected `TABLE, RULES, FIELD, INDEX`", }, // ---------------------------------------------------------------------- {