Note that there are some explanatory texts on larger screens.

plurals
  1. POsqlite3_exec returns 26 in linux
    text
    copied!<p>i am writing an application which encrypt the SQLITE3 database. for encryption i have used SQLCIPHER.i am able to perform encryption and decryption of Database from command line.i am writing the client app using c++. here is my code to test the key (used for encryption).</p> <pre><code>int main() { sqlite3 *DataBase; if(sqlite3_open("encrypted.db", &amp;DataBase)== SQLITE_OK) { int result = sqlite3_exec(DataBase, "PRAGMA KEY = 'testkey';", NULL, NULL, NULL); result = sqlite3_exec(DataBase,"SELECT user_id FROM USER;", NULL, NULL, NULL); if(result == SQLITE_OK) { cout&lt;&lt;"sqlite3_exec success"&lt;&lt;endl; } else { cout&lt;&lt;"sqlite3_exec failed"&lt;&lt;endl; cout&lt;&lt;"sqlite3_exec returns "&lt;&lt;result&lt;&lt;endl; } } } </code></pre> <p>i am able to the same using command line:</p> <pre><code>./sqlite3 encrypted.db PRAGMA key = 'testkey'; SELECT user_id FROM USER; </code></pre> <p>i have encrypted my access.db using:</p> <pre><code>./sqlite3 access.db sqlite&gt; ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey'; sqlite&gt; SELECT sqlcipher_export('encrypted'); sqlite&gt; DETACH DATABASE encrypted; </code></pre> <p>i dont get why i am able to do the same using command line and not by c++ code. please let me know if i am doing something wrong.</p> <p>please also let me know if i have to access the encrypted database then i should first decrypt it and then i should read the plaintext database, are there no API's which i could use directly to read encrypted database?</p> <p>any help is appreciated.</p> <p>thanks,</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload