Hey Paul, That's weird...I'd make sure the getAccount() (and all other getters) have output="false" applied....otherwise, you may get a line break in the value if you do INSERT .... <cfqueryparam...value="#foo.getXXX()#">
Cheers, Joe 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> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:217683 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54