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

Function Bind

cf/src/connection.js:950–972  ·  view source on GitHub ↗
(parameters, types, statement = '', portal = '')

Source from the content-addressed store, hash-verified

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