Page MenuHomePhabricator

[SQLite] implement method to copy table between databases
ClosedPublic

Authored by kamil on Thu, Apr 3, 2:37 AM.
Tags
None
Referenced Files
F5576152: D14517.id47639.diff
Sat, Apr 12, 6:36 PM
Unknown Object (File)
Fri, Apr 11, 4:11 AM
Unknown Object (File)
Thu, Apr 10, 11:35 PM
Unknown Object (File)
Thu, Apr 10, 6:34 PM
Unknown Object (File)
Wed, Apr 9, 8:29 PM
Unknown Object (File)
Wed, Apr 9, 12:01 PM
Unknown Object (File)
Wed, Apr 9, 1:39 AM
Unknown Object (File)
Wed, Apr 9, 12:30 AM
Subscribers

Details

Summary

ENG-10489.

Depends on D14516

Test Plan

Tested later in the stack, existing tables (e.g. olm_persist_account) are not overwritten during restore

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Thu, Apr 3, 3:10 AM
kamil added inline comments.
native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
3313 ↗(On Diff #47622)

We need to use this only on not-encrypted databases, see next diff in the stack

3317 ↗(On Diff #47622)

We want OR IGNORE statement to skip duplicated primary keys, the example is a thread with Ashoat, which is created for each user (we won't include thin thread data in backup, but we do now, so without this each copy statement could fail)

native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
58 ↗(On Diff #47622)

We might want to have a custom copy method (by specifying fields), e.g. for messages where we have one generated column

Don't we want this method to take a vector of tables to copy? Looking at D14519, I see you're running this in a loop, so the ATTACH DATABASE ..., DETACH statements are repeated for each table

kamil planned changes to this revision.Thu, Apr 3, 3:55 AM

Don't we want this method to take a vector of tables to copy? Looking at D14519, I see you're running this in a loop, so the ATTACH DATABASE ..., DETACH statements are repeated for each table

Good call

This revision is now accepted and ready to land.Thu, Apr 3, 7:25 AM