Skip to content

fix: handle large text binds in DML#9

Open
hjianbo wants to merge 1 commit into
emqx-0.4.9from
fix/eec-1322-large-text-binds
Open

fix: handle large text binds in DML#9
hjianbo wants to merge 1 commit into
emqx-0.4.9from
fix/eec-1322-large-text-binds

Conversation

@hjianbo

@hjianbo hjianbo commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

This PR fixes Oracle DML execution when a text bind grows beyond 4000 characters.

The failure was reproduced from the EMQX Oracle action write path: an INSERT into an NCLOB payload column works with a small payload, but a later payload larger than 4000 characters can fail when another bind expression follows the payload bind, for example a timestamp expression after the payload value.

The issue is in the driver bind metadata/cursor handling, not in the caller. A cursor prepared for the small text bind shape can be reused for a later large text bind shape, and Oracle can reject the bind or close the connection.

Changes

  • Include bind format metadata in the cursor cache key, so incompatible small-text and large-text bind shapes do not reuse the same cursor.
  • Merge bind metadata across batch rows so mixed small/large text batches are encoded with a compatible bind format.
  • For DML statements where a large text bind is not the trailing bind, internally wrap the statement in a PL/SQL block, reorder only the driver-level bind variables so large CLOB values are sent last, and return SQL%ROWCOUNT as normal affected_rows.
  • Keep statements with out parameters on the existing path.

Side Effects

For the large-text/non-trailing-bind DML edge case, a batch may be executed internally row by row to avoid the Oracle protocol failure. The public result shape remains {affected_rows, Total} for successful DML batches.

Tests

  • rebar3 compile
  • rebar3 ct --suite test/jamdb_oracle_SUITE.erl --group lob_datatypes
  • Verified through EMQX Oracle bridge CT for the customer-style write path in EEC-1322.

@hjianbo hjianbo changed the base branch from master to emqx-0.4.9 June 18, 2026 06:25
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.

1 participant