tauri-apps / tauri-apps/plugins-workspace
[sql] Allows one of multiple identical connections to be close
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
I'm making a database client that uses `data.sqlite` itself to store the client's data, and everything is fine, but it can't use `data.sqlite` again, otherwise when I shut it down it will shut down the client's own database as well, which we can't control because they use the same `path`.
```ts
let db1 = await Database.load('sqlite:/.../db.sqlite')
let db2 = await Database.load('sqlite:/.../db.sqlite')
// Only close db1
db1.close(db1.path)
// Error: attempted to acquire a connection on a closed pool
db2.select(`SELECT name FROM ...`)
```
Maybe we should use an `ID` to close the connection instead of `path` ?
```ts
let db = await Database.load('sqlite:/.../db.sqlite')
// {
// path: '...',
// id: 0
// }
// Use db.id close
db.close()
```
Contributor guide
Assessment
This issue has not been assessed yet.