row locked, errd[3] = 1
Posted in 1995
A coworker enlisted my help this afternoon, but I was as puzzled as she by what happened. She has a 4gl program that deletes a row from one table, and if the deletion is successful calls one of 2 very similar functions to update another table. One of the functions is in the same module as the calling function, and the other function is in another module. The problem occurs when the table to be updated is locked. If SQLCA.SQLERRD[3] = 0 then she rolled back the work. The database is not ANSI, so SQLCA.SQLCODE = 0 if no row is found. She locked the table, tried it, and the function in the other module did not roll back the work (the function in the same module as the calling function did roll back work). The same behavior is exhibited whether she runs it as compiled C or through the debugger. When she runs it through the debugger, she sees that the SQLCA.SQLCODE = -246 (I think--she showed me at work 5 hours ago, and I'm just now getting around to asking) as expected, and the "same module" function shows SQLCA.SQLERRD[3] = 0 as expected, but the other function shows 1 row updated, even though it hasn't been updated. I suggested that she change the line that currently reads: IF SQLCA.SQLERRD[3] = 0 THEN LET rollbackflag = 2 END IF to: IF SQLCA.SQLERRD[3] = 0 OR SQLCA.SQLCODE != 0 THEN LET rollbackflag = 2 END IF This should work, but she is concerned that she may have the same problem elsewhere, since she has always used SQLCA.SQLERRD[3] to determine whether a row has been updated. I couldn't see anything obviously different between the two sections that did the updating, other than that they were in different modules (there were other differences, but not in the update statement). Does anybody have any clues? BTW: 4gl ver:4.10.UE2 engine:5.01.UD3 Thanks in advance Brian --- ~ SPEED 1.40 [NR] ~