var async = require("async");
// ...
var tasks = [];
if (price) {
tasks.push(function(callback) {
connection.query('UPDATE fotopovtory SET price="' + price + '" WHERE foto_id = "' + itemId + '";', callback);
});
}
if (type) {
tasks.push(function(callback) {
connection.query('UPDATE fotopovtory SET tipe="' + type + '" WHERE foto_id = "' + itemId + '";', callback);
});
}
async.parallel(tasks, function(err) {
if (err) throw err;
res.end();
});
// if you have an existing collection, it must first by synced.
// this will add random data for the `path` key for each doc.
Song.syncRandom(function (err, result) {
console.log(result.updated);
});
connection.connect();
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
connection.end();