Bug 364810 - Error while inserting rows into table with schema containing reserved words
Summary: Error while inserting rows into table with schema containing reserved words
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: KexiDB (show other bugs)
Version: 2.9.11
Platform: Other Linux
: NOR normal
Target Milestone: 3.0
Assignee: Jarosław Staniek
URL: https://forum.kde.org/viewtopic.php?f...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-27 12:03 UTC by Jarosław Staniek
Modified: 2016-10-31 22:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0
Sentry Crash Report:


Attachments
Test file that fails (80.00 KB, application/x-kexiproject-sqlite2)
2016-06-27 12:15 UTC, Jarosław Staniek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jarosław Staniek 2016-06-27 12:03:13 UTC
Error while inserting rows into table with schema containing reserved words, e.g. table name == "table" or field name "from". 

Solution: escape identifiers in any place where necessary. 


Reproducible: Always

Steps to Reproduce:
1. Create table such as "CREATE TABLE "TABLE" ("FROM" INTEGER)
2. Go to the data view and try to insert one record


Actual Results:  
"Record inserting failed"



In fact records get inserted but retrieving autoincremented values fails.
Comment 1 Jarosław Staniek 2016-06-27 12:15:12 UTC
Created attachment 99722 [details]
Test file that fails

Try to insert records into "table" and "index" tables.
Comment 2 Jarosław Staniek 2016-06-27 12:35:10 UTC
Git commit 69b8f18d4b1102fed1d06de07f6d1c953e00e617 by Jaroslaw Staniek.
Committed on 27/06/2016 at 12:20.
Pushed by staniek into branch 'calligra/2.9'.

CalligraDB: Connection::lastInsertedAutoIncValue: escape <table> and <name> in "SELECT <table>.<name> FROM <table>"

M  +2    -1    libs/db/connection.cpp

http://commits.kde.org/calligra/69b8f18d4b1102fed1d06de07f6d1c953e00e617
Comment 3 Jarosław Staniek 2016-07-03 00:22:15 UTC
Git commit 729e2937e426bb9b715f0152aed66b5b11d2676a by Jaroslaw Staniek.
Committed on 03/07/2016 at 00:12.
Pushed by staniek into branch 'escape-sequences-staniek'.

KDbConnection::lastInsertedAutoIncValue: escape <table> and <name> in "SELECT <table>.<name> FROM <table>"

>From calligra.git 69b8f18d4b1102fe

M  +3    -2    src/KDbConnection.cpp

http://commits.kde.org/kdb/729e2937e426bb9b715f0152aed66b5b11d2676a
Comment 4 Jarosław Staniek 2016-07-18 08:28:00 UTC
Git commit c7111e0cf2335ac24bccd249284cfd1116bf2a1b by Jaroslaw Staniek.
Committed on 18/07/2016 at 07:57.
Pushed by staniek into branch 'master'.

KDbConnection::lastInsertedAutoIncValue: escape <table> and <name> in "SELECT <table>.<name> FROM <table>"

>From calligra.git 69b8f18d4b1102fe

M  +3    -2    src/KDbConnection.cpp

http://commits.kde.org/kdb/c7111e0cf2335ac24bccd249284cfd1116bf2a1b