QSqlQuery fails to execute "drop database xyz" query
-
Suppose, i start my app and connect to the database as root user. Now i create a database:
@QSqlQuery query("create database "+ui->create_db->text());
ui->choose_db->clear();
QSqlQuery squery("show databases"); // listing all databases
squery.next();
while (squery.next())
{
ui->choose_db->addItem(squery.value(0).toString()); // storing the list of all databases
}@Now, if i drop the previously created database, it works fine:
@QSqlQuery query("drop database "+ui->create_db->text());
ui->choose_db->clear();
QSqlQuery squery("show databases"); // listing all databases
squery.next();
while (squery.next())
{
ui->choose_db->addItem(squery.value(0).toString()); // storing the list of all databases
}@But, only those databases can be droped which are created during the session. i.e, if i close the app and start again and try to delete the database created in previous session, it simply fails, no effect
-
No reply so far, is this a bug!
-
What error they gives with lastError() ? Worked fine for me in 4.8