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>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217675
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