> Yes. CFTRANSACTION only creates a transaction for the current > thread (actually the current database connection from the > connection pool). If multiple threads could be running the > same process at the same time, resulting in a race condition, > then you need to lock that set of queries as well. Use a > named lock so that it only applies to that block of code, or > move the code into a stored procedure which should allow the > database itself to manage any concurrency issues.
This is not correct at all, according to my understanding. CFTRANSACTION creates a database transaction, which uses either locking or MVCC (depending on the specifics of the database used) to prevent concurrent access to database objects that would cause data integrity problems. It doesn't just affect the current thread; it affects any attempt to simultaneously manipulate the same database objects - not just from within other threads in CF, but even from other database clients. The default isolation level for CFTRANSACTION is SERIALIZABLE, if I recall correctly. http://en.wikipedia.org/wiki/Isolation_(computer_science) In short, CFTRANSACTION will not only prevent race conditions within a series of related queries across multiple requests, it should be used instead of CFLOCK for this purpose. And, moving the code into a stored procedure, by itself, would make absolutely no difference, unless you also placed transactional logic within it - which would have the same effect as using CFTRANSACTION. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Enterprise web applications, build robust, secure scalable apps today - Try it now ColdFusion Today ColdFusion 8 beta - Build next generation apps Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288184 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

