forked from mirror/gorm
Only mark those SQL strings has as invalid SQL
This commit is contained in:
parent
3264b82368
commit
a16a5fca58
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue