* Strip line comments (`-- ...`) but not block comments. `commons.sql` does * not currently use either; we keep the helper trivial and document the * limitation.
(sql: string)
| 57 | * limitation. |
| 58 | */ |
| 59 | function stripLineComments(sql: string): string { |
| 60 | return sql |
| 61 | .split('\n') |
| 62 | .map(line => { |
| 63 | const idx = line.indexOf('--'); |
| 64 | return idx >= 0 ? line.slice(0, idx) : line; |
| 65 | }) |
| 66 | .join('\n'); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Split SQL into top-level statements at semicolons that appear outside of |