I am using sql cipher in Qt and i want to encrypt an existing sqlite database.On the Api docs here: http://sqlcipher.net/sqlcipher-api#attach this is how to do it:
ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'secret'; -- create a new encrypted database
CREATE TABLE encrypted.t1(a,b); -- recreate the schema in the new database (you can inspect all objects using SELECT * FROM sqlite_master)
INSERT INTO encrypted.t1 SELECT * FROM t1; -- copy data from the existing tables to the new tables in the encrypted database
DETACH DATABASE encrypted;
ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'secret'; -- create a new encrypted database
CREATE TABLE encrypted.t1(a,b); -- recreate the schema in the new database (you can inspect all objects using SELECT * FROM sqlite_master)
INSERT INTO encrypted.t1 SELECT * FROM t1; -- copy data from the existing tables to the new tables in the encrypted database
DETACH DATABASE encrypted;
To copy to clipboard, switch view to plain text mode
The following two line confuse me:
CREATE TABLE encrypted.t1(a,b);
and
INSERT INTO encrypted.t1 SELECT * FROM t1;
What does (a,b) mean and why is it used in the first statement and not in the second?.
Thanks.
Added after 1 40 minutes:
Someone has suggested to me that the a,b could be table columns.I am looking into that.
Bookmarks