tracker issue : CF-3746091

select a category, or use search below
(searches all categories and all time range)
Title:

Datatype preservation not working with json serialization in row and column format

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Deepak Kumar / Deepak Kumar (Deepak Kumar)

Created: 04/21/2014

Components: Language, Serialization

Versions: 11.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: PublicBeta /

Priority/Frequency: Critical / Most users will encounter

Locale/System: English / Win Mobile 6.5

Vote Count: 0

Problem Description:
In the CF11 docs it is mentioned that "Starting from ColdFusion Splendor, the data type is preserved during the code execution time for Query and CFCs." It is working fine when we serialize a query object using the new "struct" format but it is not working for "row" and "column" format.

Steps to Reproduce:
1. Create a table with two fields Name[varchar(50)] and Salary[varchar(50)]. Insert some data to this table with salary as numeric values.
2. Now when you will serialize the query output using "row" or "column" format it will convert the salary column data to numeric
though it is varchar in db. But it is working fine for "struct" format.

Actual Result: 
Salary data is coming as numeric.

Expected Result:
Salary data should come as string as it a varchar type field in database.

Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3746091

External Customer Info:
External Company:  
External Customer Name: Deepak Kumar Padhy
External Customer Email:  
External Test Config: Database:SQL Server 2008

ColdFusion Version: 11.0

OS: Windows7 32 bit

WebServer: IIS

Attachments:

  1. April 21, 2014 00:00:00: 1_bug2.PNG

Comments:

Hi Deepak, I tried replicating this issue but it seems to be working fine at my end. SQL Script: create table bugCF-3746091 ( name varchar(20), salary varchar(20) ) insert into bugCF-3746091(name, salary) values('David', '50000') insert into bugCF-3746091(name, salary) values('Eric', '53000') CFML Script: <cfquery name="qry_Users" datasource="Bugs"> SELECT name,salary FROM bugCF-3746091 </cfquery> <cfdump var="#getmetadata(qry_Users)#"> Row:<cfoutput>#serializeJSON(qry_Users,"row")#</cfoutput><br> Column:<cfoutput>#serializeJSON(qry_Users,"column")#</cfoutput><br> Struct:<cfoutput>#serializeJSON(qry_Users,"struct")#</cfoutput> Output: Row:{"COLUMNS":["NAME","SALARY"],"DATA":[["David","50000"],["Eric","53000"]]} Column:{"ROWCOUNT":2,"COLUMNS":["NAME","SALARY"],"DATA":{"NAME":["David","Eric"],"SALARY":["50000","53000"]}} Struct:[{"NAME":"David","SALARY":"50000"},{"NAME":"Eric","SALARY":"53000"}] Is there any thing I am missing? Please share your build number as well. Regards, Nimit
Comment by Nimit S.
12603 | April 21, 2014 03:44:33 AM GMT
Server Details: Server Product ColdFusion Version 11,0,0,288464 Edition Enterprise (Trial) Operating System Windows 7 OS Version 6.1 Adobe Driver Version 4.1 (Build 0001)
Comment by External U.
12604 | April 21, 2014 03:50:13 AM GMT
I have tried with your example also but getting the same issue.Let me know if you want some more details.
Comment by External U.
12605 | April 21, 2014 03:59:29 AM GMT
Hi Deepak, This issue is resolved in the latest Public beta build. You can download the latest build to verify this issue. If you still face this issue then let me know. Regards, Nimit
Comment by Nimit S.
12606 | April 21, 2014 06:23:23 AM GMT