Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,14 @@ func (br *emptyBatchResults) Close() error {
func invalidateCachesOnBatchResultsError(conn *Conn, b *Batch, err error) {
if err != nil && conn != nil && b != nil {
if sc := conn.statementCache; sc != nil {
for _, bi := range b.QueuedQueries {
sc.Invalidate(bi.SQL)
for i := range b.QueuedQueries {
sc.Invalidate(b.QueuedQueries[i].SQL)
}
}

if sc := conn.descriptionCache; sc != nil {
for _, bi := range b.QueuedQueries {
sc.Invalidate(bi.SQL)
for i := range b.QueuedQueries {
sc.Invalidate(b.QueuedQueries[i].SQL)
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func BenchmarkMinimalUnpreparedSelectWithoutStatementCache(b *testing.B) {

var n int64

for i := 0; b.Loop(); i++ {
for i := range b.N {
err := conn.QueryRow(context.Background(), "select $1::int8", i).Scan(&n)
if err != nil {
b.Fatal(err)
Expand All @@ -66,7 +66,7 @@ func BenchmarkMinimalUnpreparedSelectWithStatementCacheModeDescribe(b *testing.B

var n int64

for i := 0; b.Loop(); i++ {
for i := range b.N {
err := conn.QueryRow(context.Background(), "select $1::int8", i).Scan(&n)
if err != nil {
b.Fatal(err)
Expand All @@ -89,7 +89,7 @@ func BenchmarkMinimalUnpreparedSelectWithStatementCacheModePrepare(b *testing.B)

var n int64

for i := 0; b.Loop(); i++ {
for i := range b.N {
err := conn.QueryRow(context.Background(), "select $1::int8", i).Scan(&n)
if err != nil {
b.Fatal(err)
Expand All @@ -112,7 +112,7 @@ func BenchmarkMinimalPreparedSelect(b *testing.B) {

var n int64

for i := 0; b.Loop(); i++ {
for i := range b.N {
err = conn.QueryRow(context.Background(), "ps1", i).Scan(&n)
if err != nil {
b.Fatal(err)
Expand Down
Loading