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
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
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
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
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
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
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
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,
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 }
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
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
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
12 matches
Mail list logo