Skip to content

Commit

Permalink
Only mark those SQL strings has as invalid SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Apr 29, 2014
1 parent 3264b82 commit a16a5fc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ func (s *search) getInterfaceAsSql(value interface{}) (str string) {
s.db.err(InvalidSql)
}

// Support field name with and without double quotes (useful when a field has a sql reserved word name)
if !regexp.MustCompile("^(\\s*\"[\\w\\s,.*\\+\\-()]*\"\\s*)$|^(\\s*\"?[\\w\\s,.*\\+\\-()]*\"?\\s*)$").MatchString(str) {
if regexp.MustCompile(";").MatchString(str) {
s.db.err(InvalidSql)
}
return
Expand Down

0 comments on commit a16a5fc

Please sign in to comment.