Fix: remove escapeValue in favor of SQL placeholder#430
Fix: remove escapeValue in favor of SQL placeholder#430frascuchon merged 12 commits intohuggingface:mainfrom
Conversation
There was a problem hiding this comment.
Thanks for this contribution, @ysjprojects.
I've run your changes locally, but I'm falling into some errors when generating new cells.
[Error: Binder Error: Prepared statement requires database but it was not attached]After this, the server crashes.
Not sure of the exact reason. Reading the docs, I see other ways to parameterize the queries.
I reckon the previous placeholder syntax is not supported in Node.js, I have changed it based on the doc |
|
I've tested the latest changes, and I'm still having similar errors: [Error: Binder Error: Parameter/argument count mismatch for prepared statement. Expected 1, got 0]
8:38:12 [vite] Internal server error: Binder Error: Parameter/argument count mismatch for prepared statement. Expected 1, got 0 |
Turned out the previous DuckDB Node API version was outdated and didn't support parameterization, after upgrading to the latest version the errors are resolved. While running the vitest script there was another error which can be attributed to the fact that creating a new table initializes 1000 rows by default. In order to pass the assertions in the test, the new table has to be emptied after creation in the test script (also resolved). |
|
@frascuchon made some changes, apparently you need to wrap duckdb.blobValue around Uint8Array before passing it to a prepared statement placeholder. Also added a test case to confirm that Uint8Array is successfully parameterized as BLOB |
frascuchon
left a comment
There was a problem hiding this comment.
Everything is working fine now.
Thanks @ysjprojects for your contribution.

Original:
null.