SQLSTATE of notice PGresult
От | Dmitriy Igrishin |
---|---|
Тема | SQLSTATE of notice PGresult |
Дата | |
Msg-id | AANLkTinU2S2vuYryvZgYp+q3few_M7MJnUf9pRigEP4f@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: SQLSTATE of notice PGresult
|
Список | pgsql-hackers |
Hey all,<br /><br />Accordingly to the documentation of libpq, SQLSTATE code field "is not localizable, and<br />is alwayspresent.". But it seems, in some cases it isn't. E.g.<br /><br /> /* the main code */<br /> PGresult* res = Pg::PQexec(conn,"select 1");<br /> Oid id = PQparamtype(res, 1);<br /><br /> /* the notice receiver */<br /> void myNoticeReceiver(void*arg, const PGresult *res)<br />{<br /> /* Presents - "NOTICE" */<br /> const char* severity = Pg::PQresultErrorField(res,PG_DIAG_SEVERITY);<br /><br /> /* NOT presents - NULL. Why not "00000" ? */<br /> const char*sqlstate = Pg::PQresultErrorField(res, PG_DIAG_SQLSTATE);<br /><br /> /* Presents - "parameter number 1 is out of range0..-1" */<br /> const char* primary = Pg::PQresultErrorField(res, PG_DIAG_MESSAGE_PRIMARY);<br /> }<br /><br />So,SQLSTATE field is not always presents.<br /><br />Regards,<br />Dmitriy<br />
В списке pgsql-hackers по дате отправления: