Ask a Question related to Macromedia ColdFusion, Design and Development.
-
akosz #1
CFTRANSACTION w/ ROLLBACK
Here's what I'm trying to do, this worked in CF 5, but bombs with the following
error in CFMX 6: The <CFCATCH> tag requires an end tag to nest within
<CFTRANSACTION>, which began on line 14, column 2. The first query should
work, the 2nd should bomb, I want the first rolled back.
<CFTRANSACTION ACTION="BEGIN">
<CFTRY>
<CFQUERY name="INSERT_USAGE" datasource="TEST_DB">
INSERT INTO USAGE_TYPE(USAGE_CDE, USAGE_DESC)
VALUES ('999','ABC123')
</CFQUERY>
<CFQUERY NAME="GARBAGE" DATASOURCE="TEST_DB">
INSERT INTO GARBAGE(GARBAGE_CDE)
VALUES('G123')
</CFQUERY>
<CFCATCH TYPE="Database">
<CFTRANSACTION ACTION="ROLLBACK"></CFTRANSACTION>
AN ERROR HAS OCCURRED
</CFCATCH>
</CFTRY>
</CFTRANSACTION>
akosz Guest
-
cftransaction
I have a question about CFTRANSACTION. We are currently using CF6.0 with various versions of Oracle and SQL Server. In our server settings we do... -
CFTransaction doesn't rollback on error
Hi all, years ago on CF 4.5, our cftransaction tags used to rollback changed data when something inbetween <cftransaction> and </cftransaction>... -
CFtransaction error
I'm getting the following error: Nested transactions are not supported. A cftransaction tag can not be nested within another cftransaction tag. ... -
is this possible - cftransaction
I don't want to get into the whole 'users shouldn't have access to the db' discussion. It's a battle that's been lost. We are looking at... -
cftransaction question
Hi there ! Let's say i have a first query which inserts a new row in a table, then a second query (myquery) trying to get the id of the inserted row... -
paross1 #2
Re: CFTRANSACTION w/ ROLLBACK
You might try losing the </cftransaction> in your rollback section, and
rearrange your <cftry> and </cftry> tags.
<CFTRY>
<CFTRANSACTION ACTION="BEGIN" />
<CFQUERY name="INSERT_USAGE" datasource="TEST_DB">
INSERT INTO USAGE_TYPE(USAGE_CDE, USAGE_DESC)
VALUES ('999','ABC123')
</CFQUERY>
<CFQUERY NAME="GARBAGE" DATASOURCE="TEST_DB">
INSERT INTO GARBAGE(GARBAGE_CDE)
VALUES('G123')
</CFQUERY>
<CFCATCH TYPE="Database">
<CFTRANSACTION ACTION="ROLLBACK" />
AN ERROR HAS OCCURRED
</CFCATCH>
</CFTRANSACTION>
</CFTRY>
paross1 Guest
-
mpwoodward *TMM* #3
Re: CFTRANSACTION w/ ROLLBACK
paross1 wrote:
Not sure if this is mandatory or not, but that's typically how I do> You might try losing the </cftransaction> in your rollback section, and
> rearrange your <cftry> and </cftry> tags.
things--put the try around the transaction instead of vice-versa. Works
in 6.1 and 7.
Matt
--
Matt Woodward
Team Macromedia - ColdFusion
mpwoodward *TMM* Guest
-
akosz #4
Re: CFTRANSACTION w/ ROLLBACK
paross1 - I tried your solution but got the following error: The start tag
must have a matching end tag. This could be because CFCATCH is not the last tag
nested in the CFTRY. CFCATCH must be the last tag inside a CFTRY. i don't get
it, this used to work. anybody have a better idea? are there cf admin
settings that need to be adjusted or something?
akosz Guest
-
akosz #5
Re: CFTRANSACTION w/ ROLLBACK
paross1 - I tried your solution but got the following error: The start tag
must have a matching end tag. This could be because CFCATCH is not the last tag
nested in the CFTRY. CFCATCH must be the last tag inside a CFTRY. i don't get
it, this used to work. anybody have a better idea? are there cf admin
settings that need to be adjusted or something?
akosz Guest
-
akosz #6
Re: CFTRANSACTION w/ ROLLBACK
found the problem, i had to get rid of the slash at the end of this line:
<CFTRANSACTION ACTION='BEGIN' />
otherwise paross1's answer is correct!
akosz Guest
-
paross1 #7
Re: CFTRANSACTION w/ ROLLBACK
Ooops, sorry, got a little carried away with the closing slash character. Yes,
you would not want to include it with the BEGIN cftransaction, only for "self
closing" purposes on subsequent COMMIT or ROLLBACK cftransaction tags.
Phil
paross1 Guest



Reply With Quote

