mattn / mattn/mruby-sqlite3

negative value over 0x40000000 at Integer

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
20
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Sorry Japanese.

以下のようなmrubyスクリプトでクエリすると30ビット目が立った値がマイナスになるようです。

sel = "select * from fw_sw"
whe = " where datetime(date, time, 'localtime')=?"

db.execute(sel + whe, "2026-02-16 15:43:01") do |row, fields|
p row
val[i] = row
i = i + 1
end

["2026-02-16", "06:43:01", -1072953691, 396496091, 14287984, 19130282, 628332003, 0]

sqlite3コマンドでは正の値が返ります。

2026-02-16|06:43:01|1074529957|396496091|14287984|19130282|628332003|0

マイナスになったら0x80000000を足すというワークアラウンドもできるのですが、仕様となりますか?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the db.execute call in the mruby script and trace how SQLite integer results become mruby Integer values in this binding. Compare the returned value with the sqlite3 command output for the same query, and consider the issue done when the high-bit integer behavior is resolved or clearly documented as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.