From 7fc6c9ef750394fa42c8ed0f18c4dc249822e1b9 Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Thu, 2 May 2024 09:14:34 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20//=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=83=D1=81=D1=82=D0=B8=D0=BC=20=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B7=D0=B0=D0=BA=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postgres_gorm/postgres_gorm.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/postgres_gorm/postgres_gorm.go b/postgres_gorm/postgres_gorm.go index c8872bda..4af0aa42 100644 --- a/postgres_gorm/postgres_gorm.go +++ b/postgres_gorm/postgres_gorm.go @@ -441,8 +441,8 @@ func RawMultipleSQL(db *gorm.DB, TextSQL string) *gorm.DB { } //запустим транзакцию - tx = tx.Begin() - defer tx.Commit() + tx0 := tx.Begin() + defer tx0.Commit() // TextSQL1 := "" @@ -453,7 +453,7 @@ func RawMultipleSQL(db *gorm.DB, TextSQL string) *gorm.DB { if pos1 > 0 { TextSQL1 = TextSQL[0:pos1] TextSQL2 = TextSQL[pos1:] - tx = tx.Exec(TextSQL1) + tx = tx0.Exec(TextSQL1) err = tx.Error if err != nil { TextError := fmt.Sprint("db.Exec() error: ", err, ", TextSQL: \n", TextSQL1) @@ -463,7 +463,7 @@ func RawMultipleSQL(db *gorm.DB, TextSQL string) *gorm.DB { } //запустим последний запрос, с возвратом результата - tx = tx.Raw(TextSQL2) + tx = tx0.Raw(TextSQL2) err = tx.Error if err != nil { TextError := fmt.Sprint("db.Raw() error: ", err, ", TextSQL: \n", TextSQL2)