H.Merijn Brand wrote:
> On Thu, 4 Jun 2009 11:44:51 -0700 (GMT-07:00), Todd Zervas
> <tazer...@earthlink.net> wrote:
> 
>> Do you have any thoughts on how DBD::Unify ought to return warnings?
>> Specifically I need to be able to detect "dirty reads" (SQLWARN =
>> -2022).  Is the right DBI way to do this to have DBD::Unify update
>> SQLSTATE even when there is no error via the h->state method?
> 
> Did you read DBI::DBD? I have no ideas about this one. If it is not
> documented in DBI::DBD, the best (and only) place to ask is the devel
> mailing list, which I Cc'd
> 

Look at DBIh_SET_ERR_CHAR. In a quick glance at DBI::DBD I cannot find
the relevant information but the following is pulled from DBD::ODBC:

if (SQL_SUCCEEDED(err_rc)) {
             DBIh_SET_ERR_CHAR(h, imp_xxh, "", 1, ErrorMsg, sqlstate,
Nullch);
} else {
             DBIh_SET_ERR_CHAR(h, imp_xxh, Nullch, 1, ErrorMsg,
                               sqlstate, Nullch);
}

I believe it is the "" argument. From DBI docs:

A driver may return 0 from err() to indicate a warning condition after a
method call. Similarly, a driver may return an empty string to indicate
a 'success with information' condition. In both these cases the value is
false but not undef. The errstr() and state() methods may be used to
retrieve extra information in these cases.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to