MCPcopy Create free account
hub / github.com/porsager/postgres / ReadyForQuery

Function ReadyForQuery

cjs/src/connection.js:535–588  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

533 }
534
535 function ReadyForQuery(x) {
536 if (query) {
537 if (errorResponse) {
538 query.retried
539 ? errored(query.retried)
540 : query.prepared && retryRoutines.has(errorResponse.routine)
541 ? retry(query, errorResponse)
542 : errored(errorResponse)
543 } else {
544 query.resolve(results || result)
545 }
546 } else if (errorResponse) {
547 errored(errorResponse)
548 }
549
550 query = results = errorResponse = null
551 result = new Result()
552 connectTimer.cancel()
553
554 if (initial) {
555 if (target_session_attrs) {
556 if (!backendParameters.in_hot_standby || !backendParameters.default_transaction_read_only)
557 return fetchState()
558 else if (tryNext(target_session_attrs, backendParameters))
559 return terminate()
560 }
561
562 if (needsTypes) {
563 initial.reserve && (initial = null)
564 return fetchArrayTypes()
565 }
566
567 initial && !initial.reserve && execute(initial)
568 options.shared.retries = retries = 0
569 initial = null
570 return
571 }
572
573 while (sent.length && (query = sent.shift()) && (query.active = true, query.cancelled))
574 Connection(options).cancel(query.state, query.cancelled.resolve, query.cancelled.reject)
575
576 if (query)
577 return // Consider opening if able and sent.length < 50
578
579 connection.reserved
580 ? !connection.reserved.release && x[5] === 73 // I
581 ? ending
582 ? terminate()
583 : (connection.reserved = null, onopen(connection))
584 : connection.reserved()
585 : ending
586 ? terminate()
587 : onopen(connection)
588 }
589
590 function CommandComplete(x) {
591 rows = 0

Callers

nothing calls this directly

Calls 10

erroredFunction · 0.70
retryFunction · 0.70
fetchStateFunction · 0.70
tryNextFunction · 0.70
terminateFunction · 0.70
fetchArrayTypesFunction · 0.70
executeFunction · 0.70
ConnectionFunction · 0.70
onopenFunction · 0.70
cancelMethod · 0.65

Tested by

no test coverage detected