Обсуждение: setFetchSize() bug

Поиск
Список
Период
Сортировка

setFetchSize() bug

От
Felipe Schnack
Дата:
Hi all
  I just wrote the test case for the setFetchSize() bug I found these days. Attached to this message you get the Java
source.The database I'm querying is defined in the following SQL fragment. Note you have to populate the table with
data,as the error ocurrs when you call ResultSet.next() 

create table Auditoria (userIp varchar(15), codPessoa int , msgAudit varchar(200) not null, dataAudit timestamp default
CURRENT_TIMESTAMPnot null, tipoAudit int not null); 

  Have fun :-)

--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341

Вложения

Re: setFetchSize() bug

От
Fernando Nasser
Дата:
Hi Felipe,

Your SQL DDL does not match your patch.

Nevertheless, I was able to reproduce your problem and tested Kim's
solution with the attached patch.  It indeed solves the problem.

We will try and make a test case based on your example.
Thanks for sending it.

Regards,
Fernando


Felipe Schnack wrote:
>   Hi all
>   I just wrote the test case for the setFetchSize() bug I found these days. Attached to this message you get the Java
source.The database I'm querying is defined in the following SQL fragment. Note you have to populate the table with
data,as the error ocurrs when you call ResultSet.next() 
>
> create table Auditoria (userIp varchar(15), codPessoa int , msgAudit varchar(200) not null, dataAudit timestamp
defaultCURRENT_TIMESTAMP not null, tipoAudit int not null); 
>
>   Have fun :-)
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9
Index: org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java,v
retrieving revision 1.13
diff -c -p -r1.13 AbstractJdbc1ResultSet.java
*** org/postgresql/jdbc1/AbstractJdbc1ResultSet.java    30 Jun 2003 21:10:55 -0000    1.13
--- org/postgresql/jdbc1/AbstractJdbc1ResultSet.java    5 Aug 2003 21:44:14 -0000
*************** public abstract class AbstractJdbc1Resul
*** 123,128 ****
--- 123,135 ----
              // Must be false if we weren't batching.
              if (fetchSize == 0)
                  return false;
+             // We may have ignored fetchSize because we are not using
+             // server side prepared statements and we are not in a
+             // transaction so we cannot declare a cursor; in this cases
+             // the statement name is null and we've already got all the data
+             String cursorName = statement.getStatementName();
+             if (cursorName == null)
+                 return false;
              // Use the ref to the statement to get
              // the details we need to do another cursor
              // query - it will use reinit() to repopulate this
*************** public abstract class AbstractJdbc1Resul
*** 130,136 ****
              String[] sql = new String[1];
              String[] binds = new String[0];
              // Is this the correct query???
-             String cursorName = statement.getStatementName();
              sql[0] = "FETCH FORWARD " + fetchSize + " FROM " + cursorName;
              QueryExecutor.execute(sql,
                                    binds,
--- 137,142 ----

Re: setFetchSize() bug

От
felipes@ritterdosreis.br
Дата:
  Hi!

> Your SQL DDL does not match your patch.
  Sorry! I sent the wrong table??

> Nevertheless, I was able to reproduce your problem and tested Kim's
> solution with the attached patch.  It indeed solves the problem.

> We will try and make a test case based on your example.
> Thanks for sending it.
  I'm glad I could help :-)


 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341


------------------------------------------------
UniRitter - Centro Universitario Ritter dos Reis
www.uniritter.com.br
--------------------
Este e-mail possui verificacao de virus ativado
utilizando: F-Prot, clamscan e spamassassin.
------------------------------------------------