Fixes and enhancements to JDBC driver (take 2)
От | Richard Bullington-McGuire |
---|---|
Тема | Fixes and enhancements to JDBC driver (take 2) |
Дата | |
Msg-id | Pine.LNX.4.10.10101171425190.26916-200000@polymorphic.microstate.com обсуждение исходный текст |
Список | pgsql-patches |
(My apologies, I had attempted to post another message, but it contained a flawed patch, and it may not even reach the list. If you received that message, please do not use the attached patch, named postgres-jdbc-Microstate-fixes.patch. Instead, use the attached patch, postgres-jdbc-Microstate-fixes-2.patch. Here goes again:) Please find attached a patch versus the current 7.x source tree from CVS. It fixes several problems, and adds one new feature. Here are the problems it fixes: * org.postgresql.util.PSQLException could generate a null pointer error if the message was null. I fixed this by checking for a null for message in addition to checking for null args. This fix is just putting into practice some defensive programming. * A serious off-by-one error existed in both of the BytePoolDim classes in the org.postgresql.PG_Stream class. On a request for a byte pool for the maximum size, the old code would generate an ArrayIndexOutOfBoundsException. I fixed this by increasing the size of the array by one more than the maximum buffer size, and altering the supporting methods to initialize and clean up the expanded array. * org.postgresql.jdbc1.ResultSet and org.postgresql.jdbc2.ResultSet contained several lines where SimpleDateFormat had bad format strings. The format strings contained "MM", the code for months, instead of "mm", the code for minutes, in places where the intended result was an hours:minutes:seconds string. * utils.CheckVersion version 1.2 failed to compile using the IBM JDK 1.1.8, because of the use of System.setProperty(), a method introduced in JDK 1.2. I refactored the main method of this class for maximum portability and clarity. It now supports the IBM JDK 1.1.8, and should detect other odd 1.1 JDKs more gracefully. * In utils.CheckVersion, I also removed code that looked like dead code, at the beginning and end of the main() method. I can't see any reason to print out the value of the postgresql.jdbc system property when this class is invoked, nor to set a system property at the end of main(), when CheckVersion is only used in the make process, and only then for the version of the driver it sends to System.out. * If utils.CheckVersion fails to detect a valid JDK version, it returns a non-zero error code to the calling process, allowing Make to fail gracefully. The one enhancement included is a beginning of an implementation for SQL Escape processing. This implementation implements only the date escape clause -- we have found in our development that that is the most used of the escape clauses. The enhancement affects org.postgresql.Connection and org.postgresql.jdbc1.Statement. The jdbc1.Statement class did not check to see if escape processing was enabled at all, and the Connection class had a placeholder implementation of the EscapeSQL() method. At Microstate, we've been using a variation on this for more than a year in our internal versions of the PostgreSQL JDBC drivers with great success. The patch works currently, but it could be made more efficient. -- Richard Bullington-McGuire <rbulling@microstate.com> Chief Technology Officer, The Microstate Corporation Phone: 703-796-6446 URL: http://www.microstate.com/ PGP key IDs: RSA: 0x93862305 DH/DSS: 0xDAC3028E
Вложения
В списке pgsql-patches по дате отправления: