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

Function build

cjs/src/connection.js:224–244  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

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

Callers 1

executeFunction · 0.70

Calls 3

stringifyFunction · 0.70
handleValueFunction · 0.70
forEachMethod · 0.65

Tested by

no test coverage detected