Thanks Derrell, I only need the ROWIDs for the duration of a user edit, and I won't be doing a VACUUM while that is happening, so this sounds exactly what I need. When I first populate the GUI grid I will make a separate array of ROWID's, and these will be in the same order as the rows in the grid. I can then index into this array and do a SELECT based on that ROWID.
Problem solved. Thanks a lot, guys. Sholto His Nerdship Pty Ltd Derrell Lipman wrote: > > On Thu, Feb 19, 2009 at 10:45 PM, His Nerdship > <slgdoug...@optusnet.com.au>wrote: > >> >> Thank you Thomas, that was most helpful. >> I have just found the ROWID information >> (http://sqlite.org/lang_createtable.html#rowid) - this is what I was >> looking >> for! You have to know something exists before you can look for it.... >> I take it this value will not change, even if the contents of its row >> change? >> > > Be careful. Yes, that value *can* change if you depend on the implicit > ROWID. Specifically, if you delete rows and then VACUUM the rows will be > renumbered. You can avoid that with: > >> >> I can create my own INTEGER PRIMARY KEY column, which becomes an alias >> for >> the ROWID, but is there a way I can get the 'original' (I don't want to >> add >> a column at this stage)? > > > If you use your own INTEGER PRIMARY KEY then it becomes the ROWID and it > will not change upon vacuum. > >> >> If I call sqlite3_get_table(), it returns that ***result array (I'm using >> C++), but AFAIK that doesn't contain the ROWID. >> > > Just request it explicitly: > > SELECT ROWID, * FROM table_name; > > Derrell > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22114498.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users