CraZySacX / node-jdbc

JDBC Wrapper for node.js
140 stars 106 forks source link

ResultSet - Null integer columns returned as a zero #222

Open EmilCernega opened 3 years ago

EmilCernega commented 3 years ago

Hello, This issue appears again after commit 10a1928d8c65cd59ea193787d5cbe93e812278f9 this was changed:

               - if(type === 'BigDecimal') type = 'Int';
               + if (type === 'BigDecimal') type = 'Double';

But the if condition didn't change:

 if (type === 'Int' && _.isNull(self._rs.getObjectSync(cmd.label))) {
                    result[cmd.label] = null;
                    return;
                  }

Thank you, Emil

Originally posted by @EmilCernega in https://github.com/CraZySacX/node-jdbc/issues/94#issuecomment-892721143

snotmare commented 2 years ago

Is there any movement on this? The fix is pretty simple. Anyway you could post an incremental release?

Here's a potential fix... if ((type === 'Int' || type === 'Double') && _.isNull(self._rs.getObjectSync(cmd.label))) { result[cmd.label] = null; return; }