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

Function ReadyForQuery

deno/src/connection.js:538–591  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

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