[users@httpd] apr_dbd error codes and SQLSTATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,

Current version of Postgres driver for apr_dbd returns ExecStatusType
values from query-like functions. This behaviour leads to two
unconvenient consequences:
- error codes are Postgres-specific
- there are no possibility to distinguish between real unrecoverable
error (like connection abort) and data error (like constraint violation).

Second item seems more serious to me. Of course, we can get error string,
but it is localisation-dependent, and it is not convenient to analyse
human-readable text instead of erro code from fixed set. Unfortunately,
request results are unaccessible after return from query functions if
there were errors. So, it is impossible to obtain SQLSTATE error code in
current implementation. 

My suggestion is to use SQLSTATE codes as return values. There are two
difficulties: (i) SQLSATE code is 5-char line, but return type is
4-bytes integer, and (ii) query functions from Postgres client library
do not return result object in some situations, and no SQLSTATE code
available in this case.

The method to overcome the size difficulty can be found in standard
Postgres server utilities. Include file <server/utils/elog.h> contains
MAKE_SQLSTATE macro which convert 5-bytes code to 4-bytes integer value.

Second difficulty shall be solved by convention: some existing code
should be used in this situation. For instance, 'connection error' can
be used.

I've implemented and tested this scheme using version of apr_dbd_pgsql.c
from httpd-2.2.2. But current CVS version contains a lot of changes, and
I did not use it. Nevertheless, this error reporting scheme seems to me
much more convenient than current one. And new Oracle driver may also
use it.
-- 
Evgeny Shirykalov <evgeny@xxxxxxxxxxxxxxxxxxxxx>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux