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

Function data

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

Source from the content-addressed store, hash-verified

301 }
302
303 function data(x) {
304 if (incomings) {
305 incomings.push(x)
306 remaining -= x.length
307 if (remaining > 0)
308 return
309 }
310
311 incoming = incomings
312 ? Buffer.concat(incomings, length - remaining)
313 : incoming.length === 0
314 ? x
315 : Buffer.concat([incoming, x], incoming.length + x.length)
316
317 while (incoming.length > 4) {
318 length = incoming.readUInt32BE(1)
319 if (length >= incoming.length) {
320 remaining = length - incoming.length
321 incomings = [incoming]
322 break
323 }
324
325 try {
326 handle(incoming.subarray(0, length + 1))
327 } catch (e) {
328 query && (query.cursorFn || query.describeFirst) && write(Sync)
329 errored(e)
330 }
331 incoming = incoming.subarray(length + 1)
332 remaining = 0
333 incomings = null
334 }
335 }
336
337 async function connect() {
338 terminated = false

Callers

nothing calls this directly

Calls 3

handleFunction · 0.70
writeFunction · 0.70
erroredFunction · 0.70

Tested by

no test coverage detected