tauri-apps / tauri-apps/plugins-workspace

[sql] allow using prepared statement more than once

Open
#1,896 0 comments 0 reactions 0 assignees View on GitHub
plugin: sql type: feature request
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Currently, I can use a query with params only once with sqlite:

```
await db.execute(
"INSERT INTO team (id, name, created_at) VALUES ($1, $2, $3);",
[team.id, team.name, team.created_at]
);
```

But, if I want to insert a lot of data, I have to make a loop where I re-prepare and execute the statement.
In terms of performance, it could be great if we could use one prepared statement, then loop over it!

```
const stmt = await db.prepare("INSERT INTO team (id, name, created_at) VALUES ($1, $2, $3);");

// Then loop over elements:
await stmt.execute([x._id, x.name, x.person, x.dueAt, x.completedAt, x.createdAt]);
```

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.