luislavena/sqlite3-ruby — Issue #52: Bignums are corrupted when using parameters binding
Author: evgeny-myasishchev
Created: 2011-11-13 11:53:41+00:00
State: open

# Some bignums are got corrupted when binding them as parameters.

The issue is reproduced at Mac OSX 10.6 and 10.7. The issue is NOT reproduced at 32 bit ubuntu and 32 bit Windows 7.
I've created tests to reproduce the issue. You can find them here: [failing-int8-with-sqlite3-gem](https://github.com/evgeny-myasishchev/failing-int8-with-sqlite3-gem)

## Description

Suppose we have schema like:

```
CREATE TABLE "employees" ("token" integer(8), "name" varchar(20) NOT NULL)
```

When executing SQL like:

```
INSERT INTO Employees(name, token) VALUES('employee-1', 4907021672125087844)
```

The result will be as expected. Token’s value will be: 4907021672125087844

When doing the same using parameters binding like:

```
db.execute "INSERT INTO Employees(name, token) VALUES('employee-1', ?)", [4907021672125087844]
```

Token’s value will be: 4907021672125087744 (note last last three digits expected: 844, actual 744). The same result will be with other numbers as well.