Skip to content

fix(query): run multi-statement scripts on one connection - #340

Open
Maxteabag wants to merge 1 commit into
fix/ssh-tunnel-transaction-executorfrom
feat/batch-single-connection
Open

Maxteabag wants to merge 1 commit into
fix/ssh-tunnel-transaction-executorfrom
feat/batch-single-connection

Conversation

@Maxteabag

Copy link
Copy Markdown
Owner

Running a script without gt opened a fresh connection per statement, so anything session-scoped was gone by the next line: SET @var, SET search_path, temp tables. Scripts now run on one connection, and a BEGIN inside the script continues on that same connection instead of opening another.

Checked in the real app, same scripts before and after: SQLite temp table (was "no such table", now returns the row), MariaDB @client_name from #337 (NULL, now '%Example%'), Postgres SET over the SSH tunnel ('' , now the value). Writes are still committed per statement and a failing statement still stops the script with the earlier writes kept, same as before.

Stacked on #339, which routes this executor through the SSH tunnel. Together they close #337.

Closes #337

Outside a transaction every statement got its own connection, so session
state like SET @var, SET search_path or temp tables never reached the
next statement of the same script. Scripts now share one connection for
the run; a BEGIN inside the script carries on that same connection.

Refs #337

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant