From: Alex P. <pes...@ma...> - 2010-12-27 09:59:26
|
On 12/26/10 11:54, Roman Rokytskyy wrote: >> I'd much prefer something like LAST_GEN_ID(<name>). Oracle has >> <name>.curval, so it's like something a database-portable application >> would be capable to use. > Issue is that if you port PHP code that uses AUTO_INCREMENT feature, > there is no name for the generator available in the context. If I knew > which column was incremented, I would use RETURNING clause. But that's > not the case. > > Joomla has a function to insert an object, which generates an INSERT > statement, and then if PK column is specified, generated value is filled > in the object. Then there is another function that takes the INSERT > statement and executes it, and then another function to get the > generated values. > Roman, what if table in that insert has after insert trigger which also inserts records in more tables? I suppose that last_gen_id() with no name parameter will return you that value. Is it what people expect from that Joomla's function? If we anyway talk about SQL extension - what if we add RETURNING PRIMARY KEY? Suppose this can be useful in many cases. |