mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 15:06:01 +00:00
query-splitter - documentation, publish
This commit is contained in:
34
packages/query-splitter/README.md
Normal file
34
packages/query-splitter/README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
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
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
```sh
|
||||
yarn test
|
||||
```
|
||||
|
||||
## Supported syntax
|
||||
* Comments
|
||||
* Dollar strings (PostgreSQL)
|
||||
* GO separators (MS SQL)
|
||||
* Custom delimiter, setby DELIMITER keyword (MySQL)
|
||||
Reference in New Issue
Block a user