(dbName: string, port: string, sql: string)
| 21 | // Callers that interpolate non-constant values MUST validate them first |
| 22 | // (see masking-exemption's assertSafeSqlIdentifier). |
| 23 | export function execSql(dbName: string, port: string, sql: string): void { |
| 24 | execFileSync( |
| 25 | "psql", |
| 26 | [ |
| 27 | "-h", "/tmp", |
| 28 | "-p", port, |
| 29 | "-U", "bbsample", |
| 30 | "-d", dbName, |
| 31 | "-v", "ON_ERROR_STOP=1", |
| 32 | "-c", sql, |
| 33 | ], |
| 34 | { stdio: "pipe" }, |
| 35 | ); |
| 36 | } |
| 37 | |
| 38 | // Run a read query and return the raw scalar/tuple output (tuples-only, |
| 39 | // unaligned). Reads as the owner (bbsample), so it reflects the committed |
no outgoing calls