[freetds] better errors
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Thu Jun 30 05:55:20 EDT 2005
>
> > > Lastly, I have a question about TDSMESSAGE::priv_msg_type.
> > > It's written
> > > to 5 times (once in mem.c, 4 in token.c). It's never read.
> > > Anyone have
> > > any idea what it's meant to do? Also, I'd like to
> >
> > It useful to distingue from information to error but it's not used
> > (level is used instead)
>
> OK, then we don't need it.
>
> > > s/msg_level/severity/
> > > and s/msg_number/msgno/ and s/msg_state/state/ if there are
> > > no objections.
> >
> > I agree
>
Mmm... I renamed fields however I noted that some tests for msg_level
(now severity) looks like tests to set priv_msg_type... perhaps it's
better to use this variable instead to test severity? I noted this code
in ODBC (I don't remember where it came...)
if (severity <= 10 && dbc && !TDS_IS_MSSQL(dbc->tds_socket) &&
msg->sql_state && msg->sql_state[0]
&& strncmp(msg->sql_state, "00", 2) != 0) {
if (strncmp(msg->sql_state, "01", 2) != 0 && strncmp(msg->sql_state,
"IM", 2) != 0)
severity = 11;
}
if (severity <= 10) {
if (errs->lastrc == SQL_SUCCESS)
errs->lastrc = SQL_SUCCESS_WITH_INFO;
} else {
errs->lastrc = SQL_ERROR;
}
Perhaps priv_msg_type was intended for that purpose ??
freddy77
More information about the FreeTDS
mailing list