CurtTilmes / raku-dbsqlite

SQLite access for Raku
10 stars 4 forks source link

sqlite3 column names "oid" and "_rowid_" are not returned in a results hash #6

Open tbrowder opened 5 years ago

tbrowder commented 5 years ago

Quoting from the SQLIte docs:

Except for WITHOUT ROWID tables, all rows within SQLite tables have a 64-bit signed
integer key that uniquely identifies the row within its table. This integer is usually
called the "rowid". The rowid value can be accessed using one of the special
case-independent names "rowid", "oid", or "_rowid_" in place of a column name. 

DB::SQLite does recognize "oid" or "_rowid_" in a select query, but neither shows up as a hash key when used. Only the %hash\<rowid> key is recognized regardless of the column name used in the select query.

CurtTilmes commented 5 years ago

That's just the way SQLite works -- 'oid' and _rowid_ are just aliases to access the 'rowid' with is named 'rowid' by default.

You can do "select oid as oid, blah from foo" and it will use the name you specified.

tbrowder commented 5 years ago

Isn't that worth mentioning in the README.md? I would propose something, but your writing is so tight and well-structured I wouldn't dare!