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

Function Bind

cjs/src/connection.js:948–970  ·  view source on GitHub ↗
(parameters, types, statement = '', portal = '')

Source from the content-addressed store, hash-verified

946
947 /* Messages */
948 function Bind(parameters, types, statement = '', portal = '') {
949 let prev
950 , type
951
952 b().B().str(portal + b.N).str(statement + b.N).i16(0).i16(parameters.length)
953
954 parameters.forEach((x, i) => {
955 if (x === null)
956 return b.i32(0xFFFFFFFF)
957
958 type = types[i]
959 parameters[i] = x = type in options.serializers
960 ? options.serializers[type](x)
961 : '' + x
962
963 prev = b.i
964 b.inc(4).str(x).i32(b.i - prev - 4, prev)
965 })
966
967 b.i16(0)
968
969 return b.end()
970 }
971
972 function Parse(str, parameters, types, name = '') {
973 b().P().str(name + b.N).str(str + b.N).i16(parameters.length)

Callers 1

preparedFunction · 0.70

Calls 2

forEachMethod · 0.65
endMethod · 0.65

Tested by

no test coverage detected