| 32 | } |
| 33 | |
| 34 | override createDriver(): Driver { |
| 35 | const driver = super.createDriver(); |
| 36 | const onReserveConnection = this.#onReserveConnection; |
| 37 | |
| 38 | if (!onReserveConnection) { |
| 39 | return driver; |
| 40 | } |
| 41 | |
| 42 | const acquireConnection = driver.acquireConnection.bind(driver); |
| 43 | driver.acquireConnection = async (options?: AbortableOperationOptions): Promise<DatabaseConnection> => { |
| 44 | const connection = await acquireConnection(options); |
| 45 | await onReserveConnection(connection); |
| 46 | |
| 47 | return connection; |
| 48 | }; |
| 49 | |
| 50 | return driver; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /** Microsoft SQL Server database connection using the `tedious` driver. */ |