Re: Fast BigDecimal
От | Heikki Linnakangas |
---|---|
Тема | Re: Fast BigDecimal |
Дата | |
Msg-id | 49EADDCE.90500@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: Fast BigDecimal (Kris Jurka <books@ejurka.com>) |
Ответы |
Re: Fast BigDecimal
|
Список | pgsql-jdbc |
Kris Jurka wrote: > > > On Sat, 18 Apr 2009, Kris Jurka wrote: > >> On Thu, 16 Apr 2009, Heikki Linnakangas wrote: >> >>> Here's another patch I put together while trying to improve >>> performance for the customer that bumped into the repeated Describe >>> thing yesterday. It speeds up ResultSet.getBigDecimal() with the same >>> fastpath implementation we have for getInt and getLong. >> >> To maintain the same behavior as the current code, you need to handle >> the period more carefully. You must ensure that there is only one and >> that there's at least one other number. Consider the case of SELECT >> '.' OR SELECT '1.......'. >> > > For some reason I thought this would be tricky. We just need to track > the total number for periods seen and error out if > 1 or equal to the > total number of characters. I've done that and committed it. Thanks. One more thing: this accepts "-.", which the normal version doesn't. Patch attached. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com Index: org/postgresql/jdbc2/AbstractJdbc2ResultSet.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v retrieving revision 1.106 diff -c -r1.106 AbstractJdbc2ResultSet.java *** org/postgresql/jdbc2/AbstractJdbc2ResultSet.java 19 Apr 2009 05:18:31 -0000 1.106 --- org/postgresql/jdbc2/AbstractJdbc2ResultSet.java 19 Apr 2009 08:15:03 -0000 *************** *** 2191,2197 **** val += b - '0'; } ! if (periodsSeen > 1 || periodsSeen == bytes.length) throw FAST_NUMBER_FAILED; if (neg) { --- 2191,2198 ---- val += b - '0'; } ! if (periodsSeen > 1 || ! periodsSeen == (neg ? bytes.length - 1 : bytes.length)) throw FAST_NUMBER_FAILED; if (neg) {
В списке pgsql-jdbc по дате отправления: