Skip to content

Commit

Permalink
Fix primary key names not being escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed May 27, 2016
1 parent 6622022 commit 7e0adab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sqlitetypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ QString Table::sql() const
{
if(f->primaryKey())
{
pk += f->name() + ",";
pk += escapeIdentifier(f->name()) + ",";
pks_found = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/tests/testsqlobjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void TestTable::sqlOutput()
"\t`id`\tinteger,\n"
"\t`car`\ttext,\n"
"\t`km`\tinteger CHECK(km > 1000),\n"
"\tPRIMARY KEY(id,km)\n"
"\tPRIMARY KEY(`id`,`km`)\n"
");"));
}

Expand Down Expand Up @@ -156,7 +156,7 @@ void TestTable::parseSQLMultiPk()
"\tid1 integer,\n"
"\tid2 integer,\n"
"\tnonpkfield blob,\n"
"PRIMARY KEY(id1,id2)\n"
"PRIMARY KEY(`id1`,`id2`)\n"
");";

Table tab = Table::parseSQL(sSQL).first;
Expand Down Expand Up @@ -219,7 +219,7 @@ void TestTable::parseNonASCIIChars()
{
QString sSQL = "CREATE TABLE `lösung` ("
"`Fieldöäüß` INTEGER,"
"PRIMARY KEY(Fieldöäüß)"
"PRIMARY KEY(`Fieldöäüß`)"
");";

Table tab = Table::parseSQL(sSQL).first;
Expand Down

0 comments on commit 7e0adab

Please sign in to comment.