JDBC Large ResultSet problem + BadTimeStamp Patch
| От | Michael Stephenson | 
|---|---|
| Тема | JDBC Large ResultSet problem + BadTimeStamp Patch | 
| Дата | |
| Msg-id | Pine.LNX.4.10.10010111630510.29625-100000@tirin.openworld.co.uk обсуждение исходный текст | 
| Ответ на | Re: Announcing PgSQL - a Python DB-API 2.0 compliant interface to PostgreSQL (Lamar Owen <lamar.owen@wgcr.org>) | 
| Ответы | Re: JDBC Large ResultSet problem + BadTimeStamp Patch | 
| Список | pgsql-interfaces | 
Two things.
Firstly, when dealing with a large ResultSet (about 120000 rows), I get a
null pointer exception on the line:  wasNullFlag = (this_row[columnIndex - 1] == null);
Whenever I call getString(), has anyone else had this? And does anybody
have a solution?
Secondly, I've not seen it mentioned on here but the jdbc driver will
sometimes throw a bad time stamp exception when you use getTimeStamp() on
times which have are accurate to more than a second, this is the patch we
use to fix it.
Hope it is of some use to somebody,
Michael Stephenson
*** src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java    Fri May 12
20:54:22 2000
--- src/interfaces/jdbc/org/postgresql/jdbc2/ResultSetPatch.java
Mon Sep 25 15:36:46 2000
***************
*** 439,445 ****     if(s==null)     return null;     
!     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
HH:mm:sszzz");          try {     return new Timestamp(df.parse(s).getTime());
--- 439,456 ----     if(s==null)     return null;     
!     SimpleDateFormat df = null;
!     if (s.length()>21 && s.indexOf('.') != -1) {
!         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
!     } else if (s.length()>19 && s.indexOf('.') == -1) {
!         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:sszzz");
!     } else if (s.length()>19 && s.indexOf('.') != -1) {
!         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss.SS");
!     } else if (s.length()>10 && s.length()<=18) {
!         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
!     } else {
!         df = new SimpleDateFormat("yyyy-MM-dd");
!     }            try {     return new Timestamp(df.parse(s).getTime());
		
	В списке pgsql-interfaces по дате отправления: