Title:
Bug 81726:Taking a query object and converting it to WDDX using the following code:<Cfwddx action="cfml2wddx" input="#arguments
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Rob Parkhill / Rob Parkhill (Rob Parkhill)
Created: 01/22/2010
Components: Language, WDDX Serialization
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 9,0,0,251028 /
Priority/Frequency: Normal / Unknown
Locale/System: Japanese / Win All
Vote Count: 1
Problem:
Taking a query object and converting it to WDDX using the following code:<Cfwddx action="cfml2wddx" input="#arguments.myQuery#" output="local.wddxQuery" usetimezoneinfo="true" />which is then inserted into the database (which works fine). However when reading the data out of the database and converting back to WDDX - using the following:<Cfwddx action="wddx2cfml" input="#local.getReport.reportData#" output="local.myQuery">the query object does appear to be fine when dumped. However when passing the query object to a ColdFusion Report file, an error is generated from the CFR indicating a programming error with an extraneous < in the code. This is not a problem, as the same query can be passed to the CFR file before being converted and stored and the CFR generates, with no issues. A dump of the query object, does not show any errors or extraneous characters.The procedure also works with no problems on a CF8 server when converting/storing/retrieving the data and passing it to the same CFR file.
Method:
Here is the CFC that is used in its entirety:<cfcomponent hint="I will store and retrieve data to the Database"><!---store the Query Object ---><cffunction name="storeData" hint="I store the data in WDDX in the database" access="public" returntype="string"><cfargument name="myQuery" type="query" hint="I contain all the data for the report, except the report File used" required="true" /><cfargument name="reportFile" type="string" hint="I am the name/location of the report File" required="true" /><cfargument name="reportID" type="string" hint="I am the report ID" required="true" /><cfargument name="logoright" type="String" hint="I am the logo for the right side" required="false" default="" /><cfargument name="logoleft" type="String" hint="I am the logo for the left side" required="false" default="" /><cfset var local = {}><!--- check to see if the report has been stored already ---><cfquery name="local.checkReport" datasource="test">Select * from report_query where reportID = #reportID#</cfquery><!--- convert the Query to WDDX, this is required whether we are updating the Report info or not ---><Cfwddx action="cfml2wddx" input="#arguments.myQuery#" output="local.wddxQuery" usetimezoneinfo="true" /><!--- Get the current time and Date - we can use this information to handle the re-generation of reports and within timelines etc ---><Cfset local.date = createODBCDatetime(now())><!--- so, did we find this report already? if not, insert it ---><cfif local.checkreport.recordcount eq 0><cfquery name="local.inserter" datasource="test" >Insert into report_query (reportID, reportFile, reportDate, ReportData, logoLeft, logoRight)Values ('#reportID#', '#reportFile#', #local.date#, '#local.wddxQuery#', '#logoleft#', '#logoright#')</cfquery><!--- if so, lets update some of the information, but we don't need to change the Report ID ---><cfelse><cfquery name="local.updater" datasource="test" >UPDATE report_query SET ReportData = '#local.wddxQuery#', reportFile = '#reportFile#', reportDate =#local.date#, logoright = '#logoRight#', logoleft = '#logoleft#'WHERE id = #local.checkReport.id#</cfquery></cfif></cffunction><!--- Retrieve Query Object ---><cffunction name="retrieveData" hint="I get the data from the database as WDDX and return a struct containg a query and the location of the reprot file" access="public" returntype="struct"><cfargument name="reportID" type="string" hint="I am the report ID" required="true" /><cfset var local = {}><!--- check to see fi the report is stored or not ---><cfquery name="local.getReport" datasource="test">SELECT * FROM report_query WHERE reportID = #reportID#</cfquery> <!--- did we find a report? ---><cfif local.getReport.recordcount gt 0><!--- convert back to a query so that we can pass it to the CFR ---><Cfwddx action="wddx2cfml" input="#local.getReport.reportData#" output="local.myQuery"><cfreturn local><cfelse> <!--- didn't find it, tell the calling page to generate the query by itself ---><cfset local.notfound = reportid><cfreturn local></cfif></cffunction></cfcomponent>then just a simple <cfreport> is called on the originating page for example:<cfreport template="#local.dbresult.getReport.reportFile#" format="flashpaper" query="local.dbresult.myQuery" />
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3040812
External Customer Info:
External Company:
External Customer Name: Rob Parkhill
External Customer Email: 6948663845D32D03992015D5
External Test Config: 01/22/2010
Attachments:
Comments: