访问SQLite表中的rowid,其中包含名为' rowid',' _rowid _'和' oid'

时间:2017-03-27 11:33:16

标签: sqlite

  

The rowid value can be accessed using one of the special case-independent names "rowid", "oid", or "_rowid_" in place of a column name. If a table contains a user defined column named "rowid", "oid" or "_rowid_", then that name always refers the explicitly declared column and cannot be used to retrieve the integer rowid value.

如果一个表包含所有这些列(并且没有一个是INTEGER PRIMARY KEY),有没有办法引用rowid值? (当然,这样的表格设计得非常糟糕,但是我正在编写一个通用实用程序,因此"更改架构"不是答案。)

1 个答案:

答案 0 :(得分:1)

如果已经采用了所有特殊名称,并且没有INTEGER PRIMARY KEY来创建新名称,那么根本不可能引用rowid值。

(只有当有人想打破它时,你的程序才会遇到这样的表格,所以给他们想要的东西,让你的程序以最壮观的方式崩溃。)

(并且不要忘记正确处理WITHOUT ROWID个表格。)

相关问题