Skip to content

Commit

Permalink
hotfix: ignore transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
pirosiki197 committed Jan 26, 2025
1 parent 7873c4d commit e15821e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions template/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ func (c *cacheConn) Prepare(rawQuery string) (driver.Stmt, error) {
PurgeAllCaches()
}
return c.inner.Prepare(rawQuery)
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
return c.inner.Prepare(rawQuery)
}

if queryInfo.Type == domains.CachePlanQueryType_SELECT && !queryInfo.Select.Cache {
Expand Down
2 changes: 2 additions & 0 deletions template/driver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func (c *cacheConn) Prepare(rawQuery string) (driver.Stmt, error) {
PurgeAllCaches()
}
return c.inner.Prepare(rawQuery)
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
return c.inner.Prepare(rawQuery)
}

if queryInfo.Type == domains.CachePlanQueryType_SELECT && !queryInfo.Select.Cache {
Expand Down
2 changes: 2 additions & 0 deletions template/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ func (c *cacheConn) QueryContext(ctx context.Context, rawQuery string, nvargs []
queryInfo, ok := queryMap[normalizedQuery]
if !ok {
return inner.QueryContext(ctx, rawQuery, nvargs)
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
return inner.QueryContext(ctx, rawQuery, nvargs)
}
if queryInfo.Type != domains.CachePlanQueryType_SELECT || !queryInfo.Select.Cache {
return inner.QueryContext(ctx, rawQuery, nvargs)
Expand Down
2 changes: 2 additions & 0 deletions template/stmt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ func (c *cacheConn) QueryContext(ctx context.Context, rawQuery string, nvargs []
queryInfo, ok := queryMap[normalizedQuery]
if !ok {
return inner.QueryContext(ctx, rawQuery, nvargs)
} else if strings.Contains(normalizedQuery, "FOR UPDATE") {
return inner.QueryContext(ctx, rawQuery, nvargs)
}
if queryInfo.Type != domains.CachePlanQueryType_SELECT || !queryInfo.Select.Cache {
return inner.QueryContext(ctx, rawQuery, nvargs)
Expand Down

0 comments on commit e15821e

Please sign in to comment.