From 6da2e371ca63cd15e7b06e3d380aa54fc55f0604 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 14 Oct 2016 07:54:26 +0100 Subject: [PATCH] Remove RECORD keyword --- sql/parser.go | 2 +- sql/rules.go | 8 ++++---- sql/sql_test.go | 8 ++++---- sql/token.go | 2 -- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sql/parser.go b/sql/parser.go index 2a4b6078..cf9448e4 100644 --- a/sql/parser.go +++ b/sql/parser.go @@ -115,7 +115,7 @@ func (p *parser) parseMulti() (*Query, error) { // parseSingle parses a single SQL SELECT statement. func (p *parser) parseSingle() (Statement, error) { - tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE) + tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE) switch tok { diff --git a/sql/rules.go b/sql/rules.go index d7c6e947..fdb7bf0e 100644 --- a/sql/rules.go +++ b/sql/rules.go @@ -36,7 +36,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er for { - tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD) + tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE) if !exi { break } @@ -50,7 +50,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er } if len(stmt.When) == 0 { - return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}} + return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}} } if tok, _, err := p.shouldBe(ACCEPT, REJECT, CUSTOM); err != nil { @@ -97,7 +97,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er for { - tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD) + tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE) if !exi { break } @@ -111,7 +111,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er } if len(stmt.When) == 0 { - return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}} + return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}} } if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil { diff --git a/sql/sql_test.go b/sql/sql_test.go index 24bc7e26..e512f7b9 100644 --- a/sql/sql_test.go +++ b/sql/sql_test.go @@ -140,11 +140,11 @@ func Test_Parse_Queries_Malformed(t *testing.T) { }, { sql: `!`, - err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`", + err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`", }, { sql: `SELECT * FROM person;;;`, - err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`", + err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`", }, } @@ -1338,7 +1338,7 @@ func Test_Parse_Queries_Define(t *testing.T) { }, { sql: `DEFINE RULES ON person FOR`, - err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`", + err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`", }, { sql: `DEFINE RULES ON person FOR select, create, update, delete`, @@ -1878,7 +1878,7 @@ func Test_Parse_Queries_Remove(t *testing.T) { }, { sql: `REMOVE RULES ON person FOR`, - err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`", + err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`", }, { sql: `REMOVE RULES ON person FOR select, create, update, delete`, diff --git a/sql/token.go b/sql/token.go index 2ec6e5e8..6d63bb87 100644 --- a/sql/token.go +++ b/sql/token.go @@ -160,7 +160,6 @@ const ( OR ORDER READONLY - RECORD REJECT RELATE REMOVE @@ -319,7 +318,6 @@ var tokens = [...]string{ OR: "OR", ORDER: "ORDER", READONLY: "READONLY", - RECORD: "RECORD", REJECT: "REJECT", RELATE: "RELATE", REMOVE: "REMOVE",