Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement DELETE for SQLite backend #2907

Merged
merged 54 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f0f7b79
WIP
Jun 26, 2023
bf4fd41
WIP
Jun 26, 2023
687e566
WIP
Jun 26, 2023
ec75f20
WIP
Jun 26, 2023
3466a13
WIP
Jun 26, 2023
6002aeb
WIP
Jun 26, 2023
d65c48d
Merge remote-tracking branch 'origin/issue-2751-sqlite-delete' into i…
Jun 26, 2023
d99302a
WIP
Jun 26, 2023
f7edb5a
WIP
Jun 26, 2023
b957c63
WIP
Jun 26, 2023
feb245c
WIP
Jun 26, 2023
71fb4e6
Merge branch 'main' into issue-2751-sqlite-delete
Jun 26, 2023
6896603
Merge branch 'main' into issue-2751-sqlite-delete
AlekSi Jun 27, 2023
7d84736
WIP
Jun 27, 2023
164be8d
WIP
Jun 27, 2023
f8da642
WIP
Jun 27, 2023
56cce2b
Merge branch 'main' into issue-2751-sqlite-delete
Jun 27, 2023
ac4e473
WIP
Jun 27, 2023
a95761e
WIP
Jun 27, 2023
73ec495
WIP
Jun 27, 2023
81b9595
WIP
Jun 27, 2023
3788bec
Apply suggestions from code review
Jun 27, 2023
3b71372
WIP
Jun 28, 2023
3d03875
WIP
Jun 28, 2023
f0436a6
Merge branch 'main' into issue-2751-sqlite-delete
Jun 28, 2023
0a1d4c8
Merge branch 'main' into issue-2751-sqlite-delete
Jun 28, 2023
73fed90
WIP
Jun 28, 2023
98de1cf
WIP
Jun 28, 2023
bebad9b
WIP
Jun 28, 2023
1c2ca9a
WIP
Jun 28, 2023
138e700
Merge branch 'main' into issue-2751-sqlite-delete
Jun 28, 2023
70e68a8
WIP
Jun 28, 2023
3f8915f
Merge branch 'issue-2751-sqlite-delete' of https://github.com/w84thes…
Jun 28, 2023
d13635b
WIP
Jun 28, 2023
6353c93
WIP
Jun 28, 2023
19bb608
WIP
Jun 28, 2023
398d51a
WIP
Jun 28, 2023
d8dc923
WIP
Jun 28, 2023
2f929a3
WIP
Jun 28, 2023
cab52da
WIP
Jun 28, 2023
f2b14ce
WIP
Jun 28, 2023
722e89e
Merge branch 'main' into issue-2751-sqlite-delete
Jun 28, 2023
311d6fc
WIP
Jun 28, 2023
4205b56
Merge remote-tracking branch 'origin/issue-2751-sqlite-delete' into i…
Jun 28, 2023
6ef1ce2
Merge branch 'main' into issue-2751-sqlite-delete
AlekSi Jun 29, 2023
28fffde
WIP
Jun 29, 2023
0e75924
Merge remote-tracking branch 'origin/issue-2751-sqlite-delete' into i…
Jun 29, 2023
263388e
Merge branch 'main' into issue-2751-sqlite-delete
Jun 29, 2023
296029d
WIP
Jun 29, 2023
0090d32
Merge remote-tracking branch 'origin/issue-2751-sqlite-delete' into i…
Jun 29, 2023
f527db4
WIP
Jun 29, 2023
fe07ff2
WIP
Jun 29, 2023
822c08b
Merge branch 'main' into issue-2751-sqlite-delete
Jun 30, 2023
1a0c84b
Merge branch 'main' into issue-2751-sqlite-delete
AlekSi Jun 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
Dmitry committed Jun 26, 2023
commit 6002aeb4562424c92fff35537ed77a35a3714676
5 changes: 4 additions & 1 deletion internal/backends/sqlite/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
"strings"

"modernc.org/sqlite"
sqlitelib "modernc.org/sqlite/lib"
Expand Down Expand Up @@ -185,7 +186,9 @@ func (c *collection) Delete(ctx context.Context, params *backends.DeleteParams)
var deleted int64

for _, id := range params.IDs {
res, err := db.ExecContext(ctx, query, id)
idArg := strings.ReplaceAll(string(must.NotFail(sjson.MarshalSingleValue(id))), "\"", "")
chilagrow marked this conversation as resolved.
Show resolved Hide resolved

res, err := db.ExecContext(ctx, query, idArg)
if err != nil {
return nil, lazyerrors.Error(err)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/handlers/sqlite/msg_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ func execDelete(ctx context.Context, dp *execDeleteParams) (int32, error) {
return 0, nil
}

// close iterator to free db connection.
iter.Close()

deleteRes, err := dp.coll.Delete(ctx, &backends.DeleteParams{IDs: ids})
if err != nil {
return 0, err
Expand Down