Skip to content

Commit 0ed4ce6

Browse files
committed
fixed fake tx for scripting mode
1 parent 9599936 commit 0ed4ce6

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

internal/xsql/legacy/tx.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ func (tx *transaction) Exec(ctx context.Context, sql string, params *params.Para
3939
func (tx *transaction) Query(ctx context.Context, sql string, params *params.Params) (driver.RowsNextResultSet, error) {
4040
m := queryModeFromContext(ctx, tx.conn.defaultQueryMode)
4141
if m != DataQueryMode {
42-
return nil, badconn.Map(
43-
xerrors.WithStackTrace(
44-
xerrors.Retryable(
45-
fmt.Errorf("wrong query mode: %s", m.String()),
46-
xerrors.InvalidObject(),
47-
xerrors.WithName("WRONG_QUERY_MODE"),
48-
),
49-
),
42+
return nil, xerrors.WithStackTrace(
43+
fmt.Errorf("%s: %w", m.String(), ErrWrongQueryMode),
5044
)
5145
}
5246
res, err := tx.tx.Execute(ctx,

sql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func WithFakeTx(modes ...QueryMode) ConnectorOption {
175175
case ScriptingQueryMode:
176176
opts = append(opts,
177177
xsql.WithTableOptions(legacy.WithFakeTxModes(
178-
legacy.DataQueryMode,
178+
legacy.ScriptingQueryMode,
179179
)),
180180
)
181181
case QueryExecuteQueryMode:

0 commit comments

Comments
 (0)