kylefarris / node-querybuilder

Node QueryBuilder Adapter for Node.js (tags: nodejs, node, mysql, active record, activerecord, querybuilder, query builder)
49 stars 19 forks source link

Issues with big integers #10

Closed prakashgp closed 6 years ago

prakashgp commented 7 years ago

It converts string values like 23842563958810573 into 23842563958810572 which took half day to find out !

kylefarris commented 7 years ago

Hmm... I'm not sure if this is an issue with the mysql driver or if it's with the querybuilder. Any ideas?

prakashgp commented 7 years ago

I think it is a problem with JavaScript that it can't handle such big numbers.(such as Facebook campaign ids)

I can avoid this by converting number to string before passing to query builder.

But still, the problem with querybuilder is it detects the numerical string and converts it into number (my guess) This happens when a number is passed to functions like where() but it works when numerical string is used in raw queries

On 11-Jul-2017 11:41 PM, "Kyle Farris" notifications@github.com wrote:

Hmm... I'm not sure if this is an issue with the mysql driver or if it's with the querybuilder. Any ideas?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kylefarris/node-querybuilder/issues/10#issuecomment-314527206, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWcosOBo6a9lBgVrFatqPgl9TEPdwRVks5sM7q2gaJpZM4NOFJx .

kylefarris commented 7 years ago

Ah, interesting. Thanks for the feedback--I'll take a look at what I'm doing and see if there are some bad assumptions, and, hence, conversions being made.

kylefarris commented 6 years ago

@prakashgp This is definitely an issue with Javascript. It only supports up to 53-bit numbers. I would suggest converting your database field into a string-type field like VARCHAR or TEXT.