For the code below how can I get the full query Like
INSERT INTO TABLE(.........) VALUES(........);
I can create the function to create command but it would look bad So Is there way of getting the query used here
I have used mysql2/promise
let command = "INSERT INTO users(joined,name,username,profile,DOB,facebookLink,twitterLink,instagramLink,interests,bio) VALUES (?) ;";
try {
let userPosted = await (await connection).query(command, userArr);
if (userPosted[0].affectedRows === 0) {
return errors.request.NOT_FOUND;
}
} catch (err) {
console.log(command);
console.log(err);
return false;
}
/*
Suppose for small command like
let command1 = "INSERT INTO tableA(a,b) VALUES(?);
let tableposted = await (await connection).query(command, [1,2]);
Here I want to get the command used in upper query ↑↑↑↑↑↑
Like INSERT INTO tableA(a,b) VALUES(1,2);
*/