New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inserting Buffers for Oracle CLOBs silently fails #4869
Comments
@code-ape could be nice if you could provide a PR with your solution + unit/integration tests.
I dont see anything wrong expect what you say about pretty print. |
@OlivierCavadenti I'm 95% done with pr for the issue. @code-ape promised to fix CI for oracle, waiting on that. |
I have a working system for standing up Oracle on GitHub actions. A bit swamped today and tomorrow but should have it in my this weekend if that's alright? |
PR is open for adding CI for Oracle! #4889 |
Released in 2.1.0 |
Environment
Knex version: 0.95.11
Database + version: Oracle 18c
OS: Ubuntu Linux
If issue is about oracledb support, tag @atiertant.
Bug
Behavior
The
oracle-node
driver clearly documents that the best way to insert a large string for a CLOB is to simply hand a buffer of that string to the driver for the insert parameter (reference: https://blogs.oracle.com/opal/post/node-oracledb-112-working-with-lobs-as-string-and-buffer-connection-pinging). However, today when you do this Knex silently replaces theBuffer
reference with the query stringEMPTY_BLOB()
. Effectively causing a silent failure which inserts no data! 😢Error message
None, silent failure.
Reduced test code
Suggested fixes
Initial tests seem to indicate that this can easily be resolved by changing this code:
knex/lib/dialects/oracledb/index.js
Lines 106 to 118 in bfdece3
It appears that some work has been done to support this but never completed. A quick test by myself found that the following code worked:
It's unclear to me whether or not this is an elegant solution. I suspect you may want to tinker with the
Buffer
object slightly so that it "pretty prints" better when the query is logged like I did for the example code to reproduce above. Currently it just prints the u8 array which should probably just be replaced by something like[ Buffer of length ${X}]
.Additional information
Of important note is that the fallback for using
Buffer
isto_clob([4000 chars])||to_clob([4000 chars])||...
which is around 2,000% slower that usingBuffer
for inserting a 2MB payload.The text was updated successfully, but these errors were encountered: