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

Function CommandComplete

cf/src/connection.js:592–617  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

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