From a8d17a91a7468bd1ef649784d6e7c8e43717e606 Mon Sep 17 00:00:00 2001 From: Jrohy Date: Wed, 24 Feb 2021 09:01:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/tools.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/tools.go b/core/tools.go index c1efb005..ca20f8ce 100644 --- a/core/tools.go +++ b/core/tools.go @@ -55,10 +55,11 @@ ADD COLUMN expiryDate char(10) DEFAULT ''; return err } } - result := db.QueryRow(fmt.Sprintf( + var tableName string + error = db.QueryRow(fmt.Sprintf( "SELECT * FROM information_schema.TABLES WHERE TABLE_NAME = 'users' AND TABLE_SCHEMA = '%s' ", - mysql.Database) + " AND TABLE_COLLATION LIKE 'utf8%';") - if result.Err() == sql.ErrNoRows { + mysql.Database) + " AND TABLE_COLLATION LIKE 'utf8%';").Scan(&tableName) + if error == sql.ErrNoRows { tempFile := "temp.sql" mysql.DumpSql(tempFile) mysql.ExecSql(tempFile)