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

Function Bind

deno/src/connection.js:951–973  ·  view source on GitHub ↗
(parameters, types, statement = '', portal = '')

Source from the content-addressed store, hash-verified

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