node-odbc: Numbers are being inconsistently returned

Describe your system

  • odbc Package Version: 2.3.0
  • ODBC Driver: Microsoft Access Driver (*.mdb, *.accdb)
  • Database Name: Microsoft Access
  • Database Version: 2002-2003
  • Database OS: Windows 10
  • Node.js Version: 12.18.0
  • Node.js OS: Windows 10

Describe the bug Numbers are being inconsistently returned from Access database. For example, 0 is sometimes returned as 0.04. In the Access database, it’s 0.

Expected behavior Data should consistently be returned. I did not have this problem in version 1.4.6.

To Reproduce

Add an ODBC x64 Microsoft Access datasource called “odbc-number-issue”

Driver: https://www.microsoft.com/en-us/download/details.aspx?id=13255

Checkout and build the example repo

This repo contains the Access database and examples of how the query returns inconsistent data.

Repo: https://github.com/bennyt2/odbc-number-issue

npm install npm run build npm start

Running the program will attempt to execute the offending query 100 times. I usually get between 0-5 hits from this, but I’ve seen over 200 in a single run. It’s random. It may take a couple runs to see a console log that looks like this:

Event_no 128 should have Event_dist 1500, but Event_dist is 1500.02

In this example, if you look at Event_no 128 in the Event table, you will see Event_dist is 1500.

I’m sure this is some kind of minor data type issue, but the inconsistency is causing problems.

Additional context

  • I know this DB format is very old, but I don’t have the option of upgrading.
  • I was not able to get the DEBUG output working in binding.gyp. I followed these steps but saw nothing in my terminal: ** Change line 16 from 'NAPI_EXPERIMENTAL' to 'NAPI_EXPERIMENTAL', 'DEBUG ** cd node_modules/odbc && npm install ** cd ../../ && npm run r

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Better waiting for 2.3.2. I will try to push it out today!

Had some trouble with installing using your install command because of using password for ssh public key. Following command worked for me:

npm install git+ssh://git@github.com:markdirish/node-odbc#issue96-inconsistent-numbers

My tests work fine now. I’ll ask my colleague to test it with his examples. Getting back shortly with the results.