Switch SQL RULES and SQL TABLE order

This commit is contained in:
Tobie Morgan Hitchcock 2016-09-19 11:12:08 +01:00
parent ab30c6b85e
commit 3089b6460f
4 changed files with 13 additions and 13 deletions

View file

@ -158,16 +158,16 @@ func execute(ctx *fibre.Context, ast *sql.Query, chn chan<- interface{}) {
case *sql.RecordStatement: case *sql.RecordStatement:
res, err = executeRecordStatement(txn, stm) res, err = executeRecordStatement(txn, stm)
case *sql.DefineRulesStatement:
res, err = executeDefineRulesStatement(txn, stm)
case *sql.RemoveRulesStatement:
res, err = executeRemoveRulesStatement(txn, stm)
case *sql.DefineTableStatement: case *sql.DefineTableStatement:
res, err = executeDefineTableStatement(txn, stm) res, err = executeDefineTableStatement(txn, stm)
case *sql.RemoveTableStatement: case *sql.RemoveTableStatement:
res, err = executeRemoveTableStatement(txn, stm) res, err = executeRemoveTableStatement(txn, stm)
case *sql.DefineRulesStatement:
res, err = executeDefineRulesStatement(txn, stm)
case *sql.RemoveRulesStatement:
res, err = executeRemoveRulesStatement(txn, stm)
case *sql.DefineFieldStatement: case *sql.DefineFieldStatement:
res, err = executeDefineFieldStatement(txn, stm) res, err = executeDefineFieldStatement(txn, stm)
case *sql.RemoveFieldStatement: case *sql.RemoveFieldStatement:

View file

@ -17,13 +17,13 @@ package sql
func (p *parser) parseDefineStatement(explain bool) (Statement, error) { func (p *parser) parseDefineStatement(explain bool) (Statement, error) {
// Inspect the next token. // Inspect the next token.
tok, _, err := p.shouldBe(RULES, TABLE, FIELD, INDEX) tok, _, err := p.shouldBe(TABLE, RULES, FIELD, INDEX)
switch tok { switch tok {
case RULES:
return p.parseDefineRulesStatement(explain)
case TABLE: case TABLE:
return p.parseDefineTableStatement(explain) return p.parseDefineTableStatement(explain)
case RULES:
return p.parseDefineRulesStatement(explain)
case FIELD: case FIELD:
return p.parseDefineFieldStatement(explain) return p.parseDefineFieldStatement(explain)
case INDEX: case INDEX:

View file

@ -17,13 +17,13 @@ package sql
func (p *parser) parseRemoveStatement(explain bool) (Statement, error) { func (p *parser) parseRemoveStatement(explain bool) (Statement, error) {
// Inspect the next token. // Inspect the next token.
tok, _, err := p.shouldBe(RULES, TABLE, FIELD, INDEX) tok, _, err := p.shouldBe(TABLE, RULES, FIELD, INDEX)
switch tok { switch tok {
case RULES:
return p.parseRemoveRulesStatement(explain)
case TABLE: case TABLE:
return p.parseRemoveTableStatement(explain) return p.parseRemoveTableStatement(explain)
case RULES:
return p.parseRemoveRulesStatement(explain)
case FIELD: case FIELD:
return p.parseRemoveFieldStatement(explain) return p.parseRemoveFieldStatement(explain)
case INDEX: case INDEX:

View file

@ -1313,7 +1313,7 @@ func Test_Parse_Queries_Define(t *testing.T) {
var tests = []tester{ var tests = []tester{
{ {
sql: `DEFINE`, 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{ var tests = []tester{
{ {
sql: `REMOVE`, sql: `REMOVE`,
err: "Found `` but expected `RULES, TABLE, FIELD, INDEX`", err: "Found `` but expected `TABLE, RULES, FIELD, INDEX`",
}, },
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
{ {