diff --git a/error_test.go b/error_test.go index 0ff14c1..fc6353d 100644 --- a/error_test.go +++ b/error_test.go @@ -43,7 +43,10 @@ func TestCorruptDbErrors(t *testing.T) { _, err = db.Exec("drop table foo") } - sqliteErr := err.(Error) + sqliteErr, ok := err.(Error) + if !ok { + t.Fatal(err) + } if sqliteErr.Code != ErrNotADB { t.Error("wrong error code for corrupted DB") } diff --git a/sqlite3.go b/sqlite3.go index a967cab..c0e4f5c 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -1568,9 +1568,11 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { } } - // Preform Authentication - if err := conn.Authenticate(authUser, authPass); err != nil { - return nil, err + if conn.AuthEnabled() { + // Preform Authentication + if err := conn.Authenticate(authUser, authPass); err != nil { + return nil, err + } } // Register: authenticate diff --git a/sqlite3_opt_userauth.go b/sqlite3_opt_userauth.go index a565c46..30c0965 100644 --- a/sqlite3_opt_userauth.go +++ b/sqlite3_opt_userauth.go @@ -161,7 +161,7 @@ func (c *SQLiteConn) AuthEnabled() (exists bool) { // 0 - Disabled // 1 - Enabled func (c *SQLiteConn) authEnabled() int { - return 1 + return 0 } // EOF