capacitor-community / capacitor-community/sqlite

bug: executeSet does not support blobs

Open
#642 4 comments 0 reactions 0 assignees View on GitHub
bug/fix
Dominant language
Swift
Stars
661
Forks
158
PR merge metrics
No merged PRs in 30d

Description

**Plugin version:**
"@capacitor-community/sqlite": "^7.0.0"

**Platform(s):**
Just tested on Android, don't know about iOS and Electron.

**Current behavior:**
Let's assume the following code:
```
const statement = `INSERT INTO ${tableName} (id, blob) VALUES (?, ?);`;
const values = [[1, myBlob1], [2, myBlob2]]
const result = await this.db.executeSet([{statement, values}], true);
```
This results in a parsing error ("unexpected character '{').

My blobs are of type Buffer. Those work fine with the run command, but if I want to mass insert data with executeSet, they don't work.

**Expected behavior:**
Blobs can be used in executeSet as well.

**Steps to reproduce:**
See above

**Related code:**
I debugged the plugin, and I found out that in the code of the "run" statement the method "objectJSArrayToArrayList" from the file "UtilsSQLite.java" is called. This method is recognizing objects of type "Buffer" and is parsing the data from it.
This method is not called during "executeSet".

**Other information:**
Are blobs of type Buffer intentionally not supported or did so far just nobody need this yet? Or should I use executeSet somehow differently to make it work?

**Capacitor doctor:**

```
Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Installed Dependencies:

@capacitor/cli: 7.0.1
@capacitor/android: 7.0.1
@capacitor/ios: 7.0.1
@capacitor/core: 7.0.1

[success] Android looking great! 👌
[error] Xcode is not installed
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.