Skip to content

Commit 3d220fb

Browse files
authored
chore: Update obsolete connection features (#36)
The internal connection implementation is updated: * The type no longer implements the deprecated Queryer and Execer interfaces. This was originally necessary due to a Go bug, but it was fixed as of Go 1.10. * The error messages about not supporting parameterized queries are updated to blame this driver, because Athena does now supports them.
1 parent 30af7ce commit 3d220fb

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

conn.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type conn struct {
2121

2222
func (c *conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
2323
if len(args) > 0 {
24-
panic("Athena doesn't support prepared statements. Format your own arguments.")
24+
panic("The go-athena driver doesn't support prepared statements yet. Format your own arguments.")
2525
}
2626

2727
rows, err := c.runQuery(ctx, query)
@@ -30,7 +30,7 @@ func (c *conn) QueryContext(ctx context.Context, query string, args []driver.Nam
3030

3131
func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
3232
if len(args) > 0 {
33-
panic("Athena doesn't support prepared statements. Format your own arguments.")
33+
panic("The go-athena driver doesn't support prepared statements yet. Format your own arguments.")
3434
}
3535

3636
_, err := c.runQuery(ctx, query)
@@ -122,17 +122,3 @@ func (c *conn) Close() error {
122122

123123
var _ driver.QueryerContext = (*conn)(nil)
124124
var _ driver.ExecerContext = (*conn)(nil)
125-
126-
// HACK(tejasmanohar): database/sql calls Prepare() if your driver doesn't implement
127-
// Queryer. Regardless, db.Query/Exec* calls Query/Exec-Context so I've filed a bug--
128-
// https://github.com/golang/go/issues/22980.
129-
func (c *conn) Query(query string, args []driver.Value) (driver.Rows, error) {
130-
panic("Query() is noop")
131-
}
132-
133-
func (c *conn) Exec(query string, args []driver.Value) (driver.Result, error) {
134-
panic("Exec() is noop")
135-
}
136-
137-
var _ driver.Queryer = (*conn)(nil)
138-
var _ driver.Execer = (*conn)(nil)

0 commit comments

Comments
 (0)