Make sure to always escape table and column names properly

Always put `...` around the names of tables, columns and other objects
to avoid errors when the user creates objects with the name of key
words.
This commit is contained in:
Martin Kleusberg
2013-01-05 15:31:42 +01:00
parent 2201ff3234
commit bed67cd970
6 changed files with 14 additions and 40 deletions

View File

@@ -605,7 +605,7 @@ void MainWindow::deleteObject()
QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) == QMessageBox::Yes)
{
// Delete the table
QString statement = QString("DROP %1 %2;").arg(type.toUpper()).arg(table);
QString statement = QString("DROP %1 `%2`;").arg(type.toUpper()).arg(table);
if(!db.executeSQL( statement))
{
QString error = QString("Error: could not delete the %1. Message from database engine:\n%2").arg(type).arg(db.lastErrorMessage);