Re: [sqlite] ChangePassword method problem

2011-10-30 Thread Farhan Husain

Ok, so I created a simple program to test the changepassword method. Here it is:
using System;using System.IO;using System.Text;using System.Data.SQLite;
namespace SQLiteTest{class Program{static void Main(string[] 
args){// Create an encrypted databasestring 
connectionString = "Data Source=test.db; Password='password'";
using (SQLiteConnection conn = new 
SQLiteConnection(connectionString)){conn.Open();
// Explicitly close the connectionconn.Close(); 
   }
// Open and close the database againusing 
(SQLiteConnection conn = new SQLiteConnection(connectionString)){   
 conn.Open();// Explicitly close the connection 
   conn.Close();}
// Open, change the password and then close the database
using (SQLiteConnection conn = new SQLiteConnection(connectionString))  
  {conn.Open();
conn.ChangePassword("changed");
// Explicitly close the connectionconn.Close(); 
   }
// Try to open and close the database again
connectionString = "Data Source=test.db; Password='changed'";
using (SQLiteConnection conn = new 
SQLiteConnection(connectionString)){// CRASHES HERE 
WITH EXCEPTION// File is not a database
conn.Open();// Explicitly close the connection
conn.Close();}
// Delete the database fileif (File.Exists("test.db"))  
  File.Delete("test.db");}}}
It basically works all the way up to the "CRASHES HERE" part. Now, if the 
password had actually changed then the program should work but unfortunately it 
doesn't (or something else is going wrong). Again, Maybe I am doing something 
incorrectly so I kept it simple just to check.
Visual Studio 2010, Debug x86, .NET 4.0 Client Profile, 
sqlite-netFx40-binary-bundle-Win32-2010-1.0.76.0
Thanks..

> From: cooljac...@hotmail.com
> To: sqlite-users@sqlite.org
> Date: Mon, 24 Oct 2011 03:55:03 +
> Subject: Re: [sqlite] ChangePassword method problem
> 
> 
> Sorry, I should clarify, I meant the chances of the database corruption. You 
> are right, in a properly designed system the access to the database would 
> take into account a changed password, which would be the normal scenario. 
> But, if there is even a small possibility that a database would be 
> "corrupted" because of an extraneous connection (regardless of how well the 
> system is designed), then it could be a problem. The database being 
> unreadable due to a wrong password is good because it is functioning the 
> right way like you stated. It shouldn't however become corrupt.
> Again, I am quite sure it is simply something that I am doing wrong on my end 
> so I need to revisit all the codepaths for this procedure in my code.
> Thanks!
> 
> > From: slav...@bigfraud.org
> > Date: Mon, 24 Oct 2011 04:45:24 +0100
> > To: sqlite-users@sqlite.org
> > Subject: Re: [sqlite] ChangePassword method problem
> > 
> > 
> > On 24 Oct 2011, at 4:42am, Farhan Husain wrote:
> > 
> > > So, I was just wondering how you would deal with multiple processes 
> > > accessing the database. You can't guarantee that all would be closing the 
> > > connection properly. It would seem that if all connections needed to be 
> > > closed before a proper changepassword call can take place, then the 
> > > chances of database corruption would increase in a 
> > > multi-process/multi-access environment.
> > 
> > How did you expect it to work when you designed the system ?  After all, 
> > changing the password to a database when lots of other processes are 
> > reading it would naturally cause problems for those processes.  They would 
> > all suddenly start generating errors because they'd be unable to access 
> > their data.
> > 
> > Simon.
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Expert

2011-10-30 Thread Jean-Christophe Deschamps



On 30 Oct 2011, at 7:50pm, Abair Heart wrote:

> Searching the archives implies, that "sqlite expert" hasn't been asked
> about.
>
> Has anyone tried it yet?  Is the program safe? time-saving?

Give me the $59 and a Windows computer and I'll check it out.

Simon.


As a long-term fan user of SQLite Expert, I can vouch it's one of the 
very best if not the best Windows-based SQLite manager.  I just can't 
live without and use it hourly.


