Hi.
I recently discovered that conn.escape() fails sometimes, rendering the query as "undefined".
var query = ('select id from statistics.adstats where date="' +
args['date'] +
'" and advertiser=' +
conn.escape(args['advertiser']) +
' and placement=' +
conn.escape(args['placement']) +
' and format=' +
conn.escape(args['format']) +
' and unit=' +
conn.escape(args['unit']));
conn.query(query, function (err, rows) {
if (err) {
// If the first query fails, we can not proceed. Let's make an entry in the log and move on
app.errors++;
console.log(getPrettyDate() + " - " + getPrettyTime() + " DB Error: " + err + " query:" + query);
console.log("Offending query:" + query);
conn.end();
return true;
}