2

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?.

asked Oct 18, 2011 at 16:40
1
  • Someone suggested that a,b are the table columns. Commented Oct 18, 2011 at 17:15

1 Answer 1

3

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:

  1. The first line attaches a new encrypted database.
  2. Next, a second table is created in the encrypted database with the same name and column specification.
  3. 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.

answered Oct 18, 2011 at 19:23
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.