Skip to content

Commit b841025

Browse files
committed
tests: Add test to check escaping quotes by using two of them
1 parent c29702a commit b841025

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/tests/testsqlobjects.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ void TestTable::parseNonASCIIChars()
213213
QVERIFY(tab.fields().at(0)->name() == "Fieldöäüß");
214214
}
215215

216+
void TestTable::parseSQLEscapedQuotes()
217+
{
218+
QString sSql = "CREATE TABLE double_quotes(a text default 'a''a');";
219+
220+
Table tab = Table::parseSQL(sSql).first;
221+
222+
QCOMPARE(tab.name(), QString("double_quotes"));
223+
QCOMPARE(tab.fields().at(0)->name(), QString("a"));
224+
QCOMPARE(tab.fields().at(0)->defaultValue(), QString("a''a"));
225+
}
226+
216227
void TestTable::createTableWithIn()
217228
{
218229
QString sSQL = "CREATE TABLE not_working("

src/tests/testsqlobjects.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ private slots:
2020
void parseSQLKeywordInIdentifier();
2121
void parseSQLWithoutRowid();
2222
void parseNonASCIIChars();
23+
void parseSQLEscapedQuotes();
2324
void createTableWithIn();
2425
void createTableWithNotLikeConstraint();
2526
};

0 commit comments

Comments
 (0)