On 12 Jan 2011, at 7:31pm, Max Vlasov wrote:

> for queries like UPDATE ... WHERE rowid=... one can in most cases reread the
> record (based on the rowid) and keep for example the cursor in the grid at
> the same record. But what if one of changed field is aliased to rowid, is
> there a way to find/track the changed record? In other words, how to find
> out the new rowid value for this record

Are you writing a real application here, or some sort of arbitrary SQLite 
management utility ?

In real life -- and real applications -- you never let anyone change rowids.  
In fact users should never even see rowids: they're purely for the convenience 
of the programmer.  If there's some record number (e.g. customer number) users 
are aware of and might want to change, it's not a good candidate for a rowid 
alias precisely because users might want to change it and this would require a 
ripple-effect change in related records in other tables.  Use two different 
columns: recordID and customerID, and keep the recordID (which can be a rowid 
alias) hidden from the user.

If you're writing an arbitrary SQL utility, I think the answer depends on why 
you want to keep track of a particular record.  You either want to refresh the 
display or you don't, and either way the connection between old and new rowids 
doesn't matter because you're going to have to redraw more than one record.

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

Reply via email to