[Kexi-devel] drv_lastInsertRowID()

Jaroslaw Staniek js at iidea.pl
Fri Aug 8 17:18:11 CEST 2008


Hîthwen Fëadûr said the following, On 2008-08-08 16:01:
>> We need to be able to accurately identify the row we've just inserted. How
>> does Oracle solve this? If we know, we can add appropriate support.
>>
> 
> Here is an extract from oracle website:
> 
> "What is your definition of the "last record"? If it is the last record
> inserted, there is no way to get that unless you have some field you
> maintain to allow you to find the last record inserted."
> 
> 
> So Oracle doesnt solve this, Oracle thinks you are supposed to know what
> have just inserted.
> My partner, Migue has been experimenting with timestamps. When you insert
> something on a table a trigger he'd created saves on an auxiliary table its
> rowid and the timestamp, then you can ask for the newest timestamp to get
> the corresponding rowid (which can be put into a QVariant) the problem is we
> would need to create a trigger like this for every single table you create.
> 
> Other option could be adding a timestamp column to every table.

Rowid usage in Kexi is about using autonumbers.
So couldn't you look at sequences? Set up a sequence and get it's value, then
insert the new row. This is atomic, and of course is already done e.g. in
sqlite, just implicitly.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)





More information about the Kexi-devel mailing list