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

Function CommandComplete

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

Source from the content-addressed store, hash-verified

588 }
589
590 function CommandComplete(x) {
591 rows = 0
592
593 for (let i = x.length - 1; i > 0; i--) {
594 if (x[i] === 32 && x[i + 1] < 58 && result.count === null)
595 result.count = +x.toString('utf8', i + 1, x.length - 1)
596 if (x[i - 1] >= 65) {
597 result.command = x.toString('utf8', 5, i)
598 result.state = backend
599 break
600 }
601 }
602
603 final && (final(), final = null)
604
605 if (result.command === 'BEGIN' && max !== 1 && !connection.reserved)
606 return errored(Errors.generic('UNSAFE_TRANSACTION', 'Only use sql.begin, sql.reserved or max: 1'))
607
608 if (query.options.simple)
609 return BindComplete()
610
611 if (query.cursorFn) {
612 result.count && query.cursorFn(result)
613 write(Sync)
614 }
615 }
616
617 function ParseComplete() {
618 query.parsing = false

Callers

nothing calls this directly

Calls 4

finalFunction · 0.70
erroredFunction · 0.70
BindCompleteFunction · 0.70
writeFunction · 0.70

Tested by

no test coverage detected