Skip to content

Conversation

@dariocs
Copy link

@dariocs dariocs commented Dec 28, 2025

Description

This commit adds json-bigint as a dependency and updates the SQL job parsing logic to use it for JSON deserialization of messages coming from the server component.

What changed

Added dependency:
package.json: added "json-bigint": "^1.0.0"
package-lock.json: updated accordingly
Parsing logic:
src/connection/sqlJob.ts: replaced the previous JSON.parse approach with json-bigint parsing to reliably handle large integers returned by the server.

Why

Some server responses include numeric values that exceed JavaScript’s Number safe integer range. Using json-bigint preserves those values (configured to store big integers as strings), avoiding precision loss and potential bugs when handling identifiers or large counters. Reference issues:
#471

Behavioral notes

Big integers in server messages are preserved as strings (no precision-losing conversion to Number).
The external API and event flow remain the same; only the JSON parsing implementation changed.
No changes to public APIs or extension activation behavior are expected.

How I tested

Confirmed the dependency declaration is present in package.json.
Installed dependencies locally and verified the project installs (note: ensure TLS/CA issues are resolved in your environment if native modules are downloaded).
Observed sqlJob message parsing and verified that large numeric fields are preserved as strings in the parsed object (manual run).

image

Checklist

  • have tested my change
  • have created one or more test cases
  • updated relevant documentation
  • Remove any/all console.logs I added
  • have added myself to the contributors' list in CONTRIBUTING.md

Copy link
Member

@SanjulaGanepola SanjulaGanepola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dariocs Thanks for taking a look and fixing this. Changes look mostly good. Just a couple comments and then we can get this in

Copy link
Author

@dariocs dariocs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SanjulaGanepola Could you check it? thanks

@worksofliam
Copy link
Member

@dariocs Did you see this old PR comment from a year ago? What are your thoughts? #333 (comment)

@dariocs
Copy link
Author

dariocs commented Jan 20, 2026

@worksofliam I'm running Node v22 and I can't find a third context parameter for JSON.parse — the reviver function only receives (key, value).

Versione: 1.105.1 (system setup)
Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084
Data: 2025-10-14T22:33:36.618Z
Electron: 37.6.0
ElectronBuildId: 12502201
Chromium: 138.0.7204.251
Node.js: 22.19.0
V8: 13.8.258.32-electron.0
Sistema operativo: Windows_NT x64 10.0.26200

and "@types/node": "18.x"

Maybe @janfh could fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Precision Loss in DECIMAL/NUMERIC Conversion Big number and DB2 for i

3 participants