Skip to content

Add a per-statement intMode option - #363

Open
colinhacks wants to merge 1 commit into
tursodatabase:mainfrom
colinhacks:per-statement-int-mode
Open

colinhacks wants to merge 1 commit into
tursodatabase:mainfrom
colinhacks:per-statement-int-mode

Conversation

@colinhacks

Copy link
Copy Markdown

intMode can only be set on the client, so a query that needs exact integers means changing the mode for every other query the client runs. A statement object can now carry its own:

const rs = await client.execute({
    sql: "SELECT id FROM events",
    intMode: "bigint",
});

It applies to execute(), batch(), migrate() and transactions, on local and remote databases. Arguments are bound under the statement's mode, as they are under the client's. The client default doesn't change.

Remote statements needed more than plumbing. A hrana stream decodes integers with the mode it has when a response arrives, so the statements of one batch or transaction all get one mode. When they need different ones, the stream switches to "bigint", which is exact, and each result is converted to its statement's mode. A request whose statements share a mode is decoded as before.

New tests cover execute(), a batch with mixed modes and a transaction. They pass against a local file and the v1 and v2 test servers over WebSocket and HTTP.

A statement object can now carry its own `intMode`, which overrides the
client's for that statement in `execute()`, `batch()`, `migrate()` and
transactions, on local and remote databases.

A hrana stream decodes integers with the mode it has when a response
arrives. When statements on one stream need different modes, the stream
switches to "bigint", which is exact, and each result is converted to its
statement's mode.
Copilot AI balanced review requested due to automatic review settings November 16, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

2 participants