Skip to main content

export_plaintext_copy

Function export_plaintext_copy 

Source
pub fn export_plaintext_copy(
    conn: &Connection,
    dest_path: &Path,
    tables: &[&str],
) -> DbResult<()>
Expand description

Creates a plaintext (unencrypted) copy of an already-open encrypted database.

The copy is produced by ATTACH-ing a new unencrypted database and copying the caller-specified tables via CREATE TABLE ... AS SELECT *. The destination file must not already exist.

We use ATTACH + SQL instead of the sqlite3_backup API because sqlite3mc requires both source and destination to share the same encryption configuration. Since the destination is unencrypted, the backup API cannot be used.

ยงErrors

Returns Error if the ATTACH, copy, or DETACH fails.