ColdFusion, WordPress, Flash & other web things


cfexit in cftransaction block

According to this Macromedia technote this is what happens when you use cfexit inside a cftransaction block:

When a cfexit tag is encountered within a cftransaction block of code, the thread in use is released, regardless if the method attribute is specified. However, because the cftransaction end tag has not been executed yet, the data source name as well as username and password information remains with that thread. Therefore, the next ColdFusion template that runs a cfquery with a different data source name or username/password will cause one of the errors listed above [see below] because it assumes it is still within the same cftransaction.

This results in most of the queries on your server throwing one of the following exceptions:

Datasource names for all the database tags within CFTRANSACTION must be the same.

or

Usernames and Passwords for all the database tags within CFTRANSACTION must be the same.

As far as I know, this only happens for CFMX 6.1

2 comments

  1. #1: barry.b Says:

    quick Q: do you know if this behaviour remains for CF7?

  2. #2: Martin Says:

    I haven’t had to use cfexit inside a cftransaction since we upgraded to MX7 so, personnally I don’t know. However, the Macromedia technote states that it is still an issue for MX7.