mirror of https://github.com/go-gorm/gorm.git
Fix panic with raw SQL
This commit is contained in:
parent
a12c2a2e13
commit
6ed508ec6a
2
scope.go
2
scope.go
|
@ -650,7 +650,7 @@ func (scope *Scope) buildCondition(clause map[string]interface{}, include bool)
|
||||||
buff := bytes.NewBuffer([]byte{})
|
buff := bytes.NewBuffer([]byte{})
|
||||||
i := 0
|
i := 0
|
||||||
for _, s := range str {
|
for _, s := range str {
|
||||||
if s == '?' {
|
if s == '?' && len(replacements) > i {
|
||||||
buff.WriteString(replacements[i])
|
buff.WriteString(replacements[i])
|
||||||
i++
|
i++
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue