@calljmp/cli
Version:
27 lines • 1.18 kB
TypeScript
/**
* @module
* This code is inspired by that of https://www.atdatabases.org/docs/split-sql-query, which is published under MIT license,
* and is Copyright (c) 2019 Forbes Lindesay.
*
* See https://github.com/ForbesLindesay/atdatabases/blob/103c1e7/packages/split-sql-query/src/index.ts
* for the original code.
*/
/**
* A function to remove transaction statements from the start and end of SQL files, as the D1 API already does it for us.
* @param sql a potentially large string of SQL statements
* @returns the initial input, without `BEGIN TRANSACTION`/`COMMIT`
*/
export declare function trimSqlQuery(sql: string): string;
export declare function mayContainTransaction(sql: string): boolean;
/**
* Is the given `sql` string likely to contain multiple statements.
*
* If `mayContainMultipleStatements()` returns `false` you can be confident that the sql
* does not contain multiple statements. Otherwise you have to check further.
*/
export declare function mayContainMultipleStatements(sql: string): boolean;
/**
* Split an SQLQuery into an array of statements
*/
export default function splitSqlQuery(sql: string): string[];
//# sourceMappingURL=sql.d.ts.map