Usually this code works, ```<cffunction name="d...
# lucee
g
Usually this code works,
Copy code
<cffunction name="delete" output="false" returntype="boolean">		
		<cfargument name="donation_id">
		<cfargument name="rowid" default="">
		<cfif len(trim(arguments.rowid)) or (isdefined("arguments.donation_id") and len(trim(arguments.donation_id)))>
			<cfquery name="qDeletetemple_donation_form" datasource="#variables.dsn#">
				DELETE FROM 
					temple_donation_form
				WHERE 
					<cfif len(trim(arguments.rowid))>ROWID = <cfqueryparam value="#arguments.rowid#" cfsqltype="CF_SQL_VARCHAR"><cfelse>
					donation_id = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#arguments.donation_id#">
					</cfif>
			</cfquery>
			<cfreturn true>
		<cfelse>
			<cfreturn false>
		</cfif>
	</cffunction>
what if i have to improvide it using cftransatcion tags and try catch blocks and log ethe error in ac csv and display a nice message back to user, recommendations welcome
z
please always use threads, you don't know how to use transactions or a try catch block?
w
it's also hard to imagine what good a transaction would do for a single query
g
i do @zackster what i will do is like this
Copy code
<cffunction>
<cfarguments>
<cftransaction>
        <cftry>
            <cftransaction action="begin">
do the query stuff or whatever 
<cftransaction action="commit"/>
<cfaccth type="any">
<cftransaction action="rollback"/>
<cflogging>
</cftry>
</cftransaction>
<cfreturn>
</cffunction>
not sure if there is anything better
z
For a single query? As @websolete wrote, it doesn't make much sense. What problem are u trying to solve?