Skip to content

Commit e15821e

Browse files
committed
hotfix: ignore transaction
1 parent 7873c4d commit e15821e

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

template/driver.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ func (c *cacheConn) Prepare(rawQuery string) (driver.Stmt, error) {
120120
PurgeAllCaches()
121121
}
122122
return c.inner.Prepare(rawQuery)
123+
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
124+
return c.inner.Prepare(rawQuery)
123125
}
124126

125127
if queryInfo.Type == domains.CachePlanQueryType_SELECT && !queryInfo.Select.Cache {

template/driver.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ func (c *cacheConn) Prepare(rawQuery string) (driver.Stmt, error) {
119119
PurgeAllCaches()
120120
}
121121
return c.inner.Prepare(rawQuery)
122+
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
123+
return c.inner.Prepare(rawQuery)
122124
}
123125

124126
if queryInfo.Type == domains.CachePlanQueryType_SELECT && !queryInfo.Select.Cache {

template/stmt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ func (c *cacheConn) QueryContext(ctx context.Context, rawQuery string, nvargs []
389389
queryInfo, ok := queryMap[normalizedQuery]
390390
if !ok {
391391
return inner.QueryContext(ctx, rawQuery, nvargs)
392+
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
393+
return inner.QueryContext(ctx, rawQuery, nvargs)
392394
}
393395
if queryInfo.Type != domains.CachePlanQueryType_SELECT || !queryInfo.Select.Cache {
394396
return inner.QueryContext(ctx, rawQuery, nvargs)

template/stmt.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ func (c *cacheConn) QueryContext(ctx context.Context, rawQuery string, nvargs []
389389
queryInfo, ok := queryMap[normalizedQuery]
390390
if !ok {
391391
return inner.QueryContext(ctx, rawQuery, nvargs)
392+
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
393+
return inner.QueryContext(ctx, rawQuery, nvargs)
392394
}
393395
if queryInfo.Type != domains.CachePlanQueryType_SELECT || !queryInfo.Select.Cache {
394396
return inner.QueryContext(ctx, rawQuery, nvargs)

0 commit comments

Comments
 (0)