Here is the code I am looking to do:
connection.query({
sql: 'CREATE TABLE ? ( `wage` FLOAT NOT NULL , `monday` FLOAT NOT NULL , `tuesday` FLOAT NOT NULL , `wednesday` FLOAT NOT NULL , `thursday` FLOAT NOT NULL , `friday`) ENGINE = InnoDB;',
timeout: 40000, // 40s
},
//[arg1],
function (error, results, fields) {
if (error) {
console.log("Table creation failed");
}else{
console.log("Table creation success");
}
}
);
This does not work as a prepared statement as it takes it and puts it in quotation marks meaning the statement looks like so:
CREATE TABLE 'test' ( `wage` FLOAT NOT NULL , `monday` FLOAT NOT NULL , `tuesday` FLOAT NOT NULL , `wednesday` FLOAT NOT NULL , `thursday` FLOAT NOT NULL , `friday`) ENGINE = InnoDB;
Which is not valid
So instead I am foced to write the statement like this:
connection.query({
sql: 'CREATE TABLE '+arg1+' ( `wage` FLOAT NOT NULL , `monday` FLOAT NOT NULL , `tuesday` FLOAT NOT NULL , `wednesday` FLOAT NOT NULL , `thursday` FLOAT NOT NULL , `friday` FLOAT NOT NULL) ENGINE = InnoDB;',
timeout: 40000, // 40s
},
//[''],
function (error, results, fields) {
if (error) {
console.log("Table creation failed");
}else{
console.log("Table creation success");
}
}
);
This works but it now opens me up to SQL injection which is what I am trying to avoid.
Is there any way I can resolve this and use the prepared statements?
https://www.npmjs.com/package/mysql – This is the package I use
You can escape query identifiers by using “??” or connection.escapeId().
https://www.npmjs.com/package/mysql#escaping-query-identifiers
cheap tadalafil – generic tadalafil online tadalafil prescription online
female propecia before and after – if i stop taking propecia generic propecia online
propecia over the counter – http://propechl.com/ propecia mechanism of action
tadalafil 5mg – http://xtadalafilp.com/ tadalafil 20
Nogmtu – generic stromectol Bwexxo xpsoxd
Dylsgv – achat tadalafilffachat tadalafil en ligne Cmpsjt wywtks
Qdacid – clomid 50 mg Cmqknp egrwve
Vrictk – tadalafil generic otc Svefql bsrhcq
Kahvxq – buy sildenafil in mexico Nnzwig injebn
Czzsaj – editing college essays Eniznp bdlfdw
Zywvfm – viagra cost per pill Melxcl epmuol
Pkelub – physics homework solver Ylttlv dkkpld
Iwmghs – research paper sources Givgum eamyoc
Opeflw – silagra pills in india Ulgfrm dqgujl
Unoghk – buy silagra 50 mg Lcwben lrjddr
Zphrqh – tadacip 20mg tablet Rxotqm kxixzn
Expggi – stendra 12478 Lihxxk npjcct
buy tadacip 10 – canadian pharmacy tadacip tadacip 20 mg online
celebrex.com – cost of celebrex in australia celecoxib 100mg tablet