I'm dumb, please ignore this whole chain...
Cutter (CFRelated) wrote:
> No, actually I stay away from default in that fashion most of the time.
> In this case I set an initialized value when the Bean is instantiated:
>
> <cfset variables.instance.intUserID = -99999 />
>
> And then 'set' the value when looping the query record columns:
>
> <cfloop list="#q.ColumnList#" index="col">
> <cfinvoke component="#arguments.bean#" method="set#col#">
> <cfinvokeargument name="#col#" value="#q[col][1]#" />
> </cfinvoke>
> </cfloop>
>
> So, when the column intUserID is reached, it runs it's setter method:
>
> <!---
> * FUNCTION: setIntUserID
> * Sets the intUserID variable
> * @param numeric : intUserID
> * @return void : return void
> --->
> <cffunction name="setIntUserID" returnType="void" access="public"
> output="false">
> <cfargument name="intUserID" type="numeric" required="true">
> <cfset variables.instance.intUserID = arguments.intUserID />
> </cffunction>
>
> Hence my confusion...
>
> Cutter
>
> Phillip Holmes wrote:
>> Most likely the 'default' attribute of your argument is set to "" and is not
>> required.
>> Change it to a numeric value.
>>
>> i.e.
>>
>> <cfargument name="intUserID" default="0" type="numeric" required="no">
>>
>> Then you can validate the argument above your query.
>>
>> i.e.
>>
>> if(arguments.intUserID EQ 0) {
>> ret.success = false;
>> ret.error = 'INCORRECT_DATATYPE';
>> // blah blah blah
>> return ret;
>> }
>>
>> Warmest Regards,
>>
>> Phillip B. Holmes
>> http://phillipholmes.com
>>
>>
>>
>>
>> -----Original Message-----
>> From: Cutter (CFRelated) [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, May 24, 2006 11:07 PM
>> To: CF-Talk
>> Subject: Query issues
>>
>> I have a query within a cfc that pulls an ID from a table record and tries
>> to set the ID property of a bean. The ID field of the (MySQL) table is and
>> int(11)unsigned primary key. The argument of the 'set'
>> statement within my bean calls for a numeric value. I'm getting the
>> following error from the 'set' statement:
>>
>> Message The argument INTUSERID passed to function setIntUserID() is
>>
>> not of type numeric.
>> Detail If the component name is specified as a type of this argument,
>> the reason for this error might be that a definition file for such component
>> cannot be found or is not accessible.
>>
>> Any ideas?
>
--
Cutter
____________
http://blog.cutterscrossing.com
"The Past is a Memory
The Future a Dream
But Today is a Gift
That's why they call it
The Present"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241435
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54