/** * One statement as it is handed to the driver for writing to the wire — * including the transaction-control statements the driver issues on its own * (`BEGIN`, `SAVEPOINT`, `COMMIT`, `ROLLBACK`), which no application-level hook * can see. */ export interface StatementEvent { /** * The driver's connection ordinal — a process-local monotonic counter * assigned when the connection object is constructed. It is NOT the * PostgreSQL backend pid: it is unique and stable per connection for that * connection's lifetime within this process, and meaningless across * processes. Correct as a key for per-connection accounting (a transaction is * pinned to one connection); wrong for correlating with `pg_stat_activity`. */ readonly connectionId: number; /** The statement text, untruncated. */ readonly query: string; /** Bind parameters for this statement, in ordinal position. */ readonly parameters: readonly unknown[]; } /** * Caller-supplied per-statement observer. Fires once per statement written to * the wire, on every connection the manifold owns — pooled connections and the * test harness's own connections alike. * * Pure observation: the return value is discarded and the statement is never * mutated. It runs synchronously on the driver's write path, so it must be * cheap and must not throw. * * Counts wire truth, not application intent. Two consequences worth knowing * before you assert on a total: the driver issues its own transaction control * (`BEGIN`/`SAVEPOINT`/`COMMIT`/`ROLLBACK`), and it issues one `pg_catalog.pg_type` * lookup per connection the first time that connection is used. * * Adds no leak surface. Installing an observer requires turning on the driver's * `debug` hook, which would otherwise start serializing bind parameters onto * every query error; pipework's driver error boundary puts those errors back to * their unobserved shape, so **every statement path pipework mediates — * `pipe()`, every `pipe.*` write, `connection.drizzle`, transactions and * savepoints — exposes exactly what it exposed before**. The single exception * is the raw `ManagedConnection.client` door: queries issued through it are * outside the boundary and their errors do serialize bind parameters. Reading * `.client` on an observed connection logs a warning saying so, once per * database. */ export type StatementObserver = (event: StatementEvent) => void; //# sourceMappingURL=statement-observer.d.ts.map