Skip to content

Instantly share code, notes, and snippets.

@phaidros7
Last active August 29, 2015 14:05
Show Gist options
  • Save phaidros7/57ad982fb615f9e7fddc to your computer and use it in GitHub Desktop.
Save phaidros7/57ad982fb615f9e7fddc to your computer and use it in GitHub Desktop.
function insertJob(site,node,time,gets){
var connection = openConnection();
var sqlInsert = "INSERT INTO job_result (sites_ID, node_ID, site_loaded_files, site_loading_time) ";
sqlInsert += "VALUES ((SELECT ID from sites WHERE site_name='" + site + "'), ";
sqlInsert += " (SELECT ID from nodes WHERE node_name='" + node + "'),";
sqlInsert += gets + "," + time + ")";
var connection.query(sqlInsert, function(err, result) {
if (err) throw err;
connection.end();
// ?? return result.insertId);
// callback ??
}// , callback ??)
}
myInsertid = insertJob("google.com","node01",1000,20);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment