[prev in list] [next in list] [prev in thread] [next in thread]
List: sapdb-general
Subject: Simple increment in function executes twice?
From: "Christian Ullrich" <chris () chrullrich ! de>
Date: 2006-07-13 14:04:13
Message-ID: xn0eoohvq2aut5000 () news ! gmane ! org
[Download RAW message or body]
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=sapdb-general@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic