Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
success: function success(report) {
// ╔═╗╔═╗╦═╗╔═╗╔═╗ ┌─┐ ┬ ┬┌─┐┬─┐┬ ┬ ┬─┐┌─┐┌─┐┬ ┬┬ ┌┬┐┌─┐
// ╠═╝╠═╣╠╦╝╚═╗║╣ │─┼┐│ │├┤ ├┬┘└┬┘ ├┬┘├┤ └─┐│ ││ │ └─┐
// ╩ ╩ ╩╩╚═╚═╝╚═╝ └─┘└└─┘└─┘┴└─ ┴ ┴└─└─┘└─┘└─┘┴─┘┴ └─┘
// If there was a query type given, parse the results.
var queryResults = report.result;
if (options.queryType) {
try {
queryResults = PG.parseNativeQueryResult({
queryType: options.queryType,
nativeQueryResult: report.result
}).execSync();
} catch (e) {
return cb(e);
}
}
return cb(null, queryResults);
}
});
// If the query failed to run, release the connection and return the parsed
// error footprint.
if (err) {
releaseConnection(options.connection, options.leased, function releaseCb() {
return cb(err);
});
return;
}
// If the records were fetched, then pretend this was find and parse the
// native query results.
if (options.fetchRecords) {
var parsedResults;
try {
parsedResults = PG.parseNativeQueryResult({
queryType: 'select',
nativeQueryResult: report
}).execSync();
} catch (e) {
return cb(e);
}
return cb(undefined, parsedResults.result);
}
// Return the results
return cb(undefined, report.result);
});
};