touchlab / SQLiter

Minimal multiplatform sqlite library
https://touchlab.co
177 stars 35 forks source link

Fix when SELECT columns those have same name in JOIN statement #89

Closed qiaoyuang closed 12 months ago

qiaoyuang commented 1 year ago

If we execute a JOIN (cross join or join with a ON clause) SQL statement:

SELECT person.name, student.name, age, specialized FROM person CROSS JOIN student;

We will get two columns those named "name". Now in NativeCursor, the index of second "name" will replace index of first "name" in columnNames, and users can never get the index of first "name" in columnNames. So, I provide a solution that if columnNames contains the "name", the second "name" will be rename to "name&JOIN1", and If we have three "name", the third will be named to "name&JOIN2", etc..