rcdmk / aspJSON

A fast classic ASP JSON parser and encoder for easy JSON manipulation to work with the new JavaScript MV* libraries and frameworks.
MIT License
204 stars 89 forks source link

Error 458 #18

Closed dtrillo closed 8 years ago

dtrillo commented 8 years ago

when using MySQL recordsets, I have problems with numeric datatypes. I have included line 846: if varType(value) = 16 then valueType = "Double"

I cann't get to work with MySQL. Error 458 means datatype is not supported.

rcdmk commented 8 years ago

I'm on a Windows 10 (64bit) machine, running MySQL 5.1 with the 5.1 ODBC driver and I could not simulate your errors.

I've created a table with all common data types and used the JSONarray.LoadRecordset(rs) and the JSONobject.LoadFirstRecord(rs) methods with no error.

CREATE TABLE `test` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(50) NOT NULL,
    `age` INT(11) NULL DEFAULT NULL,
    `bdate` DATE NULL DEFAULT NULL,
    `income` DECIMAL(10,2) NULL DEFAULT NULL,
    `weight` FLOAT NULL DEFAULT NULL,
    `height` DOUBLE(3,2) NULL DEFAULT NULL,
    `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `nextMeeting` DATETIME NULL DEFAULT NULL,
    PRIMARY KEY (`id`)
)
ENGINE=InnoDB;
<!--#include file="jsonObject.class.asp" -->
<%
dim json, rs
set json = new JSONobject
set rs = createObject("ADODB.Recordset")

rs.open "select * from test", "driver={MySQL ODBC 5.1 Driver}; datasource=localhost; database=test; uid=root; pwd=notTellingYouHere"

json.LoadFirstRecord(rs)

rs.close
set rs = nothing

json.write

set json = nothing
%>

Can you test this on your machine?

rcdmk commented 8 years ago

Hi. Please, let me know when you find some time to test this. Thank you.

rcdmk commented 8 years ago

I will close this issue for now, since I could not reproduce the problem. If you still have this error with the updated version, please, feel free to reopen it.