(sql string, pos int, keyword string)
| 333 | } |
| 334 | |
| 335 | func hasKeywordAt(sql string, pos int, keyword string) bool { |
| 336 | if pos < 0 || pos+len(keyword) > len(sql) { |
| 337 | return false |
| 338 | } |
| 339 | if !strings.EqualFold(sql[pos:pos+len(keyword)], keyword) { |
| 340 | return false |
| 341 | } |
| 342 | if pos > 0 && isIdentChar(sql[pos-1]) { |
| 343 | return false |
| 344 | } |
| 345 | end := pos + len(keyword) |
| 346 | return end == len(sql) || !isIdentChar(sql[end]) |
| 347 | } |
| 348 | |
| 349 | func isIdentChar(ch byte) bool { |
| 350 | return ch == '_' || |
no test coverage detected