denodrivers / denodrivers/sqlite3

Unable to read values with NUL in them

Open
#158 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
312
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Using `jsr:@db/sqlite@0.13.0`, I'm unable to read values from the DB if they contain a NUL in them (the value is truncated)

```ts
import * as sqlite from 'jsr:@db/sqlite'

const db = new sqlite.Database('./example.db')
db.run('CREATE TABLE IF NOT EXISTS Data(key TEXT NOT NULL PRIMARY KEY, value TEXT NOT NULL)')
const readStatement = db.prepare('SELECT value FROM Data WHERE key = ?')
const writeStatement = db.prepare('REPLACE INTO Data(key, value) VALUES(?, ?)')

writeStatement.run('foo', 'bar\x00baz')
console.error(readStatement.get('foo'))
// Result is `{ value: "bar" }` but it should have been `{ value: "bar\x00baz" }`, or a buffer with "bar\x00baz"
// Opening the DB with SQLite shows the correct values
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.