Status/Resolution/Reason: To Fix//BugVerified
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff ()
Created: 02/08/2017
Components: Language, Serialization
Versions: 2016,11.0,10.0
Failure Type: Non Functioning
Found In Build/Fixed In Build: /
Priority/Frequency: Normal /
Locale/System: /
Vote Count: 0
Issue: When deserializing a WDDX'd query, there is column type information (good). When deserializing a .toJSON()'d query, there is no column type information (bad).
This ER is for SerializeJSON(query, "row|column") to preserve column type.
Repro case:
<cfscript>
q = queryNew("col1,col2,col3", "varchar,double,integer", [[1,1.0,1],[2,2.0,2]]);
writeDump(getMetadata(q));//metadata includes "TypeName" (good)
j = q.toJSON("column", false);//also try "row"
writeOutput(j);//there is no "TYPES" array (bad)
q2 = deserializeJSON(j, false);
writeDump(getMetadata(q2));//metadata does not include "TypeName" (bad)
</cfscript>
When serializeQueryByColumns is "column":
--------------------------------------------
Actual .toJSON() Result: {"ROWCOUNT":2,"COLUMNS":["COL1","COL2","COL3"],"DATA":{"COL1":["1","2"],"COL2":[1.0,2.0],"COL3":[1,2]}}
Expected .toJSON() Result: {"ROWCOUNT":2,"COLUMNS":["COL1","COL2","COL3"],"DATA":{"COL1":["1","2"],"COL2":[1.0,2.0],"COL3":[1,2]},"TYPES":["VARCHAR","DOUBLE","INTEGER"]}
--------------------------------------------
When serializeQueryByColumns is "row":
--------------------------------------------
Actual .toJSON() Result: {"COLUMNS":["COL1","COL2","COL3"],"DATA":[["1",1.0,1],["2",2.0,2]]}
Expected .toJSON() Result: {"COLUMNS":["COL1","COL2","COL3"],"DATA":[["1",1.0,1],["2",2.0,2]],"TYPES":["VARCHAR","DOUBLE","INTEGER"]}
--------------------------------------------
Of course this ER would not work when serializeQueryByColumns is "struct", so only asking for it to work when serializeQueryByColumns is "column" or "row".
Attachments:
Comments: