Try putting output="false" in all your CFCOMPONENT and CFFUNCTION
tags. There are some really weird issues with whitespace that all
magically go away when you do this.
cheers,
barneyb
On 9/8/05, Paul <[EMAIL PROTECTED]> wrote:
> I'm getting results from my DAO that don't exactly match the same value when
> retrieved using good old-fashioned cfquery. I suspect I'm doing something
> goofy.
>
>
>
> When I grab the data directly using cfquery, I can see that the value stored
> in my database is simply "81150-100". When I retrieve the same value
> through my DAO, the value is essentially the same but the string is
> prepended by a line break and extra spaces. So "81150-100" is returned as "
>
> 81150-100"
>
>
>
> Am I making, by chance, a common mistake? If the symptoms sound familiar to
> you I'd sure appreciate the help. Here's what I think is the relevant code.
>
>
>
> In the calling page:
>
> entry=createObject("component","com.portal.amex.entryDAO").init().read(url.e
> ntryID);
>
> dump(entry.getAccount());
>
>
>
> The "read" function of my DAO:
>
> <cffunction name="read" access="public" returntype="com.portal.amex.entry">
>
> <cfargument name="entryID" required="true" type="numeric">
>
> <cfset var q="">
>
> <cfset var o=createObject("component","entry").init()>
>
> <cfquery name="q" datasource="#getDSN()#">
>
> select * from entries
>
> where entryID = <cfqueryparam value="#arguments.entryID#"
> cfsqltype="CF_SQL_INTEGER">
>
> </cfquery>
>
> <cfscript>
>
> o.setEntryID(q.entryID);
>
> o.setTransactionID(q.transactionID);
>
> o.setAccount(q.account);
>
> o.setAmount(q.amount);
>
> o.setEnteredBy(q.enteredBy);
>
> o.setEnteredDate(q.enteredDate);
>
> o.setNotes(q.notes);
>
> </cfscript>
>
> <cfreturn o>
>
> </cffunction>
>
>
>
> And the init and getAccount methods from the entry object:
>
> <cffunction name="init" access="public" displayname="init()" output="no"
> returntype="entry">
>
> <cfargument name="transactionID" default="0" type="numeric">
>
> <cfargument name="account" default="" type="string">
>
> <cfargument name="amount" default="0" type="numeric">
>
> <cfargument name="enteredBy" default="" type="string">
>
> <cfargument name="enteredDate" default="#now()#" type="date">
>
> <cfargument name="notes" default="" type="string">
>
> <cfargument name="entryID" default="0" type="numeric">
>
> <cfscript>
>
> variables.instance=structNew();
>
> setTransactionID(arguments.transactionID);
>
> setAccount(arguments.account);
>
> setAmount(arguments.amount);
>
> setEnteredBy(arguments.enteredBy);
>
> setEnteredDate(arguments.enteredDate);
>
> setNotes(arguments.notes);
>
> setEntryID(arguments.entryID);
>
> </cfscript>
>
> <cfreturn this />
>
> </cffunction>
>
>
>
> <cffunction name="getAccount" returntype="string">
>
> <cfreturn variables.instance.account>
>
> </cffunction>
>
> <cffunction name="setAccount" returntype="void">
>
> <cfargument name="newValue" required="Yes">
>
> <cfset variables.instance.account=trim(arguments.newValue)>
>
> </cffunction>
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 100 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217717
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