sqlite integer parameters should not be bound as doubles
未关闭
还没有人认领这个 Issue。
question
sqlite
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
Version
v26.2.0
Platform
Darwin rocksteady 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:40:51 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T8112 arm64
Subsystem
sqlite
What steps will reproduce the bug?
I am assuming parameters that are number are always bound as type double, but integers should be bound as type integer so that SQLite performs integer arithmetic and returns a type of integer instead of a type of double.
const db = new DatabaseSync(':memory:', { readBigInts: true });
const big = db.prepare('select 2 * 2');
const bigResult = big.all();
const notBig = db.prepare('select 2 * ?');
const notResult = notBig.all(2);
This is the offending code in nodejs:
https://github.com/nodejs/node/blob/19c46abbefdb8711b913d7237b3c1299367f87d7/src/node_sqlite.cc#L2703
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
Integers should be bound as integers not double as they are integers.
What do you see instead?
Integers being bound as double.
Additional information
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 src/node_sqlite.cc 中链接的参数绑定代码开始,使用提供的 DatabaseSync 示例重现该问题。验证数值参数在传递给 SQLite 之前是如何分类的。当整数参数产生 SQLite 整数运算,并且报告的 readBigInts 行为已由回归测试覆盖时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js, sqlite
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 68/100