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

sqlcipher_export() behaviour with existing output file #646

Open
finiasz opened this issue May 6, 2024 · 1 comment
Open

sqlcipher_export() behaviour with existing output file #646

finiasz opened this issue May 6, 2024 · 1 comment

Comments

@finiasz
Copy link

finiasz commented May 6, 2024

Expected Behavior

When running an sqlcipher_export() command, if the output file already exists, I would expect the command to either completely overwrite the content of the database, or fail with an exception. Failing with an exception seems to be the safe choice.

Actual Behavior

Current implementation does not fail, but also does not copy the database content. It is not completely clear to me what the operation does, but it looks like the content of the existing file remains untouched.

Steps to Reproduce

SQLCipher version (can be identified by executing PRAGMA cipher_version;): 4.5.6 community

SQLCipher for Android version: 4.5.6

Are you able to reproduce this issue within the SQLCipher for Android test suite?

Sorry, I haven't tried that yet, but there is no reason why it should not be reproducible.

@sjlombardo
Copy link
Member

Hello @finiasz - sqlcipher_export does trigger an error if it is unable to copy the data into the target database. This is not based on whether the file exists, but on whether it is able to copy the database objects and data into the target. If there are collisions (e.g. the target database already has a table of the same name) then an error occurs.

If you are not seeing this behavior, please make a reproduction in the test suite so we can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants