Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Nov 2, 2023
1 parent c084a1c commit 6121a0a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 12 deletions.
11 changes: 7 additions & 4 deletions cf/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
queue: queues.closed,
idleTimer,
connect(query) {
initial = query
initial = query || true
reconnect()
},
terminate,
Expand Down Expand Up @@ -535,11 +535,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
return terminate()
}

if (needsTypes)
if (needsTypes) {
initial === true && (initial = null)
return fetchArrayTypes()
}

execute(initial)
options.shared.retries = retries = initial = 0
initial !== true && execute(initial)
options.shared.retries = retries = 0
initial = null
return
}

Expand Down
11 changes: 7 additions & 4 deletions cjs/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
queue: queues.closed,
idleTimer,
connect(query) {
initial = query
initial = query || true
reconnect()
},
terminate,
Expand Down Expand Up @@ -533,11 +533,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
return terminate()
}

if (needsTypes)
if (needsTypes) {
initial === true && (initial = null)
return fetchArrayTypes()
}

execute(initial)
options.shared.retries = retries = initial = 0
initial !== true && execute(initial)
options.shared.retries = retries = 0
initial = null
return
}

Expand Down
11 changes: 11 additions & 0 deletions cjs/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2543,3 +2543,14 @@ t('reserve connection', async() => {
xs.map(x => x.x).join('')
]
})

t('arrays in reserved connection', async() => {
const reserved = await sql.reserve()
const [{ x }] = await reserved`select array[1, 2, 3] as x`
reserved.release()

return [
'123',
x.join('')
]
})
11 changes: 7 additions & 4 deletions deno/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
queue: queues.closed,
idleTimer,
connect(query) {
initial = query
initial = query || true
reconnect()
},
terminate,
Expand Down Expand Up @@ -536,11 +536,14 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
return terminate()
}

if (needsTypes)
if (needsTypes) {
initial === true && (initial = null)
return fetchArrayTypes()
}

execute(initial)
options.shared.retries = retries = initial = 0
initial !== true && execute(initial)
options.shared.retries = retries = 0
initial = null
return
}

Expand Down
11 changes: 11 additions & 0 deletions deno/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2546,4 +2546,15 @@ t('reserve connection', async() => {
]
})

t('arrays in reserved connection', async() => {
const reserved = await sql.reserve()
const [{ x }] = await reserved`select array[1, 2, 3] as x`
reserved.release()

return [
'123',
x.join('')
]
})

;window.addEventListener("unload", () => Deno.exit(process.exitCode))

0 comments on commit 6121a0a

Please sign in to comment.