Re: prepare(SELECT ... FROM TABLE) error

2010-02-13 Thread Dr.Ruud
Jay Savage wrote: Dr.Ruud: Because $@ is a global, it is best practice to act on the return value of eval itself: [snip] $@ is also *guaranteed*--in the words of perlfunc--to be set correctly. I believe that historically this may not have been the case: $@ may have only been set on failure

Re: prepare(SELECT ... FROM TABLE) error

2010-02-10 Thread Dr.Ruud
Jay Savage wrote: Wrap the call in an eval block. Then check $@ to see if there was a fatal error, which you can ignore if you want to or do something along the lines of: eval { my $sth = $dbh-prepare(SELECT COUNT(*) FROM mytable); }; if ($@) { print Table $table

Re: prepare(SELECT ... FROM TABLE) error

2010-02-10 Thread Jay Savage
On Tue, Feb 9, 2010 at 8:05 PM, Dr.Ruud rvtol+use...@isolution.nl wrote: Jay Savage wrote: [snip] Because $@ is a global, it is best practice to act on the return value of eval itself: [snip] $@ is also *guaranteed*--in the words of perlfunc--to be set correctly. I believe that

Re: prepare(SELECT ... FROM TABLE) error

2010-02-10 Thread Jeff Peng
On Thu, Feb 11, 2010 at 2:03 AM, Jay Savage daggerqu...@gmail.com wrote: $@ is also *guaranteed*--in the words of perlfunc--to be set correctly. I believe that historically this may not have been the case: $@ may have only been set on failure and not flushed on success, but in recent Perls it

Re: prepare(SELECT ... FROM TABLE) error

2010-02-09 Thread Jay Savage
On Wed, Feb 3, 2010 at 9:22 PM, Tony Esposito tony1234567...@yahoo.co.uk wrote: This question has never been answered.  To out it another way, given the code ...  foreach my $mytable (@mytables) {  my $sth = $dbh-prepare(SELECT COUNT(*) FROM mytable);  # report error but move on to next

Re: prepare(SELECT ... FROM TABLE) error

2010-02-05 Thread Dr.Ruud
Tony Esposito wrote: This question has never been answered. To out it another way, given the code ... foreach my $mytable (@mytables) { my $sth = $dbh-prepare(SELECT COUNT(*) FROM mytable); # report error but move on to next table } how do I ignore the situation/error that DBI throws

Re: prepare(SELECT ... FROM TABLE) error

2010-02-03 Thread Tony Esposito
not exist and just move on to the next table? --- On Mon, 1/2/10, Tony Esposito tony1234567...@yahoo.co.uk wrote: From: Tony Esposito tony1234567...@yahoo.co.uk Subject: Re: prepare(SELECT ... FROM TABLE) error To: Beginners Perl beginners@perl.org, 7 7stud.7s...@gmail.com Date: Monday, 1 February

Re: prepare(SELECT ... FROM TABLE) error

2010-02-02 Thread 7
On Mon, Feb 1, 2010 at 1:40 PM, Tony Esposito tony1234567...@yahoo.co.uk wrote: Is this the idea? I do not ever want to catch the error from the prepare statement itsel I thought you said the program fails if you don't catch the error? If so, and you want your program to continue executing,

prepare(SELECT ... FROM TABLE) error

2010-02-01 Thread Tony Esposito
when the table does not exist the prepare fails.  How do ignore the error thrown by the prepare() and catch it later in the program?     my $dbh = DBI-connect(dbi:ODBC:mysql   ,$login ,$passwd ,{ RaiseError = 0 }  

Re: prepare(SELECT ... FROM TABLE) error

2010-02-01 Thread 7
On Mon, Feb 1, 2010 at 12:11 PM, Tony Esposito tony1234567...@yahoo.co.ukwrote: when the table does not exist the prepare fails. How do ignore the error thrown by the prepare() and catch it later in the program? my $dbh = DBI-connect(dbi:ODBC:mysql ,$login

Re: prepare(SELECT ... FROM TABLE) error

2010-02-01 Thread Tony Esposito
COUNT(*) FROM mytable);    }; if ($dbh-err) {   print Table $table -- DOES NOT EXIST\n; } $retCode = $sth-execute();   --- On Mon, 1/2/10, 7 7stud.7s...@gmail.com wrote: From: 7 7stud.7s...@gmail.com Subject: Re: prepare(SELECT ... FROM TABLE) error To: Beginners Perl beginners@perl.org Date

Re: prepare(SELECT ... FROM TABLE) error

2010-02-01 Thread Tony Esposito
Subject: Re: prepare(SELECT ... FROM TABLE) error To: Beginners Perl beginners@perl.org, 7 7stud.7s...@gmail.com Date: Monday, 1 February, 2010, 14:40 Is this the idea? I do not ever want to catch the error from the prepare statement itself -- I want my code to catch and throw the error.  And I am