Skip to content

Commit 6121a0a

Browse files
committed
build
1 parent c084a1c commit 6121a0a

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

cf/src/connection.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
111111
queue: queues.closed,
112112
idleTimer,
113113
connect(query) {
114-
initial = query
114+
initial = query || true
115115
reconnect()
116116
},
117117
terminate,
@@ -535,11 +535,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
535535
return terminate()
536536
}
537537

538-
if (needsTypes)
538+
if (needsTypes) {
539+
initial === true && (initial = null)
539540
return fetchArrayTypes()
541+
}
540542

541-
execute(initial)
542-
options.shared.retries = retries = initial = 0
543+
initial !== true && execute(initial)
544+
options.shared.retries = retries = 0
545+
initial = null
543546
return
544547
}
545548

cjs/src/connection.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
109109
queue: queues.closed,
110110
idleTimer,
111111
connect(query) {
112-
initial = query
112+
initial = query || true
113113
reconnect()
114114
},
115115
terminate,
@@ -533,11 +533,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
533533
return terminate()
534534
}
535535

536-
if (needsTypes)
536+
if (needsTypes) {
537+
initial === true && (initial = null)
537538
return fetchArrayTypes()
539+
}
538540

539-
execute(initial)
540-
options.shared.retries = retries = initial = 0
541+
initial !== true && execute(initial)
542+
options.shared.retries = retries = 0
543+
initial = null
541544
return
542545
}
543546

cjs/tests/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -2543,3 +2543,14 @@ t('reserve connection', async() => {
25432543
xs.map(x => x.x).join('')
25442544
]
25452545
})
2546+
2547+
t('arrays in reserved connection', async() => {
2548+
const reserved = await sql.reserve()
2549+
const [{ x }] = await reserved`select array[1, 2, 3] as x`
2550+
reserved.release()
2551+
2552+
return [
2553+
'123',
2554+
x.join('')
2555+
]
2556+
})

deno/src/connection.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
112112
queue: queues.closed,
113113
idleTimer,
114114
connect(query) {
115-
initial = query
115+
initial = query || true
116116
reconnect()
117117
},
118118
terminate,
@@ -536,11 +536,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
536536
return terminate()
537537
}
538538

539-
if (needsTypes)
539+
if (needsTypes) {
540+
initial === true && (initial = null)
540541
return fetchArrayTypes()
542+
}
541543

542-
execute(initial)
543-
options.shared.retries = retries = initial = 0
544+
initial !== true && execute(initial)
545+
options.shared.retries = retries = 0
546+
initial = null
544547
return
545548
}
546549

deno/tests/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -2546,4 +2546,15 @@ t('reserve connection', async() => {
25462546
]
25472547
})
25482548

2549+
t('arrays in reserved connection', async() => {
2550+
const reserved = await sql.reserve()
2551+
const [{ x }] = await reserved`select array[1, 2, 3] as x`
2552+
reserved.release()
2553+
2554+
return [
2555+
'123',
2556+
x.join('')
2557+
]
2558+
})
2559+
25492560
;window.addEventListener("unload", () => Deno.exit(process.exitCode))

0 commit comments

Comments
 (0)