Fix issues because of using " quotes for identifiers in SQLite driver
Use the [...] notation instead. BUG:376052 Details: From https://www.sqlite.org/lang_keywords.html: RULE[*] "If a keyword in double quotes (ex: "key" or "glob") is used in a context where it cannot be resolved to an identifier but where a string literal is allowed, then the token is understood to be a string literal instead of an identifier." So for table T(A TEXT) this query works: SELECT * FROM T WHERE "A1"='A1'; And it even returns all rows of T. Expected: "identifier not found" error at SQLite level. Notes: Kexi parses the KDbSQL query supplied by the user so there's no issue in the Query Designer's SQL editor. But APIs such as KDb::deleteRecords() use the native queries through calls such as KDbConnection::executeVoidSQL("DELETE FROM %1 WHERE %2=%3"). Solution: Instead of using " quotes for identifiers, use []. This way the RULE[*] will not be applied. This is a global solution for the SQLite driver so altering the SQL commands constructed internally is not needed if they are use KDbConnection::escapeIdentifier().
Showing
- src/KDbDriver.cpp 6 additions, 4 deletionssrc/KDbDriver.cpp
- src/KDbDriver.h 2 additions, 1 deletionsrc/KDbDriver.h
- src/KDbDriverBehavior.h 7 additions, 2 deletionssrc/KDbDriverBehavior.h
- src/KDbDriver_p.cpp 2 additions, 1 deletionsrc/KDbDriver_p.cpp
- src/drivers/mysql/MysqlDriver.cpp 2 additions, 1 deletionsrc/drivers/mysql/MysqlDriver.cpp
- src/drivers/postgresql/PostgresqlDriver.cpp 2 additions, 1 deletionsrc/drivers/postgresql/PostgresqlDriver.cpp
- src/drivers/sqlite/SqliteDriver.cpp 2 additions, 1 deletionsrc/drivers/sqlite/SqliteDriver.cpp
- src/drivers/sybase/SybaseDriver.cpp 2 additions, 1 deletionsrc/drivers/sybase/SybaseDriver.cpp
- src/drivers/xbase/XbaseDriver.cpp 2 additions, 1 deletionsrc/drivers/xbase/XbaseDriver.cpp
Loading
Please register or sign in to comment