Skip to content

driver.ErrSkip is returned by methods that don't support itΒ #66

@bosouza

Description

@bosouza

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions