On Sun, 2004-11-07 at 17:21, John Hansen wrote:
Hi list,
attached, cvs context diff that adds currval_isset('sequence_name');
With this patch, I can now call currval_isset to determine if I need to
call currval. Previously, I just called currval, but with the result of
filling up the
John Hansen [EMAIL PROTECTED] writes:
attached, cvs context diff that adds currval_isset('sequence_name');
This avoids the warning messages you get when calling currval before
nextval in situations where the program flow does not allow you to
predetermine if the current session has called
This might do what you're looking for on 8.0.
CREATE OR REPLACE FUNCTION currval_isset(text) RETURNS bigint AS '
DECLARE
var integer;
BEGIN
SELECT currval($1) INTO var;
RETURN var;
EXCEPTION
WHENOBJECT_NOT_IN_PREREQUISITE_STATE THEN
RETURN 0;
END;
' LANGUAGE
I would argue that a program written that way is broken by definition,
and we should not encourage programmers to write broken applications.
Hmmm, is mysql's last_insert_id behaviour really that much to ask
for?
This is basically what I'm trying to emulate, to make porting mysql
Hmmm, is mysql's last_insert_id behaviour really that much to ask
for?
Come to think of it, maybe the attached last_insert_id() patch is a
better option. Actually copying the behaviour of mysql's counterpart.
... John
Index: doc/src/sgml/func.sgml
Hi list,
attached, cvs context diff that adds currval_isset('sequence_name');
Updated patch attached, didn't think to update the docs. Thanks oicu!
Kind Regards,
John Hansen
Index: doc/src/sgml/func.sgml
===
RCS file: