Improve split statement regex, pagination and result messages - #4
Open
dnlw07 wants to merge 3 commits into
Open
Conversation
queryResult/prepare+executeNonQuery, and SELECT/WITH pagination with cached exact row counts. Add an optional connectionInitSql field that runs once after connect. Drop a log line that printed the connection string (including password) in plaintext.
…adingNoise() logic between splitStatements() and driver.ts instead of duplicating it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/ls/splitStatements.ts: a quote/comment-aware SQL statementsplitter that tracks BEGIN/CASE/IF/WHILE/FOR/LOOP/REPEAT nesting depth,
so multi-statement scripts and PL/SQL-style blocks split correctly.
src/ls/driver.ts:open()connects asynchronously via callback and, ifconnectionInitSqlis set on the connection, runs it once afterconnecting (e.g.
SET CURRENT SCHEMA/PATH), failing loudly andclosing the connection if the init script errors.
close()closes the connection asynchronously via callback insteadof
closeSync().query()now splits input withsplitStatements, normalizesCRLF/CR line endings, and distinguishes result-set statements
(SELECT/WITH/VALUES/CALL/DESCRIBE/EXPLAIN/XQUERY) from DML/DDL,
executing each via
queryResultorprepare+executeNonQueryas appropriate.
COUNT(*)(cached per query/tab, refreshed on page 0) with alook-ahead fallback when the COUNT wrapper isn't accepted.
returned" for empty result sets, elapsed time in all messages.
(including the plaintext password) on every connect.
connectionInitSqltoconnection.schema.json/ui.schema.json(rendered as a textarea in the connection form).
README.md(Windows install path, issues link, expandedbuild prerequisites) and bump
package.jsonversion to0.0.4.Test plan
npm run compile/tsc --noEmitpassesconnectionInitSqlsetreports the correct affected-row message
BEGIN ... ENDblock and confirm it isnot split mid-block