From 335f09749bcbb05e9e1935ab57dfd03cc222c3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=88r=20Karlsson?= Date: Sun, 2 Aug 2015 01:35:22 +0200 Subject: [PATCH] Fixed a bug when using sqlite --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 4c5cad11..fa68e52b 100644 --- a/main.go +++ b/main.go @@ -60,10 +60,6 @@ func Open(dialect string, args ...interface{}) (DB, error) { } dbSql, err = sql.Open(driver, source) - if err == nil { - err = db.DB().Ping() // Send a ping to make sure the database connection is alive. - } - case sqlCommon: source = reflect.Indirect(reflect.ValueOf(value)).FieldByName("dsn").String() dbSql = value @@ -80,6 +76,10 @@ func Open(dialect string, args ...interface{}) (DB, error) { db.parent = &db } + if err == nil { + err = db.DB().Ping() // Send a ping to make sure the database connection is alive. + } + return db, err }