Hi, Quoting Emmanuel Courrèges <[EMAIL PROTECTED]>:
> Hello, > Currently with the PostgreSQL driver, there seems to be no way to get > the "error code string" in the form: > http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html > > dbi_conn_error() always returns 0, and the error message returned is > just the Postgresql error message which is localized (french for me). > I would greatly appreciate if we could change this to "error code - > error message" for example, so at least the error would be parsable even > if the message is localized in any language, also you wouldn't have to > parse full text. > I checked how other drivers handle this. The sqlite and sqlite3 drivers set the error code and provide a non-localized text. The mysql driver also sets an error code and returns a text, which may be localized by means of a client library compile-time option (i.e. usually it is not localized, but you can't bet on it). The pgsql driver indeed does not set the error code as PostgreSQL uses a non-numeric five-letter code. I don't know how the remaining drivers are implemented. I agree that parsing error messages in languages not known at compile time is error prone, to say the least. Would it be acceptable to convert the PostgreSQL error code to a numeric code? If my math is right, a five digit base 25 number can be converted to a long int with no round-trip losses. The driver could also provide a custom function to convert this number back to the PostgreSQL alphanumeric error code. This solution would be more in line with the error code - error message semantics of dbi_conn_error(). I'd like to hear other opinions before changing the driver though. > How does the acceptance process for the change work? > Should I do the change? > Basically I don't want to run on a lib-dbi-drivers that would be patched > by me, I'd rather have it in the official branch. > If we find a consensus about the suggested change on this list, I'd greatly appreciate if you could provide a patch against the current cvs revision and send it to this list. We'll have a look at it and apply it if it does the trick. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libdbi-drivers-devel mailing list Libdbi-drivers-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel