Repository navigation
fix: commit autocommit batches, allow >84 parameters, bind large integers, retry RDBNAM on close - #35
Merged
Merged
Conversation
The first ACCSEC sends a trimmed RDBNAM, which Db2 12.1 rejects with RDBNFNRM before the driver retries with the padded LUW form. Db2 can close the socket before that reply is read; the driver then reported "RDB not accessed or database not found" without retrying, so parallel connects to 12.1 failed intermittently. A closed socket during the trimmed attempt now takes the same retry.
execute_batch_with_params never sent RDBCMM, so rows from an autocommit executeBatch stayed uncommitted, and invisible to other connections, until something else committed on the connection. It also returned on the first failing row before reading the remaining row replies. All replies are now read before reporting the first row error. Under autocommit the batch commits once every row succeeds and rolls back if any row fails; inside a transaction it is left to the transaction.
All parameter descriptors went into one FD:OCA group triplet, whose one-byte length holds at most 84 entries, so an 85th parameter failed with "too many parameters for SQLDTA descriptor header". Longer descriptor lists now continue in CPT triplets (0x7F 0x00), the layout Db2 itself uses in QRYDSC for wide result sets.
napi's JSON conversion keeps only u32-sized integers integral, so a JS number such as 606227179000 arrived as DOUBLE and was rejected for BIGINT targets. Whole numbers within Number.MAX_SAFE_INTEGER now bind as integers, matching the documented BIGINT parameter behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the three driver bugs found while benchmarking 1.0.26, plus an intermittent connect failure on Db2 12.1 that showed up during validation.
1.
executeBatchnever committed under autocommitexecute_batch_with_paramssent no RDBCMM. Rows from an autocommitexecuteBatchstayed uncommitted, and invisible to other connections, until something else committed on that connection. A DSS capture confirms that every other autocommit path chains RDBCMM and the batch path did not. On a failing row it also returned before reading the remaining row replies.2. Statements were limited to 84 parameters
All parameter descriptors went into one FD:OCA group triplet, and its one-byte length holds at most 84 three-byte entries. An 85th parameter failed with
too many parameters for SQLDTA descriptor header. Descriptors past the first 84 now continue in CPT triplets (0x7F 0x00), the same layout Db2 uses in its own QRYDSC. This was captured from a 100-column result:ff 76 d0 …84 entries… 33 7f 00 …16 entries…. Tested up to 500 parameters, including an externalized 40 KB CLOB as the 90th parameter.3. Large whole JS numbers could not be bound to BIGINT
napi's JSON conversion keeps only u32-sized integers integral, so
606227179000arrived asDoubleand BIGINT rejected it (expected integer-compatible parameter).2**31happened to work. Whole numbers withinNumber.MAX_SAFE_INTEGERnow bind as integers, which is the behaviordocs/data-typesalready described.606227179000→ BIGINT606227179000±Number.MAX_SAFE_INTEGER→ BIGINT1.5→ BIGINT2**60→ BIGINT (unsafe integer)bigint)4. Intermittent "RDB not accessed or database not found" on connect
The first ACCSEC sends a trimmed RDBNAM. Db2 12.1 rejects it with RDBNFNRM, then the driver retries with the padded LUW form. Db2 sometimes closes the socket before that reply is read. In that case the driver reported
RDB not accessed or database not foundwithout retrying. A closed socket during the trimmed attempt now takes the same retry, and a failed retry still reports the same message.connection_teston Db2 12.1 failed in 3 of 3 alternating runs onmainand passed 3 of 3 on this branch.Tests
prepared_stmt_test.rs):batch-params-regressions.test.ts):executeBatch.executeBatchand a 300-valueINlist.main: all three Node tests and the batch and wide-parameter Rust tests fail there, and pass here.Validation
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings, workspace unit tests anddb2-napiJS tests all pass.cargo test --workspace --test '*'passes. Nodenpm testhas 140 passed, 0 failed, 7 skipped, including the TLS suite.cargo test --workspace --test '*'passes. Node has the same 14 pre-existing SQL0204 failures asmain(missing seed fixtures).🤖 Generated with Claude Code