On May 27, 2008, at 12:50 PM, Nicolas Williams wrote:

> On Mon, May 26, 2008 at 11:20:27AM -0400, D. Richard Hipp wrote:
>> SQLite already allows three different names for the rowid:  "rowid",
>> "oid", "_rowid_".  If all three names are taken, for example if the
>> user has a table like this:
>>
>>       CREATE TABLE badidea(
>>          rowid TEXT,
>>          oid TEXT,
>>          _rowid_ TEXT
>>      );
>>
>> Then you cannot access the rowid.  It just cannot be done.  But how
>> often does that happen really?  If it does happen, then perhaps
>> SQLiteSpy could pop up a dialog box saying that it cannot display the
>> content of the table and explaining why not.
>
> I agree.  BUT, if there's also an INTEGER PRIMARY KEY column, then  
> there
> should be an API by which to find out what that column's name is for a
> given table.

PRAGMA table_info(tablename);

In the output of this pragma if there is only a single column with the  
"pk" set to 1 and if the "type" of that column is "integer", then that  
column is your integer primary key.

D. Richard Hipp
[EMAIL PROTECTED]



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to