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
On Thu, Feb 11, 2010 at 2:03 AM, Jay Savage 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 should be reliab
On Tue, Feb 9, 2010 at 8:05 PM, Dr.Ruud 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 historically this may not have be
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 $tabl
On Wed, Feb 3, 2010 at 9:22 PM, 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
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 thro
$mytable does not
exist and just move on to the next table?
--- On Mon, 1/2/10, Tony Esposito wrote:
From: Tony Esposito
Subject: Re: prepare(SELECT ... FROM TABLE) error
To: "Beginners Perl" , "7" <7stud.7s...@gmail.com>
Date: Monday, 1 February, 2010, 17:02
Als
On Mon, Feb 1, 2010 at 1:40 PM, Tony Esposito
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, then you have to catch
Also, if prepare fails, I want to continue processing -- hence the need to
capture the error in my code and not have DBI::DBD throw and exception then
stop all processing ...
--- On Mon, 1/2/10, Tony Esposito wrote:
From: Tony Esposito
Subject: Re: prepare(SELECT ... FROM TABLE) error
To
t;SELECT 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) er
On Mon, Feb 1, 2010 at 12:11 PM, Tony Esposito
wrote:
> 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
>
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 }
12 matches
Mail list logo