aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
commit6d3d39356473078c6b47e03b8a7616e4b34de928 (patch)
treefe5be2e6a08e4cfc73207746aba4c9fccfecfa10 /SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp
parentf98e49169a40876bcf1df832de6e908d1b350193 (diff)
parentfeda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff)
Update upstream source from tag 'upstream/3.2.1+dfsg1'
Update to upstream version '3.2.1+dfsg1' with Debian dir 5ea0333565de4dc898c062cc0ff4ba1153e2c1e4
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp b/SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp
index 9322117..5759f76 100644
--- a/SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp
+++ b/SQLiteStudio3/guiSQLiteStudio/constraints/columndefaultpanel.cpp
@@ -61,9 +61,9 @@ bool ColumnDefaultPanel::validate()
if (exprOk)
{
// Everything looks fine, so lets do the final check - if the value is considered constant by SQLite.
- static QString tempDdlLiteralTpl = QStringLiteral("CREATE TABLE temp.%1 (col DEFAULT %2);");
- static QString tempDdlExprTpl = QStringLiteral("CREATE TABLE temp.%1 (col DEFAULT (%2));");
- static QString dropTempDdl = QStringLiteral("DROP TABLE IF EXISTS temp.%1;");
+ static QString tempDdlLiteralTpl = QStringLiteral("CREATE TEMP TABLE %1 (col DEFAULT %2);");
+ static QString tempDdlExprTpl = QStringLiteral("CREATE TEMP TABLE %1 (col DEFAULT (%2));");
+ static QString dropTempDdl = QStringLiteral("DROP TABLE %1;");
QString tableName = getTempTable();
QString tempDdl = tempDdlExprTpl.arg(tableName, ui->exprEdit->toPlainText());
@@ -75,7 +75,8 @@ bool ColumnDefaultPanel::validate()
if (res->isError())
{
exprOk = false;
- exprError = tr("Invalid default value expression: %1").arg(res->getErrorText());
+ exprError = tr("Invalid default value expression: %1. If you want to use simple string as value, remember to surround it with quote characters.")
+ .arg(res->getErrorText());
}
else
currentMode = Mode::LITERAL;
@@ -84,7 +85,8 @@ bool ColumnDefaultPanel::validate()
currentMode = Mode::EXPR;
db->exec(dropTempDdl.arg(tableName));
- }
+ } else
+ exprError = tr("Invalid default value expression. If you want to use simple string as value, remember to surround it with quote characters.");
setValidState(ui->exprEdit, exprOk, exprError);
setValidState(ui->namedEdit, nameOk, tr("Enter a name of the constraint."));
@@ -269,7 +271,7 @@ void ColumnDefaultPanel::updateVirtualSql()
QString ColumnDefaultPanel::getTempTable()
{
SchemaResolver resolver(db);
- return resolver.getUniqueName("temp", "sqlitestudio_temp_table");
+ return resolver.getUniqueName("sqlitestudio_temp_table");
}
void ColumnDefaultPanel::updateState()