The program is not only "safe" (don't know what you meant here) but 
guaranteed free of any kind of nasties even in its freeware 
version.  It also uninstalls cleanly.


Browse thru the release history and you'll see that the author is 
highly commited to following both SQLite evolution and what the users 
require or report.  Trust me: Bogdan fixes issues/bugs/requests faster 
than any open/closed, free/commercial product I know of.


As a disclaimer, I'll add that the author has become a friend over time 
and discussions about SQLite and Expert matters.


Nevertheless, my opinion is also factual and you can try it without 
fear.  I highly recommend to users getting any seriously into SQLite to 
consider switching to the paid version, just like what I did years 
ago.  It's easy to see why: say you value your time at, say, $15/hour, 
it only takes 4 hours saved to start paying back.  Given that the rich 
features it offers save you ample time very quickly, your investment is 
a winner.


For those not requiring the payware features, try the freeware version, 
no risk.


Don't ask: this isn't a shameless plug, I constantly stand behind what 
I say in full honesty. 


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Expert

2011-10-30 Thread Simon Slavin

On 30 Oct 2011, at 7:50pm, Abair Heart wrote:

> Searching the archives implies, that "sqlite expert" hasn't been asked
> about.
> 
> Has anyone tried it yet?  Is the program safe? time-saving?

Give me the $59 and a Windows computer and I'll check it out.

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


[sqlite] SQLite Expert

2011-10-30 Thread Abair Heart
Hi all,

Searching the archives implies, that "sqlite expert" hasn't been asked
about.

Has anyone tried it yet?  Is the program safe? time-saving?


Thanks for any input.

Abair
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Slow inserts with UNIQUE

2011-10-30 Thread Black, Michael (IS)
One more thing...show us the EXPLAIN of your insert.  Is sounds like your 
insert is not using the index for the insert for some reason (buq in sqlite?).

You should see #3 in particular for keyinfo().



On 3.7.5 with a unique text column I get this for an insert:

sqlite> explain insert into a values('String string string2');
addr  opcode p1p2p3p4 p5  comment
  -        -  --  -
0 Trace  0 0 000
1 Goto   0 18000
2 OpenWrite  0 2 0 1  00
3 OpenWrite  1 3 0 keyinfo(1,BINARY)  00
4 NewRowid   0 3 000
5 String80 4 0 String string string2  00
6 SCopy  4 5 000
7 SCopy  3 6 000
8 MakeRecord 5 2 1 ab 00
9 SCopy  3 7 000
10IsUnique   1 127 5  00
11Halt   192 0 column t is not unique  00
12IdxInsert  1 1 010
13MakeRecord 4 1 7 a  00
14Insert 0 7 3 a  1b
15Close  0 0 000
16Close  1 0 000
17Halt   0 0 000
18Transaction0 1 000
19VerifyCookie   0 2 000
20TableLock  0 2 1 a  00
21Goto   0 2 000





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Fabian [fabianpi...@gmail.com]
Sent: Saturday, October 29, 2011 12:11 PM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Slow inserts with UNIQUE

2011/10/29 Simon Slavin 

>
> When you insert the 10,000 strings are you doing it inside a transaction ?
>
> BEGIN TRANSACTION;
> INSERT ...
> INSERT ...
> INSERT ...
> COMMIT;
>
>
Yes, I use transactions, prepared statements, cache_size, journal_mode and
synchronous PRAGMA's, almost everything you can think of to make it faster.

But most important: I use the exact same code to fill the initial million
rows, so if there was anything wrong, the initial filling would be slow too
I suppose?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Slow inserts with UNIQUE

2011-10-30 Thread Black, Michael (IS)
You need to provide some more info...



#1 What version?

#2 How long to insert the 1M?

#3 What's the average string size?

#5 How long to create the index?

#6 How long to insert the next 10,000?





And your stated problem is simple enough you should be able to create a 
complete stand-alone example so we can all see and test what you're 
(presumably) doing wrong.







Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Fabian [fabianpi...@gmail.com]
Sent: Saturday, October 29, 2011 12:11 PM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Slow inserts with UNIQUE

2011/10/29 Simon Slavin 

>
> When you insert the 10,000 strings are you doing it inside a transaction ?
>
> BEGIN TRANSACTION;
> INSERT ...
> INSERT ...
> INSERT ...
> COMMIT;
>
>
Yes, I use transactions, prepared statements, cache_size, journal_mode and
synchronous PRAGMA's, almost everything you can think of to make it faster.

But most important: I use the exact same code to fill the initial million
rows, so if there was anything wrong, the initial filling would be slow too
I suppose?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users