Please read the last part of my response again:
Do you mean you have a plaintext SQLite database and are attempting to encrypt it?
If you’re attempting to encrypt an existing plaintext SQLite database, you’ll want to have a look at the sqlcipher_export() 1 convenience function
The code you posted won’t work for encrypting an already existing SQLite database. You need to sqlite3_exec the command shown in the sqlcipher_export() post to be able to encrypt a plain text SQLite database.
There’s more explanation here: How to encrypt a plaintext SQLite database to use SQLCipher (and avoid “file is encrypted or is not a database” errors)
Cheers,
Micah