Narcoleptic's Patch Mangler
    Have ideas to improve npm?Join in the discussion! »

    dbgate-query-splitter
    TypeScript icon, indicating that this package has built-in type declarations

    4.2.5 • Public • Published

    NPM version

    dbgate-query-splitter

    Splits long SQL query into into particular statements. Designed to have zero dependencies and to be fast.

    Supports following SQL dialects:

    • MySQL
    • PostgreSQL
    • SQLite
    • Microsoft SQL Server

    Usage

    import { splitQuery, mysqlSplitterOptions, mssqlSplitterOptions, postgreSplitterOptions } from 'dbgate-query-splitter';
    
    const output = splitQuery('SELECT * FROM `table1`;SELECT * FROM `table2`;', mysqlSplitterOptions);
    
    // output is ['SELECT * FROM `table1`', 'SELECT * FROM `table2`']

    Contributing

    Please run tests before pushing any changes.

    yarn test

    Supported syntax

    • Comments
    • Dollar strings (PostgreSQL)
    • GO separators (MS SQL)
    • Custom delimiter, setby DELIMITER keyword (MySQL)

    Install

    npm i dbgate-query-splitter

    DownloadsWeekly Downloads

    49

    Version

    4.2.5

    License

    MIT

    Unpacked Size

    14.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar