Subject Re: [firebird-php] SPs Docs
Author Milan Babuskov
Nigel Weeks wrote:
> Yes, normal usage is a single transaction, but it's not always the case.
>
> The other problem is that the 'Firebird Elite' have frowned upon

Interesting.

> the practice of using a 'Selectable Procedure' to do both:
> A DML operation (Insert/Update/Delete), and
> A return of a record set(via the suspend)
>
> Sure, it's possible, and I like using Procs in this way A LOT!!, but I've
> heard
> it's just not the right way to do it...

I don't see why would it be The Right Way (TM) or not. I don't use it A
LOT, but there are situations where I want something to be atomic (for
example looging each call to some selectable procedure) and error-prone
when done from application (someone selecting from the same procedure
from SQL editor without having it logged).

> Summary of Challenge: Insert a row, and return the new generator-seeded ID
> in ONE COMMAND/ONE QUERY from PHP, without using a selectable stored
> procedure to do it...

It just can't be done (at least in current FB versions). You need either
selectable stored procedure or a select to return *anything*. Selectable
SP is out of the question. To insert records you need DML-SP which
cannot be selected from or joined with a table, so you can't go with
select either.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org