Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Can't query SQLite in a while loop

by armstd (Friar)
on Sep 17, 2011 at 13:57 UTC ( #926546=note: print w/replies, xml ) Need Help??

in reply to Can't query SQLite in a while loop

There are a couple issues with this code that are unrelated to your specific problem, but important to resolve:

my $db_attr = {RaiseError => 1, PrintError => 1}; my $db_error = $DBI::errstr; $dbh = DBI->connect("dbi:SQLite:$name_db","","",$db_attr); if (defined($db_error) && $db_error ne " ") {

First, it looks like you're not checking for connect errors properly. What would you expect to see in $db_error after connect? Second, you're using RaiseError, and checking $DBI::errstr. That is why it's clear these issues are unrelated to your specific problem. You'd be getting an exceptions anyway. You should pick one error or exception mechanism and go with it, not both.


Replies are listed 'Best First'.
Re^2: Can't query SQLite in a while loop
by josef (Acolyte) on Sep 18, 2011 at 12:19 UTC
    Hallo armstd, you are right. I will change to PrintError => 0, RaiseError => 0. I found more example about on the Perl DBI book from Q`Reilly Many thanks for your comment.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://926546]
[marioroy]: Hi Discipulus. Running parallel on the Windows platform is painful. So, tried something and shared a possible solution.
[Discipulus]: yes, I immediately try to adapt some of your precedent examples.. but with no success and I'm not able to debug/modify them ;=(
[Discipulus]: all is well with you? new job? new cello?
[marioroy]: There were no annoucement, but MCE::Shared 1.831 is completed and released. It contains the new MCE::Hobo, providing ->init.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2017-09-22 09:35 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (260 votes). Check out past polls.