From 73d9a67b1207475c4d5e79d045edb250d0dfd2a5 Mon Sep 17 00:00:00 2001 From: Jim Lambert Date: Fri, 14 Feb 2020 16:49:36 -0500 Subject: [PATCH] clean up: check error on scan and force compile check that oci8 implements the Dialect interface --- dialects/oci8/oci8.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dialects/oci8/oci8.go b/dialects/oci8/oci8.go index 4b61c186..29badf01 100644 --- a/dialects/oci8/oci8.go +++ b/dialects/oci8/oci8.go @@ -14,6 +14,8 @@ import ( const dialectName = "oci8" +var _ gorm.Dialect = (*oci8)(nil) + type oci8 struct { db gorm.SQLCommon gorm.DefaultForeignKeyNamer @@ -47,7 +49,9 @@ func (oci8) Quote(key string) string { func (s oci8) CurrentDatabase() string { var name string - s.db.QueryRow("SELECT ORA_DATABASE_NAME as \"Current Database\" FROM DUAL").Scan(&name) + if err := s.db.QueryRow("SELECT ORA_DATABASE_NAME as \"Current Database\" FROM DUAL").Scan(&name); err != nil { + return "" // just return "", since the Dialect interface doesn't support returning an error for this func + } return name }