* Run a query against the database, returning the result set. * Should the query fail due to a connection error, the connection is * marked as unhealthy.
(query: SqlQuery)
| 75 | * marked as unhealthy. |
| 76 | */ |
| 77 | private async performIO(query: SqlQuery): Promise<LibSqlResultSet> { |
| 78 | const release = await this[LOCK_TAG].acquire() |
| 79 | try { |
| 80 | const result = await this.client.execute({ |
| 81 | sql: query.sql, |
| 82 | args: query.args.map((arg, i) => mapArg(arg, query.argTypes[i], this.adapterOptions)), |
| 83 | }) |
| 84 | return result |
| 85 | } catch (e) { |
| 86 | this.onError(e) |
| 87 | } finally { |
| 88 | release() |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | protected onError(error: any): never { |
| 93 | debug('Error in performIO: %O', error) |