I am following the example at the sqlcipher Api docs : http://sqlcipher.net/sqlcipher-api#attach
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;
The first line CREATE TABLE encrypted.t1(a,b); has (a,b) and the second
INSERT INTO encrypted.t1 SELECT * FROM t1; does not.
Why is there an(a,b) in the first line and what is it for?.
-
Someone suggested that a,b are the table columns.Gandalf– Gandalf2011年10月18日 17:15:07 +00:00Commented Oct 18, 2011 at 17:15
1 Answer 1
In this case a and b are the column names. The introduction to that example in the docs explains the important point "assume you have a standard SQLite database called unencrypted.db with a single table, t1(a,b)." Then:
- The first line attaches a new encrypted database.
- Next, a second table is created in the encrypted database with the same name and column specification.
- The third line selects all the data out of the original table and inserts it into the new table in the encrypted database.
Because the columns on the two tables are identical it is not necessary to list the table columns explicitly.