mirror of https://github.com/go-gorm/gorm.git
Remove sql string's validation check
This commit is contained in:
parent
ddc1f9156a
commit
452123479e
|
@ -611,11 +611,6 @@ func TestSelect(t *testing.T) {
|
||||||
if user.Name != "3" {
|
if user.Name != "3" {
|
||||||
t.Errorf("Should got Name = 3 when searching with it, %+v", user.Id)
|
t.Errorf("Should got Name = 3 when searching with it, %+v", user.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
query := db.Where("name = ?", "3").Select("nam;e")
|
|
||||||
if query.Error == nil {
|
|
||||||
t.Errorf("Should got error with invalid select string")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderAndPluck(t *testing.T) {
|
func TestOrderAndPluck(t *testing.T) {
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package gorm
|
package gorm
|
||||||
|
|
||||||
import (
|
import "strconv"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
type search struct {
|
type search struct {
|
||||||
db *DB
|
db *DB
|
||||||
|
@ -140,9 +137,5 @@ func (s *search) getInterfaceAsSql(value interface{}) (str string) {
|
||||||
default:
|
default:
|
||||||
s.db.err(InvalidSql)
|
s.db.err(InvalidSql)
|
||||||
}
|
}
|
||||||
|
|
||||||
if regexp.MustCompile(";").MatchString(str) {
|
|
||||||
s.db.err(InvalidSql)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue