From 05c8a153ba10c04eacb8433d1cf55daae72918a5 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Thu, 16 Oct 2014 16:38:10 +0200 Subject: [PATCH] EditTableDialog: Make it possible again to delete default value Commit c29702a1b97e6fcc30651973591b7b565746a90d fixed the handling of default values and added a check to enforce quote characters when they are needed. This check wasn't prepare for empty default values (i.e. no default value) and would add quote characters in this case, too. This is fixed by this commit. See issue #133. --- src/EditTableDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditTableDialog.cpp b/src/EditTableDialog.cpp index 5118a2f7..5f4f9c16 100644 --- a/src/EditTableDialog.cpp +++ b/src/EditTableDialog.cpp @@ -338,7 +338,7 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column) QString new_value = item->text(column); // If the default value isn't a SQL keyword perform an extra check: If it isn't numeric but doesn't start and end with quotes, // add the quotes - if(new_value.compare("null", Qt::CaseInsensitive) && + if(new_value.size() && new_value.compare("null", Qt::CaseInsensitive) && new_value.compare("current_time", Qt::CaseInsensitive) && new_value.compare("current_date", Qt::CaseInsensitive) && new_value.compare("current_timestamp", Qt::CaseInsensitive))