Good thing we use a transaction...
-
Ok, I come across stuff like this daily...but this one was the most recent
CREATE PROC foo BEGIN TRANSACTION SELECT @id = id FROM ... IF @id IS NOT NULL BEGIN ...do some stuff, there is NO ROLLBACK in here or error checking... COMMIT END else ROLLBACK
It's just so...useless. We only ever rollback if we didn't do anything? -
Ok, I come across stuff like this daily...but this one was the most recent
CREATE PROC foo BEGIN TRANSACTION SELECT @id = id FROM ... IF @id IS NOT NULL BEGIN ...do some stuff, there is NO ROLLBACK in here or error checking... COMMIT END else ROLLBACK
It's just so...useless. We only ever rollback if we didn't do anything?That makes the ROLLBACK extremely fast. ;P
Chris Meech I am Canadian. [heard in a local bar] Stercorum pro cerebro habes. [Cicero]
-
Ok, I come across stuff like this daily...but this one was the most recent
CREATE PROC foo BEGIN TRANSACTION SELECT @id = id FROM ... IF @id IS NOT NULL BEGIN ...do some stuff, there is NO ROLLBACK in here or error checking... COMMIT END else ROLLBACK
It's just so...useless. We only ever rollback if we didn't do anything?GibbleCH wrote:
It's just so...useless. We only ever rollback if we didn't do anything?
Defensive coding at its finest.:-D
Deja View - the feeling that you've seen this post before.
-
Ok, I come across stuff like this daily...but this one was the most recent
CREATE PROC foo BEGIN TRANSACTION SELECT @id = id FROM ... IF @id IS NOT NULL BEGIN ...do some stuff, there is NO ROLLBACK in here or error checking... COMMIT END else ROLLBACK
It's just so...useless. We only ever rollback if we didn't do anything?GibbleCH wrote:
It's just so...useless. We only ever rollback if we didn't do anything?
Well, maybe you didn't see a "set XACT_ABORT on" statement buried in the code? If that is set, then rollback is automatic whenever an error occurs.
-
GibbleCH wrote:
It's just so...useless. We only ever rollback if we didn't do anything?
Well, maybe you didn't see a "set XACT_ABORT on" statement buried in the code? If that is set, then rollback is automatic whenever an error occurs.
Then get rid of the existing ROLLBACK.
-
Then get rid of the existing ROLLBACK.
-
That makes the ROLLBACK extremely fast. ;P
Chris Meech I am Canadian. [heard in a local bar] Stercorum pro cerebro habes. [Cicero]