> I previously (cfserver 4) used cftransaction and cflock to
> rollback any errors when inserting a record and then
> selecting the last insert using AX( ). eg:
>
> <cflock name="FindUser" timeout="20">
> <cftransaction>
>   <cfquery Datasource="#DSN1#">
>    INSERT INTO
> Customers(Title,FirstName,LastName,Address,Suburb,State,PostCo
> de,Country,Pho
> ne,EmailAddress)
>    VALUES ('#form.Title#', '#form.FirstName#', '#Form.LastName#',
> '#form.Address#', '#Form.Suburb#', '#form.State#', '#PostCode#',
> '#form.Country#', '#form.Phone#', '#form.EmailAddress#')
>   </cfquery>
>      <cfquery datasource="#DSN1#" name="getLastID">
>        SELECT MAX(CustomerID) as UserID
>        FROM Customers
>      </cfquery>
> </cftransaction>
> </cflock>

Aside from the specific failure problem in this case, I'd like to point out
that you don't need to use CFLOCK to lock your CFTRANSACTION tag, and
probably shouldn't.

CFTRANSACTION is used to instruct the database that the queries it contains
are to be treated in a specific way. By default, that specific way means
that all the queries will be treated as a single atomic database operation,
either succeeding or failing as a single unit, and that these queries will
place locks on database resources and respect existing locks on those
resources.

CFLOCK is used to prevent the application environment from executing the
same code concurrently. That's not what you want to prevent here - you want
the database to handle its own locking.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to