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

Function build

cf/src/connection.js:226–246  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

224 }
225
226 function build(q) {
227 const parameters = []
228 , types = []
229
230 const string = stringify(q, q.strings[0], q.args[0], parameters, types, options)
231
232 !q.tagged && q.args.forEach(x => handleValue(x, parameters, types, options))
233
234 q.prepare = options.prepare && ('prepare' in q.options ? q.options.prepare : true)
235 q.string = string
236 q.signature = q.prepare && types + string
237 q.onlyDescribe && (delete statements[q.signature])
238 q.parameters = q.parameters || parameters
239 q.prepared = q.prepare && q.signature in statements
240 q.describeFirst = q.onlyDescribe || (parameters.length && !q.prepared)
241 q.statement = q.prepared
242 ? statements[q.signature]
243 : { string, types, name: q.prepare ? statementId + statementCount++ : '' }
244
245 typeof options.debug === 'function' && options.debug(id, string, parameters, types)
246 }
247
248 function write(x, fn) {
249 chunk = chunk ? Buffer.concat([chunk, x]) : Buffer.from(x)

Callers 1

executeFunction · 0.70

Calls 3

stringifyFunction · 0.90
handleValueFunction · 0.90
forEachMethod · 0.65

Tested by

no test coverage detected