-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A developer asks a SQLite statement, "What is the column name at this index?" It responds: "id." "But SQLite," she asks, "I'm joining another table which also has a column name 'id.' What is the table name at this index?" It responds: "Undefined symbols for architecture." The world crumbles under the developer's feet. -- SQLite doesn't preserve column metadata unless compiled with SQLITE_ENABLE_COLUMN_METADATA, and it isn't, by default, so we can't rely on it. So for every column of a result set, we only have the column name to work with. We can't trick SQLite by being explicit: if we namespace a column ("SELECT table.column") doesn't preserve the namespace in the result set, and neither does aliasing ("table.column AS unambiguous_column"). I guess we'll need to manage the logic ourselves: 1. If a Query calls select with specific column names, honor the namespacing or lack thereof explicitly. 2. If a Query calls select with a namespaced star, honor the namespacing while expanding the columns. 3. If a Query joins another table and the select is the default, *, namespace all expanded columns. 4. If a Query does not join another table, do not namespace expanded columns. I think the third point may be problematic without proper error handling, but otherwise think the interface is intuitive enough. This commit removes the Statement.values dictionary, as it cannot return all data in a result set with ambiguous column names. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
- Loading branch information
1 parent
b1f7105
commit 7fa9a57
Showing
4 changed files
with
57 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters