2Toad / node-teradata

Teradata for Node.js
MIT License
6 stars 5 forks source link

Column having data type as Decimal are giving blank object in response JSON #40

Closed rohankambli closed 6 years ago

rohankambli commented 6 years ago

Hi ,

We are facing issue with node-teradata plugin where when we perform read/ readPreparedStatement operation for table having columns of data type "DECIMAL" , the response JSON is giving blank object w,r,t those columns.

For example in table test, if column2 and column3 are of data type "DECIMAL" say DECIMAL(4,2) then if we execute select * from test the result response is coming as:

[ { "column1" : 123, "column2" : { } // blank object "column3" : { } //blank object "column4" : "abcd" } ]

Can someone please help resolving this issue or suggest any workaround to get decimal values.

Thanks and Regards, Rohan

marsegliaandrea commented 6 years ago

@rohankambli If you haven't found a solution for this yet. I found this: #155. The issue is actually in node-jdbc library which node-teradata is using. For workaround just paste this in the resultset.js line 125, between if and else statements: else if (type === 'BigDecimal') { result[cmd.label] = Number(self._rs[getter](i)); }

For me this solved the same problem.

JasonPierce commented 6 years ago

Thanks for sharing this workaround with the node-teradata community @marsegliaandrea.

Closing, since this is a node-jdbc issue.