mirror of https://github.com/jackc/pgx.git
Fix SimpleProtocol with prepared statement
parent
43ce317556
commit
5b06f03d0a
13
conn.go
13
conn.go
|
@ -473,14 +473,14 @@ optionLoop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if simpleProtocol {
|
|
||||||
return c.execSimpleProtocol(ctx, sql, arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
if sd, ok := c.preparedStatements[sql]; ok {
|
if sd, ok := c.preparedStatements[sql]; ok {
|
||||||
return c.execPrepared(ctx, sd, arguments)
|
return c.execPrepared(ctx, sd, arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if simpleProtocol {
|
||||||
|
return c.execSimpleProtocol(ctx, sql, arguments)
|
||||||
|
}
|
||||||
|
|
||||||
if len(arguments) == 0 {
|
if len(arguments) == 0 {
|
||||||
return c.execSimpleProtocol(ctx, sql, arguments)
|
return c.execSimpleProtocol(ctx, sql, arguments)
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,9 @@ optionLoop:
|
||||||
rows := c.getRows(ctx, sql, args)
|
rows := c.getRows(ctx, sql, args)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if simpleProtocol {
|
sd, ok := c.preparedStatements[sql]
|
||||||
|
|
||||||
|
if simpleProtocol && !ok {
|
||||||
sql, err = c.sanitizeForSimpleQuery(sql, args...)
|
sql, err = c.sanitizeForSimpleQuery(sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rows.fatal(err)
|
rows.fatal(err)
|
||||||
|
@ -646,7 +648,6 @@ optionLoop:
|
||||||
|
|
||||||
c.eqb.Reset()
|
c.eqb.Reset()
|
||||||
|
|
||||||
sd, ok := c.preparedStatements[sql]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
if c.stmtcache != nil {
|
if c.stmtcache != nil {
|
||||||
sd, err = c.stmtcache.Get(ctx, sql)
|
sd, err = c.stmtcache.Get(ctx, sql)
|
||||||
|
|
Loading…
Reference in New Issue