create table sql command node.js failing

I have this create table function, that creates a table when necessary, but the actual creation of the table is failing. It only fails when there is a special character in there, which is annoying! Is there a way around this? This is my query:

 var createNewReportTableForChild = "create table " + tableName + " (report1 varchar(256), report2 varchar(256), report3 varchar(256), report4 varchar(256), report5 varchar(256), report6 varchar(256), report7 varchar(256), report8 varchar(256), report9 varchar(256), report10 varchar(256))"
ibmdb.open(ibmdbconnMaster, function(err, conn) {
    if (err) return console.log(err);
    conn.query(createNewReportTableForChild, function(err, rows) {
        if (err) {
            console.log(err);
        }

        // res.render("admin-dashboard", {
        //     page_title: "viewStudents",
        //     userName: req.session.username,
        //     FN: req.session.firstname,
        //     LN: req.session.lastname,
        // });
        res.redirect('/admin-dashboard')

        conn.close(function() {
            console.log("closed the function /createNewReportsTableForChild");
        });
    });
});

The variable tableName looks like this: info@inderatech.com. It'll always be an email address. Should I just make it a unique string of numbers?



from Recent Questions - Stack Overflow https://ift.tt/3fpj9cM
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)