3

According to SQLite documentation, All tables have rowid by default, and it cannot be removed. And this rowid can be accessed with rowid, oid or _rowid_.

Anyway database users can add the new column with the names freely, and the columns will be hidden. The only way to access rowid is making a new column with INTEGER PRIMARY KEY.

This is my current understanding. And with this, I have no reliable way to get the rowid if user hide all the columns and user didn't make any PK column. I have thought about adding temporary PK column, but this is unreliable too. If this is true, this doesn't make sense. Because the data is always available, and I just cannot access because there's no appropriate interface.

So I think there should be a way to access this data reliably. But I couldn't find anything with C API. Can I have some guidance for this?

Brian Roach
  • 76,169
  • 12
  • 136
  • 161
eonil
  • 83,476
  • 81
  • 317
  • 516
  • 4
    Considering how bad practice shadowing "special" database columns, I'd say the chances of someone doing so for all three of those are be slim to none. What you could do as a workaround is check if the table has all three columns hidden, and throw a clear error message to the user saying that he broke your code if so. – millimoose Jan 23 '12 at 03:19
  • @Inerdial Oh nice. I think the solution would be best if there's no way to access rowid directly :) – eonil Jan 23 '12 at 04:27

0 Answers0