This is an automated email from the ASF dual-hosted git repository. zfeng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-seata-go.git
The following commit(s) were added to refs/heads/master by this push: new 936af390 fix: when using queryContext, it will cause the transaction to fail (#810) 936af390 is described below commit 936af3903e32617e23596bd0e28c913707df9a69 Author: FengZhang <zfc...@qq.com> AuthorDate: Sat May 24 20:06:34 2025 +0800 fix: when using queryContext, it will cause the transaction to fail (#810) remmove queryContxt --- pkg/datasource/sql/conn_at.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/pkg/datasource/sql/conn_at.go b/pkg/datasource/sql/conn_at.go index abc31f26..22aa06ab 100644 --- a/pkg/datasource/sql/conn_at.go +++ b/pkg/datasource/sql/conn_at.go @@ -43,46 +43,6 @@ func (c *ATConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, return c.Conn.PrepareContext(ctx, query) } -// QueryContext -func (c *ATConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { - if c.createOnceTxContext(ctx) { - defer func() { - c.txCtx = types.NewTxCtx() - }() - } - - ret, err := c.createNewTxOnExecIfNeed(ctx, func() (types.ExecResult, error) { - executor, err := exec.BuildExecutor(c.res.dbType, c.txCtx.TransactionMode, query) - if err != nil { - return nil, err - } - - execCtx := &types.ExecContext{ - TxCtx: c.txCtx, - Query: query, - NamedValues: args, - Conn: c.targetConn, - DBName: c.dbName, - DbVersion: c.GetDbVersion(), - IsSupportsSavepoints: true, - IsAutoCommit: c.GetAutoCommit(), - } - - return executor.ExecWithNamedValue(ctx, execCtx, - func(ctx context.Context, query string, args []driver.NamedValue) (types.ExecResult, error) { - ret, err := c.Conn.QueryContext(ctx, query, args) - if err != nil { - return nil, err - } - return types.NewResult(types.WithRows(ret)), nil - }) - }) - if err != nil { - return nil, err - } - return ret.GetRows(), nil -} - // ExecContext func (c *ATConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { if c.createOnceTxContext(ctx) { --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org