9 lines
259 B
TypeScript
9 lines
259 B
TypeScript
export function splitSqlStatements(sql: string): string[] {
|
|
const withoutComments = sql.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*--.*$/gm, "");
|
|
|
|
return withoutComments
|
|
.split(";")
|
|
.map((statement) => statement.trim())
|
|
.filter(Boolean);
|
|
}
|