Only mark those SQL strings has as invalid SQL

This commit is contained in:
Jinzhu 2014-04-29 15:51:49 +08:00
parent 3264b82368
commit a16a5fca58
1 changed files with 1 additions and 2 deletions

View File

@ -141,8 +141,7 @@ func (s *search) getInterfaceAsSql(value interface{}) (str string) {
s.db.err(InvalidSql) 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(";").MatchString(str) {
if !regexp.MustCompile("^(\\s*\"[\\w\\s,.*\\+\\-()]*\"\\s*)$|^(\\s*\"?[\\w\\s,.*\\+\\-()]*\"?\\s*)$").MatchString(str) {
s.db.err(InvalidSql) s.db.err(InvalidSql)
} }
return return