Passthrough all parameters directly to pgx

pull/816/head
Jack Christensen 2020-07-18 08:44:57 -05:00
parent 42cbd0fa46
commit 4ebf1d2e0b
2 changed files with 14 additions and 0 deletions

View File

@ -373,6 +373,11 @@ func (c *Conn) Ping(ctx context.Context) error {
return c.conn.Ping(ctx)
}
func (c *Conn) CheckNamedValue(*driver.NamedValue) error {
// Underlying pgx supports sql.Scanner and driver.Valuer interfaces natively. So everything can be passed through directly.
return nil
}
type Stmt struct {
sd *pgconn.StatementDescription
conn *Conn

View File

@ -321,6 +321,15 @@ func TestConnQueryFailure(t *testing.T) {
})
}
func TestConnSimpleSlicePassThrough(t *testing.T) {
testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, db *sql.DB) {
var n int64
err := db.QueryRow("select cardinality($1::text[])", []string{"a", "b", "c"}).Scan(&n)
require.NoError(t, err)
assert.EqualValues(t, 3, n)
})
}
// Test type that pgx would handle natively in binary, but since it is not a
// database/sql native type should be passed through as a string
func TestConnQueryRowPgxBinary(t *testing.T) {