【问题标题】:Access rowid in SQLite table which contains columns named 'rowid', '_rowid_', and 'oid'访问 SQLite 表中的 rowid,其中包含名为“rowid”、“_rowid_”和“oid”的列
【发布时间】:2017-03-27 11:33:15
【问题描述】:

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 值? (当然,这样的表设计得很糟糕,但我正在编写一个通用实用程序,因此“更改架构”不是答案。)

【问题讨论】:

    标签: sqlite


    【解决方案1】:

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

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

    (别忘了正确处理WITHOUT ROWID 表。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-25
      • 2015-03-20
      • 2016-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多