-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hi, I'm trying to use this to wrap a driver that doesn't implement the context-aware methods from the sql package, but when I call db.Prepare I get driver.ErrSkip.
That's because sqldblogger.connection implements driver.ConnPrepareContext, while the underlying driver doesn't, which means that db.Prepare will call PrepareContext on sqldblogger.connection, which in turn will return driver.ErrSkip so sql.DB handles it (ceb475b). However, sql.DB doesn't handle it, as driver.ErrSkip is only supported in a couple methods
// ErrSkip may be returned by some optional interfaces' methods to
// indicate at runtime that the fast path is unavailable and the sql
// package should continue as if the optional interface was not
// implemented. ErrSkip is only supported where explicitly
// documented.
var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented")
A solution might be adding an option to use the context-less methods instead of returning driver.ErrSkip on methods that don't support driver.ErrSkip