Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async query(...args): Promise {
var query = mysql.format(...args)
try {
var result = await this.pool.query(query)
} catch (err) {
this.log("query", { error: err.message, query })
throw err
}
this.log("query", { query, result })
return result
}
private async checkdb() {
const queryIdentifiers = [];
queryIdentifiers.push(tableName);
if (Object.keys(args).length !== 0) {
queryString += ' WHERE ';
Object.keys(args).forEach(function(arg, index) {
if (index > 0) {
queryString += ' AND ';
}
queryString += '?? = ?';
queryIdentifiers.push(arg);
queryIdentifiers.push(args[arg]);
});
}
queryIdentifiers.unshift(selectionColumns);
queryString = format(queryString, queryIdentifiers);
return pool.query(queryString);
};
export const generateFieldFunction = FieldMap => () => FieldMap;