AW: Can I get PrintWarn to emit warnings from the server?

AW: Can I get PrintWarn to emit warnings from the server?

am 28.03.2007 16:35:18 von Gisbert.Selke

> -----Ursprüngliche Nachricht-----
> Von: Baron Schwartz [mailto:baron@sequent.org]
> Gesendet: Mittwoch, 28. März 2007 03:26
> I'm trying to find a way to get Perl to print warnings from SQL=20
> statements that I might need to log and investigate. I'd=20
> like this to=20
> happen when I do a statement that truncates a data value,=20
> converts a bad=20
> date etc -- anything that normally results in the mysql command-line=20
> client telling me there are warnings.
>=20
> Is this possible? PrintWarn currently doesn't seem to do=20
> anything that=20
> I can tell, but I'm not sure I'm doing it right:
>=20
> my $dbh =3D DBI->connect($dsn, $user, $pass,
> { PrintWarn =3D> 1, RaiseError =3D> 1, PrintError =3D> 1 })
One way would be to=20
$dbh->prepare('show warnings');
and then execute() and fetch...().

\Gisbert=20

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Re: AW: Can I get PrintWarn to emit warnings from the server?

am 29.03.2007 13:48:30 von Baron Schwartz

[I'm moving this thread back to my xaprb.com email, where it should have started from]

Selke, Gisbert W. wrote:
>> -----Ursprüngliche Nachricht-----
>> Von: Baron Schwartz
>> Gesendet: Mittwoch, 28. März 2007 03:26
>> I'm trying to find a way to get Perl to print warnings from SQL
>> statements that I might need to log and investigate. I'd
>> like this to
>> happen when I do a statement that truncates a data value,
>> converts a bad
>> date etc -- anything that normally results in the mysql command-line
>> client telling me there are warnings.
>>
>> Is this possible? PrintWarn currently doesn't seem to do
>> anything that
>> I can tell, but I'm not sure I'm doing it right:
>>
>> my $dbh = DBI->connect($dsn, $user, $pass,
>> { PrintWarn => 1, RaiseError => 1, PrintError => 1 })
> One way would be to
> $dbh->prepare('show warnings');
> and then execute() and fetch...().

Thanks Gisbert. I can do this, but only if I explicitly check after each statement.
I'm hoping there is (or can be in the future) DBD support for catching warnings without
polling the server.

Regards
Baron

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org