  | | | Simple increment in function executes twice? | Simple increment in function executes twice? 2006-07-13 - By Christian Ullrich
Back I have this definition (in 7.6.0.27, reduced to the bare minimum):
CREATE TABLE dba.testtable (id INTEGER PRIMARY KEY, test INTEGER) // INSERT INTO dba.testtable VALUES (1, 1) // CREATE FUNCTION dba.testfunc RETURNS INTEGER AS VAR i INTEGER; UPDATE dba.testtable SET test = test + 1 WHERE id = 1; SELECT test INTO :i FROM dba.testtable WHERE id = 1; RETURN i; // CREATE DBPROC dba.testproc(IN id INTEGER, OUT result INTEGER) AS UPDATE dba.testtable SET test = test + 1 WHERE id = 1; SELECT test INTO :result FROM dba.testtable WHERE id = 1; RETURN;
Looks very nice and foolproof.
Except it's run between one and three times, depending on how I call it:
- dba.testproc from python: Runs 1 time. - dba.testfunc from SQL Studio: Runs 2 times. - dba.testfunc from python: Runs 3 times.
The python bug in the last case looks to me to be the combination of what SQL Studio does and the same bug that causes sequences to increase by 2 when .NEXTVAL is queried, but the other two results I can't explain at all.
-- Christian Ullrich
-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/maxdb?unsub=mysql@(protected)
|
|
 |