From a12c2a2e13b0f644647dbd369a88b01fac109bd5 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 27 Feb 2018 10:48:59 +0800 Subject: [PATCH 1/2] Remove mysql8 from CI --- wercker.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/wercker.yml b/wercker.yml index 2f2370b3..0c3e73ef 100644 --- a/wercker.yml +++ b/wercker.yml @@ -9,13 +9,6 @@ services: MYSQL_USER: gorm MYSQL_PASSWORD: gorm MYSQL_RANDOM_ROOT_PASSWORD: "yes" - - name: mysql - id: mysql:8 - env: - MYSQL_DATABASE: gorm - MYSQL_USER: gorm - MYSQL_PASSWORD: gorm - MYSQL_RANDOM_ROOT_PASSWORD: "yes" - name: mysql57 id: mysql:5.7 env: @@ -109,11 +102,6 @@ build: code: | GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(mariadb:3306)/gorm?charset=utf8&parseTime=True" go test ./... - - script: - name: test mysql - code: | - GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(mysql:3306)/gorm?charset=utf8&parseTime=True" go test ./... - - script: name: test mysql5.7 code: | From 6ed508ec6a4ecb3531899a69cbc746ccf65a4166 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 28 Feb 2018 07:43:56 +0800 Subject: [PATCH 2/2] Fix panic with raw SQL --- scope.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.go b/scope.go index 25077efc..150ac710 100644 --- a/scope.go +++ b/scope.go @@ -650,7 +650,7 @@ func (scope *Scope) buildCondition(clause map[string]interface{}, include bool) buff := bytes.NewBuffer([]byte{}) i := 0 for _, s := range str { - if s == '?' { + if s == '?' && len(replacements) > i { buff.WriteString(replacements[i]) i++ } else {