dbgate-query-splitter is a utility library designed to efficiently break down long SQL queries into individual statements. Currently at version 4.12.0, it is actively maintained with a focus on high performance and a zero-dependency footprint. The library supports a wide array of SQL dialects including MySQL, PostgreSQL, SQLite, Microsoft SQL Server, and Oracle, handling complex syntax elements like comments, dollar strings, GO separators, custom delimiters, and `SET SQLTERMINATOR`. A key differentiator is its robust streaming support for Node.js environments, allowing processing of large SQL files without loading them entirely into memory. It also provides an option to return rich metadata, including line and column numbers, for each split statement, which is useful for tooling and error reporting.
npm install dbgate-query-splitterVerified import paths — ran on the pinned version, not inferred.
Demonstrates splitting a multi-statement SQL string using MSSQL dialect options and retrieving rich position information for each statement.
Remove any manual `byline` piping when using `splitQueryStream`. The function now directly accepts a Node.js readable stream and returns an object stream.
Correct the import statement: `import { splitQueryStream } from 'dbgate-query-splitter/lib/splitQueryStream';` (ESM) or `const { splitQueryStream } = require('dbgate-query-splitter/lib/splitQueryStream');` (CJS).Always provide a valid splitter options object, e.g., `mysqlSplitterOptions`, `mssqlSplitterOptions`, or a custom configuration object, as the second argument to `splitQuery`.
Change your import statement to `import { splitQueryStream } from 'dbgate-query-splitter/lib/splitQueryStream';`For CommonJS, use `const { splitQuery } = require('dbgate-query-splitter');`. For ESM, ensure `import { splitQuery } from 'dbgate-query-splitter';` is used in an ESM context.No dependency data recorded yet.