Hello guys, I hope you are going well!
Before anything, sorry about my english. lol
My question is, I have a Users table, in that table there's about 200k users and I also have a file with the same registers that before I used "load data" to populate the table.
Now I need to compare this Users table with a temporary "Users" table, where I will update just the differences betweem both, or insert the new ones, etc...
What I'm afraid is the execution time for this updates. I'm using mysql, what is better, a script that updates one by one? a procedure will works fine with 200k vs 240k?
Could you guys can suggest something?
Thank you!
This is my model.js
module.exports.getUser = userId => {
const sql = {
sql: "SELECT * from user where user_id=?"
};
const sqlParams = [userId];
connection.query(sql, sqlParams, (error, results, fields) => {
// Handle error after the release.
if (error) throw error;
console.log(results);
return results;
});
};
this is my service.js
module.exports.getUser = () => {
let user = User.getUser(1);
console.log(user);
return user;
};
But in my service.js file its coming as undefined but in model.js (inside the callback) its printing the results correctly.
how can i pass this results back to the calling method in service.js