Enable multiStatements for MySQL

This commit is contained in:
Gusted 2024-07-15 17:32:36 +02:00
parent 09c2ab9be8
commit 984d0127f1
No known key found for this signature in database
GPG key ID: FD821B732837125F
5 changed files with 17 additions and 8 deletions

View file

@ -12,6 +12,7 @@ import (
"path"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
@ -198,11 +199,13 @@ func deleteDB() error {
}
defer db.Close()
if _, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", setting.Database.Name)); err != nil {
databaseName := strings.SplitN(setting.Database.Name, "?", 2)[0]
if _, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", databaseName)); err != nil {
return err
}
if _, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", setting.Database.Name)); err != nil {
if _, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", databaseName)); err != nil {
return err
}
return nil