mirror of https://github.com/jackc/pgx.git
Dirty hack to get a few more stdlib tests to pass
parent
ec0bae649a
commit
b638d52a4f
|
@ -242,8 +242,10 @@ func (c *Conn) QueryContext(ctx context.Context, query string, argsV []driver.Na
|
||||||
var rows pgx.Rows
|
var rows pgx.Rows
|
||||||
|
|
||||||
if !c.connConfig.PreferSimpleProtocol {
|
if !c.connConfig.PreferSimpleProtocol {
|
||||||
c.conn.Deallocate("stdlibtemp")
|
// TODO - remove hack that creates a new prepared statement for every query -- put in place because of problem preparing empty statement name
|
||||||
ps, err := c.conn.PrepareEx(ctx, "stdlibtemp", query, nil)
|
psname := fmt.Sprintf("stdlibpx%v", &argsV)
|
||||||
|
|
||||||
|
ps, err := c.conn.PrepareEx(ctx, psname, query, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// since PrepareEx failed, we didn't actually get to send the values, so
|
// since PrepareEx failed, we didn't actually get to send the values, so
|
||||||
// we can safely retry
|
// we can safely retry
|
||||||
|
@ -254,7 +256,7 @@ func (c *Conn) QueryContext(ctx context.Context, query string, argsV []driver.Na
|
||||||
}
|
}
|
||||||
|
|
||||||
restrictBinaryToDatabaseSqlTypes(ps)
|
restrictBinaryToDatabaseSqlTypes(ps)
|
||||||
return c.queryPreparedContext(ctx, "stdlibtemp", argsV)
|
return c.queryPreparedContext(ctx, psname, argsV)
|
||||||
}
|
}
|
||||||
|
|
||||||
rows, err := c.conn.Query(ctx, query, namedValueToInterface(argsV)...)
|
rows, err := c.conn.Query(ctx, query, namedValueToInterface(argsV)...)
|
||||||
|
|
Loading…
Reference in New Issue