Ahmed, are you sure about that statement about the var scoping?  I almost certain that when you modify the var scoped structure you are also changing the original one you passed into the argument.  Var scoping is still important for threading issues, but I am pretty sure that you are still working with the data in the original structure by reference.  Might be time for a quick test! :)

~Dave


On 9/7/06, AHMED EL-RASHEEDY <[EMAIL PROTECTED]> wrote:
I have done this before and found no performance issues with it.
 
The only short coming is if someone else would want to reuse your CFC or method and the struct and its keys are not documented. It would be a good idea to put in the hint or some comment for the cfargument to explain what is expected in the passed struct.
 
Also, it is good idea to copy the struct to a var scoped struct in case you will change any of the values in the keys.
 
Ahmed.
 
On 9/7/06, Sophek Tounn < [EMAIL PROTECTED]> wrote:
Hi all,

I have a component that has only one argument: Is it okay pass a struct to 1 argument as oppose to creating many arguments?

<cfcomponent>
    <cffunction name="addToCustomers" access="public" returntype="void">
    <cfargument name="structCollection" type="struct">
    <cfset createID = createUUID()>
    <cfquery name="qAddtoCustomers" datasource="#request.dsn#">
                INSERT INTO customers (
                customers_id,
                customers_gender,
                customers_firstname,
                customers_lastname,
                customers_dob,
                customers_email_address,
                customers_nick,
                customers_default_address_id,
                customers_telephone,
                customers_fax,
                customers_password,
                customers_newsletter,
                customers_group_pricing,
                customers_email_format,
                customers_authorization,
                customers_referral)
                VALUES (
                <cfqueryparam value="#createID#" cfsqltype="cf_sql_varchar" />,
                <cfqueryparam value="#arguments.structCollection.customers_gender#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_firstname#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_lastname#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#createODBCDateTime(arguments.structCollection.customers_dob)#" cfsqltype="cf_sql_date">,
                <cfqueryparam value="#arguments.structCollection.customers_email_address#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_nick#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_default_address_id#" cfsqltype="cf_sql_numeric">,
                <cfqueryparam value="#arguments.structCollection.customers_telephone#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_fax#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_password#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_newsletter#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_group_pricing#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_email_format#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_authorization#" cfsqltype="cf_sql_varchar">,
                <cfqueryparam value="#arguments.structCollection.customers_referral#" cfsqltype="cf_sql_varchar">)
            </cfquery>   
    </cffunction>
</cfcomponent>

thanks
 
sophek



_______________________________________________
Reply to DFWCFUG:
 [email protected]
Subscribe/Unsubscribe:
 http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
 www.HostMySite.com
  www.teksystems.com/





--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
www.worldwildweb.biz
_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/

Reply via email to