Skip to content

Commit

Permalink
rename to bind parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zhengda committed Sep 22, 2023
1 parent 8b9c5ee commit 4f1b611
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions sqllexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
DOLLAR_QUOTED_FUNCTION // dollar quoted function
DOLLAR_QUOTED_STRING // dollar quoted string
POSITIONAL_PARAMETER // numbered parameter
BINDED_PARAMETER // binded parameter
BIND_PARAMETER // bind parameter
UNKNOWN // unknown token
)

Expand Down Expand Up @@ -130,12 +130,12 @@ func (s *Lexer) Scan() Token {
return s.scanDollarQuotedString()
case ch == ':':
if s.config.DBMS == DBMSOracle && isLetter(s.lookAhead(1)) {
return s.scanBindedParameter()
return s.scanBindParameter()
}
return s.scanOperator()
case ch == '@':
if s.config.DBMS == DBMSSQLServer && isLetter(s.lookAhead(1)) {
return s.scanBindedParameter()
return s.scanBindParameter()
}
return s.scanOperator()
case isOperator(ch):
Expand Down Expand Up @@ -416,7 +416,7 @@ func (s *Lexer) scanPositionalParameter() Token {
return Token{POSITIONAL_PARAMETER, s.src[s.start:s.cursor]}
}

func (s *Lexer) scanBindedParameter() Token {
func (s *Lexer) scanBindParameter() Token {
s.start = s.cursor
ch := s.nextBy(2) // consume the (colon|at sign) and the char
for {
Expand All @@ -425,7 +425,7 @@ func (s *Lexer) scanBindedParameter() Token {
}
ch = s.next()
}
return Token{BINDED_PARAMETER, s.src[s.start:s.cursor]}
return Token{BIND_PARAMETER, s.src[s.start:s.cursor]}
}

func (s *Lexer) scanUnknown() Token {
Expand Down
8 changes: 4 additions & 4 deletions sqllexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func TestLexer(t *testing.T) {
},
},
{
name: "select with binded parameter",
name: "select with bind parameter",
input: "SELECT * FROM users where id = :id",
expected: []Token{
{IDENT, "SELECT"},
Expand All @@ -488,12 +488,12 @@ func TestLexer(t *testing.T) {
{WS, " "},
{OPERATOR, "="},
{WS, " "},
{BINDED_PARAMETER, ":id"},
{BIND_PARAMETER, ":id"},
},
lexerOpts: []lexerOption{WithDBMS(DBMSOracle)},
},
{
name: "select with binded parameter",
name: "select with bind parameter",
input: "SELECT * FROM users where id = @id",
expected: []Token{
{IDENT, "SELECT"},
Expand All @@ -510,7 +510,7 @@ func TestLexer(t *testing.T) {
{WS, " "},
{OPERATOR, "="},
{WS, " "},
{BINDED_PARAMETER, "@id"},
{BIND_PARAMETER, "@id"},
},
lexerOpts: []lexerOption{WithDBMS(DBMSSQLServer)},
},
Expand Down

0 comments on commit 4f1b611

Please sign in to comment.