Re: [sqlite] Can't delete a row

2011-01-28 Thread John Delacour
I now have the script running as required on the remote server, apart from a couple of creases I'd like you to help me iron out. What I unwittingly held back, and which you would have picked up on straight way, was my connect routine, to which I added "{ RaiseError => 1, AutoCommit => 0 }" ea

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread Clark Christensen
- Original Message From: Puneet Kishor To: General Discussion of SQLite Database Sent: Fri, January 28, 2011 9:33:15 AM Subject: Re: [sqlite] EXTERNAL:Re: Can't delete a row >Because I find using bind values easier, clearer, and safer, even for >one-off execute statements. Me too.

Re: [sqlite] Can't delete a row

2011-01-28 Thread John Delacour
Google mail seems to have chosen a convenient moment to go AWOL. I wrote: print qq~\$q{BUTTON} was: $q{BUTTON}~; if ($q{BUTTON} =~ s~^Delete[^\d]+~~i){ print qq~\$q{BUTTON}=$q{BUTTON}~; ###my $rows = $dbh->do("DELETE FROM contacts WHERE rowid = $q{BUTTON}"); my $sth = $dbh->prepare(

Re: [sqlite] Can't delete a row

2011-01-28 Thread John Delacour
On 28 January 2011 16:37, I wrote: > Once I 'd deleted the second line it did work in the standalone > script.  But the duplication is not in the cgi version.  Nevertheless > now I am assured that it does work, I've just got to find what silly > mistake I've made in the main script.  I already have

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread John Delacour
At 11:33 -0600 28/01/2011, Puneet Kishor wrote: > > Why would you do this rather than use $dbh->do ? It seems to add a >> line of code to no purpose. > >Because I find using bind values easier, clearer, and safer, even for >one-off execute statements. Well, that makes sense. > > And besides,

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread Puneet Kishor
John Delacour wrote: > At 11:08 -0600 28/01/2011, Puneet Kishor wrote: > >> Can't really say what you are doing wrong, but you code is needlessly >> complicated; all those tildes are making my eyes swim. > > I also have difficulty interpreting escaped toothpicks, and I didn't > joint the sqlite l

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread John Delacour
At 11:08 -0600 28/01/2011, Puneet Kishor wrote: >Can't really say what you are doing wrong, but you code is needlessly >complicated; all those tildes are making my eyes swim. I also have difficulty interpreting escaped toothpicks, and I didn't joint the sqlite list to have my Perl style polished

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread Puneet Kishor
Black, Michael (IS) wrote: > Can someone please tell me what I'm doing wrong? > > > #!/usr/local/bin/perl > use strict; > use DBI qw(:sql_types); > my $database = "/Library/webserver/data/iceman.iceman"; > my $dbh = DBI->connect("dbi:SQLite:dbname=$database","","", { > RaiseError => 1, AutoCommi

Re: [sqlite] Can't delete a row

2011-01-28 Thread John Delacour
At 16:44 + 28/01/2011, Black, Michael (IS) wrote: >Me thinkst you need to put singled quotes around $q{BUTTON}. > >my $rows = $dbh->do("DELETE FROM contacts WHERE rowid =\'$q{BUTTON}\'"); SInce the statement is in double quotes I surely wouldn't want to escape the single quotes, but, as I sa

Re: [sqlite] EXTERNAL:Re: Can't delete a row

2011-01-28 Thread Black, Michael (IS)
Never mind me...with my pigeon perl I shouldn't have spoken up...since rowid is numeric no quotes needed. I was looking at the original string assignment. and thinking it was string compare. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate _

Re: [sqlite] Can't delete a row

2011-01-28 Thread Black, Michael (IS)
Me thinkst you need to put singled quotes around $q{BUTTON}. my $rows = $dbh->do("DELETE FROM contacts WHERE rowid =\'$q{BUTTON}\'"); You also don't appear to be checking for any errorwhich you should be seeing. I don't Perl/DBI well enough to show how to do that one. Michael D. Black Sen

Re: [sqlite] Can't delete a row

2011-01-28 Thread John Delacour
On 28 January 2011 16:19, Simon Slavin wrote: > I strongly suspect that your value for $q{BUTTON} is wrong.  Can you add a > diagnostic like to display it ? Yes, I realised immediately after posting that I had duplicated the substitution in the stand-alone script so obviously the 'if' returned

Re: [sqlite] Can't delete a row

2011-01-28 Thread Simon Slavin
On 28 Jan 2011, at 4:05pm, John Delacour wrote: > When I run the statement in the sqlite command line the row is > deleted but I get no result and no deletion from running the routine > below either independently or in the html page. I strongly suspect that your value for $q{BUTTON} is wrong.

[sqlite] Can't delete a row

2011-01-28 Thread John Delacour
I thought I was making a bit of progress but I've come up against a brick wall trying to do what appears to be the most simple thing. A button pressed in the page to delete a selected record is stripped of its display name to become simply the rowid. When I run the statement in the sqlite comm

Re: [sqlite] Boost copy from one table to another ?

2011-01-28 Thread Max Vlasov
On Fri, Jan 28, 2011 at 11:38 AM, Pierre Chatelier wrote: > > But I wondered if I could improve the performance with the following scheme > : > my disk DB is B > I create a memory DB, with the same structure, named A > I attach B to A > then in a a loop >I insert the rows in A >When A is b

[sqlite] Boost copy from one table to another ?

2011-01-28 Thread Pierre Chatelier
Hello, I have some data to transfer from table A to table B (same structure). "INSERT INTO B SELECT * FROM A" works ok. However, the performance is comparable to a loop inserting rows one by one. I thought that such a bulk copy could perform better with internal optimizations. Is there a way to p