Skip to content

fix(ext/node): implement sqlite' SQLTagStore#31945

Merged
Tango992 merged 13 commits intodenoland:mainfrom
Tango992:fix-node-sqlite-template-tag
Jan 30, 2026
Merged

fix(ext/node): implement sqlite' SQLTagStore#31945
Tango992 merged 13 commits intodenoland:mainfrom
Tango992:fix-node-sqlite-template-tag

Conversation

@Tango992
Copy link
Copy Markdown
Contributor

@Tango992 Tango992 commented Jan 25, 2026

Implementation is based on Node.js v24.12.0

It passes test cases on https://github.com/nodejs/node/blob/v24.12.0/test/parallel/test-sqlite-template-tag.js, but since we don't yet implement beforeEach of node:test the test will fail. I ported the tests to our node unit tests.

@Tango992 Tango992 marked this pull request as ready for review January 28, 2026 07:44
@Tango992 Tango992 marked this pull request as draft January 28, 2026 09:10
@Tango992 Tango992 added the ci-draft Run the CI on draft PRs. label Jan 28, 2026
@Tango992 Tango992 marked this pull request as ready for review January 28, 2026 10:13
let db = db.as_ref().ok_or(SqliteError::AlreadyClosed)?;

v8_static_strings! {
LAST_INSERT_ROW_ID = "lastInsertRowid",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this a typo? Shouldn't it be lastInsertRowId?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at Node's code it seems it's not

r: i32,
db: *mut ffi::sqlite3,
) -> Result<(), SqliteError> {
if r != ffi::SQLITE_OK {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nitpick for the future - use early returns instead of big if statements

}
});

Deno.test("sql.run inserts data", () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we just update our suite instead of adding a test manually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you mean we should omit the beforeEach and paste it on each test case on our suite? Wouldn't it be overwritten once we bump the node version?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, sorry. I thought the problem was the test is only avilable in latest Node.js checkout, but we actually don't support this API

@Tango992 Tango992 merged commit 3246e10 into denoland:main Jan 30, 2026
31 of 53 checks passed
@Tango992 Tango992 deleted the fix-node-sqlite-template-tag branch January 30, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run the CI on draft PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants