Is this a legit way to create a new table in existing database, binding the name of the table?
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
string dbName = login;
dbName.append(".db");
if(!db.open())
{
qDebug() << db.lastError();
qFatal("Failed to connect");
}
qDebug("Connected");
QSqlQuery query(db);
query.prepare("CREATE TABLE :table (:value text NOT NULL);");
tableName.append("Top");
query.bindValue(":table" , QString::fromStdString(tableName));
query.bindValue(":value" , QString::fromStdString(criterion));
query.exec();
qDebug() << db.lastError();
I am not getting any errors, though the table is not being created. I would really appreciate your help.