MCPcopy
hub / github.com/questdb/questdb / executeQuery

Method executeQuery

compat/src/test/nodejs-postgres/runner.js:64–79  ·  view source on GitHub ↗
(sql, query, parameters = [])

Source from the content-addressed store, hash-verified

62 }
63
64 async executeQuery(sql, query, parameters = []) {
65 try {
66 // postgres.js uses tagged template literals, but we can use .unsafe() for dynamic queries
67 const result = await sql.unsafe(query, parameters);
68
69 if (query.trim().toUpperCase().startsWith('SELECT')) {
70 // Convert rows to array of values to match the original implementation
71 return result.map(row => Object.values(row));
72 } else {
73 // For non-SELECT queries, return row count in the same format as the original
74 return [[result.count || 0]];
75 }
76 } catch (error) {
77 return error.message;
78 }
79 }
80
81 resolveParameters(typedParameters, variables) {
82 const resolvedParameters = [];

Callers 1

executeStepMethod · 0.95

Calls 5

toUpperCaseMethod · 0.80
mapMethod · 0.65
startsWithMethod · 0.45
trimMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected