From 099a4048ae94402df656f5628fa7002bf3c40e59 Mon Sep 17 00:00:00 2001 From: Gerhard Gruber Date: Wed, 8 Sep 2021 08:55:17 +0200 Subject: [PATCH] Fixed bind variable resolution --- expression_ext.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/expression_ext.go b/expression_ext.go index 27866c42..a0fb0021 100644 --- a/expression_ext.go +++ b/expression_ext.go @@ -457,7 +457,7 @@ func (db *DB) GetSQL() string { scope.prepareQuerySQL() - stmt := scope.SQL + stmt := strings.ReplaceAll(scope.SQL, "$$$", "?") for _, arg := range scope.SQLVars { stmt = strings.Replace(stmt, "?", "'"+escape(fmt.Sprintf("%v", arg))+"'", 1) } @@ -468,7 +468,7 @@ func (db *DB) GetSQL() string { func (db *DB) GetSQLWhereClause() string { scope := db.NewScope(db.Value) - stmt := scope.CombinedConditionSql() + stmt := strings.ReplaceAll(scope.CombinedConditionSql(), "$$$", "?") for _, arg := range scope.SQLVars { stmt = strings.Replace(stmt, "?", "'"+escape(fmt.Sprintf("%v", arg))+"'", 1)