@@ -8,9 +8,6 @@ import { Driver, TransactionSettings } from '../../driver/driver.js'
88import { parseSavepointCommand } from '../../parser/savepoint-parser.js'
99import { CompiledQuery } from '../../query-compiler/compiled-query.js'
1010import { QueryCompiler } from '../../query-compiler/query-compiler.js'
11- import { ExecuteQueryOptions } from '../../query-executor/query-executor.js'
12- import { AbortError , assertNotAborted } from '../../util/abort.js'
13- import { Deferred } from '../../util/deferred.js'
1411import { logOnce } from '../../util/log-once.js'
1512import { isFunction , freeze } from '../../util/object-utils.js'
1613import { createQueryId } from '../../util/query-id.js'
@@ -22,7 +19,6 @@ import {
2219 PostgresPoolClient ,
2320} from './postgres-dialect-config.js'
2421
25- const PRIVATE_MAKE_CANCELABLE_METHOD = Symbol ( )
2622const PRIVATE_RELEASE_METHOD = Symbol ( )
2723
2824export class PostgresDriver implements Driver {
@@ -182,7 +178,7 @@ class PostgresConnection implements DatabaseConnection {
182178 ) : Promise < QueryResult < O > > {
183179 try {
184180 if ( options ?. cancelable ) {
185- await this [ PRIVATE_MAKE_CANCELABLE_METHOD ] ( )
181+ await this . #setupCancelability ( )
186182 }
187183
188184 const result = await this . #client. query < O > ( compiledQuery . sql , [
@@ -222,7 +218,7 @@ class PostgresConnection implements DatabaseConnection {
222218 }
223219
224220 if ( options ?. cancelable ) {
225- await this [ PRIVATE_MAKE_CANCELABLE_METHOD ] ( )
221+ await this . #setupCancelability ( )
226222 }
227223
228224 const cursor = this . #client. query (
@@ -249,7 +245,11 @@ class PostgresConnection implements DatabaseConnection {
249245 }
250246 }
251247
252- async [ PRIVATE_MAKE_CANCELABLE_METHOD ] ( ) : Promise < void > {
248+ [ PRIVATE_RELEASE_METHOD ] ( ) : void {
249+ this . #client. release ( )
250+ }
251+
252+ async #setupCancelability( ) : Promise < void > {
253253 if ( this . #pid) {
254254 return
255255 }
@@ -263,8 +263,4 @@ class PostgresConnection implements DatabaseConnection {
263263
264264 this . #pid = row . pid
265265 }
266-
267- [ PRIVATE_RELEASE_METHOD ] ( ) : void {
268- this . #client. release ( )
269- }
270266}
0 commit comments