> >- Do other data access methods that don't return actual data (save and
> >update) typically return anything?
> >
> >
> Usually, my create() methods return the last_insert_id() of the insert.
> Update() is usually void.
My save() (probably similar to your create()) usually returns void. However,
it's responsible for setting the ID property on the object that was passed
in. In other words, I call save(), passing in a object with all its
properties set except for the ID, which will be provided by the database.
The save() method is responsible for getting the value of the ID field and
updating the object. Since objects are passed by reference, the caller will
have access to the ID via the object it passed into the save() method.
<cfset account = createObject("component", "account")>
<cfset account.setName("Elvis")>
<cfset accountDAO = createObject("component", "accountDAO")>
<cfset accountDAO.save(account)>
<cfoutput>
The account ID is #account.getAccountID()#
</cfoutput>
Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]