On 12 Dec 2016, at 1:00pm, Baugher, Melody <mbaug...@dcscorp.com> wrote:

> Starting with an encrypted database, if I run this code twice in a row with 
> applyPassword=false, the password is removed the first time but then applied 
> the second time.

Your program is weird and buggy.  There is one big test in the program:

>  if (applyPassword)

Before this test is done, the program carefully constructs a command in the 
variable "passwordPragma" but uses it only if "applyPassword" is /not/ true.  
It then immediately issues

> connection.ChangePassword("");

which would undo the change it just made.

It also has several things inside the test (create a connection, use 
"activatePragma") which are done whether the test is true or false.  They 
should be moved outside the test.

Now I’ve told you that the program is weird take a look through it, tidy up the 
logic, and write a better one.

[What’s really amusing here is that decades of programming experience let me 
read that program even though I have never used whatever programming language 
it’s written in or the API it uses.]

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to