Thread: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other objects instantiated from this class and it's parent class

Any comments on this from the JDBC croud?

> Bruce,
>
> I went and grabbed the newest JAR from Peter's site.  Calling setMaxRows()
> on one Statement object still affects all other objects.  I checked out the
> most recent source from CVS and discovered that the PostgreSQL driver
> Statement.setMaxRows() modifies a public instance variable in Connection.
>
> I quickly looked at the JDBC API and Sun's "For Driver Writers" document at
> http://java.sun.com/products/jdbc/driverdevs.html.  Neither says anything
> about how setMaxRows() should be implemented.  I am also relatively new to
> Java, so my following suggestion may be off the mark.
>
> I would suggest that the PostgreSQL JDBC driver allow developers to call
> setMaxRows() on a particular Statement object without it affecting other
> ResultSet objects obtained by calling execute methods on other objects.
> This would require making maxrows an instance variable of Statement.
> Additionally, an argument of maxRows would have to be added to the
> Connection.ExecSQL() argument list.  This would enable Statement,
> PreparedStatement and CallableStatement objects to pass max rows value to
> the Connection object when executing queries.
>
> Jason Southern
>
>
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: Tuesday, January 16, 2001 12:00 PM
> To: southern@heymax.com
> Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> objects intantiated from this class and it's parent class
>
>
> I think you will find it is fixed in the 7.1 JAR file at:
>
>     http://www.retep.org.uk
>
> > Bruce,
> >
> > Sorry for the late reply.  I'd be happy to help.  I'm a newbie at open
> > source development efforts, so could you point me to any docs on the
> > postgresql.org web site that will fill me in on to interact with your open
> > source community?  Meanwhile, I'll get the newest source from the CVS web
> > interface on postgresql.org.
> >
> > Jason
> >
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: Friday, January 12, 2001 11:41 AM
> > To: southern@heymax.com
> > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > objects intantiated from this class and it's parent class
> >
> >
> > > Bruce,
> > >
> > > Thanks for your quick response.  I ran the tests using the 7.1 beta
> driver
> > > on Peter Mount's website.
> > > (http://www.retep.org.uk/postgres/jars/jdbc7.1-1.2.jar).  The results of
> > the
> > > test using the class I attached in the bug report were the identical to
> > the
> > > 7.0-1.2 driver.
> >
> > OK, that is bad.  Can I ask you to download the 7.1 source and tell me
> > where your changes go into that source?  Thanks.
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> >
> >
> >
>
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>
>
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

I agree that the current behavior is wrong.  Since the setMaxRows()
method is on the Statement object and not the Connection object, it
doesn't make sense that by calling setMaxRows() for one statement you
should really set it for all statements in that connection.

thanks,
--Barry


Bruce Momjian wrote:
>
> Any comments on this from the JDBC croud?
>
> > Bruce,
> >
> > I went and grabbed the newest JAR from Peter's site.  Calling setMaxRows()
> > on one Statement object still affects all other objects.  I checked out the
> > most recent source from CVS and discovered that the PostgreSQL driver
> > Statement.setMaxRows() modifies a public instance variable in Connection.
> >
> > I quickly looked at the JDBC API and Sun's "For Driver Writers" document at
> > http://java.sun.com/products/jdbc/driverdevs.html.  Neither says anything
> > about how setMaxRows() should be implemented.  I am also relatively new to
> > Java, so my following suggestion may be off the mark.
> >
> > I would suggest that the PostgreSQL JDBC driver allow developers to call
> > setMaxRows() on a particular Statement object without it affecting other
> > ResultSet objects obtained by calling execute methods on other objects.
> > This would require making maxrows an instance variable of Statement.
> > Additionally, an argument of maxRows would have to be added to the
> > Connection.ExecSQL() argument list.  This would enable Statement,
> > PreparedStatement and CallableStatement objects to pass max rows value to
> > the Connection object when executing queries.
> >
> > Jason Southern
> >
> >
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: Tuesday, January 16, 2001 12:00 PM
> > To: southern@heymax.com
> > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > objects intantiated from this class and it's parent class
> >
> >
> > I think you will find it is fixed in the 7.1 JAR file at:
> >
> >       http://www.retep.org.uk
> >
> > > Bruce,
> > >
> > > Sorry for the late reply.  I'd be happy to help.  I'm a newbie at open
> > > source development efforts, so could you point me to any docs on the
> > > postgresql.org web site that will fill me in on to interact with your open
> > > source community?  Meanwhile, I'll get the newest source from the CVS web
> > > interface on postgresql.org.
> > >
> > > Jason
> > >
> > > -----Original Message-----
> > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > > Sent: Friday, January 12, 2001 11:41 AM
> > > To: southern@heymax.com
> > > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > > objects intantiated from this class and it's parent class
> > >
> > >
> > > > Bruce,
> > > >
> > > > Thanks for your quick response.  I ran the tests using the 7.1 beta
> > driver
> > > > on Peter Mount's website.
> > > > (http://www.retep.org.uk/postgres/jars/jdbc7.1-1.2.jar).  The results of
> > > the
> > > > test using the class I attached in the bug report were the identical to
> > > the
> > > > 7.0-1.2 driver.
> > >
> > > OK, that is bad.  Can I ask you to download the 7.1 source and tell me
> > > where your changes go into that source?  Thanks.
> > >
> > > --
> > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> > >
> > >
> > >
> >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> >
> >
> >
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Quoting Bruce Momjian <pgman@candle.pha.pa.us>:

I'll check the SUN JDBC book I'm now working with.

Any method within Statement should only affect that object. If it's affecting
every Statement, then it sounds to me like a bug.

Peter

>
> Any comments on this from the JDBC croud?
>
> > Bruce,
> >
> > I went and grabbed the newest JAR from Peter's site.  Calling
> setMaxRows()
> > on one Statement object still affects all other objects.  I checked
> out the
> > most recent source from CVS and discovered that the PostgreSQL driver
> > Statement.setMaxRows() modifies a public instance variable in
> Connection.
> >
> > I quickly looked at the JDBC API and Sun's "For Driver Writers"
> document at
> > http://java.sun.com/products/jdbc/driverdevs.html.  Neither says
> anything
> > about how setMaxRows() should be implemented.  I am also relatively
> new to
> > Java, so my following suggestion may be off the mark.
> >
> > I would suggest that the PostgreSQL JDBC driver allow developers to
> call
> > setMaxRows() on a particular Statement object without it affecting
> other
> > ResultSet objects obtained by calling execute methods on other
> objects.
> > This would require making maxrows an instance variable of Statement.
> > Additionally, an argument of maxRows would have to be added to the
> > Connection.ExecSQL() argument list.  This would enable Statement,
> > PreparedStatement and CallableStatement objects to pass max rows value
> to
> > the Connection object when executing queries.
> >
> > Jason Southern
> >
> >
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: Tuesday, January 16, 2001 12:00 PM
> > To: southern@heymax.com
> > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > objects intantiated from this class and it's parent class
> >
> >
> > I think you will find it is fixed in the 7.1 JAR file at:
> >
> >     http://www.retep.org.uk
> >
> > > Bruce,
> > >
> > > Sorry for the late reply.  I'd be happy to help.  I'm a newbie at
> open
> > > source development efforts, so could you point me to any docs on
> the
> > > postgresql.org web site that will fill me in on to interact with
> your open
> > > source community?  Meanwhile, I'll get the newest source from the
> CVS web
> > > interface on postgresql.org.
> > >
> > > Jason
> > >
> > > -----Original Message-----
> > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > > Sent: Friday, January 12, 2001 11:41 AM
> > > To: southern@heymax.com
> > > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects
> other
> > > objects intantiated from this class and it's parent class
> > >
> > >
> > > > Bruce,
> > > >
> > > > Thanks for your quick response.  I ran the tests using the 7.1
> beta
> > driver
> > > > on Peter Mount's website.
> > > > (http://www.retep.org.uk/postgres/jars/jdbc7.1-1.2.jar).  The
> results of
> > > the
> > > > test using the class I attached in the bug report were the
> identical to
> > > the
> > > > 7.0-1.2 driver.
> > >
> > > OK, that is bad.  Can I ask you to download the 7.1 source and tell
> me
> > > where your changes go into that source?  Thanks.
> > >
> > > --
> > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> > >
> > >
> > >
> >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> >
> >
> >
>
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
>



--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

Quoting Barry Lind <barry@xythos.com>:

> I agree that the current behavior is wrong.  Since the setMaxRows()
> method is on the Statement object and not the Connection object, it
> doesn't make sense that by calling setMaxRows() for one statement you
> should really set it for all statements in that connection.

I agree with you entirely.

I think this was originally done years ago with the original implementation.
ResultSet then didn't know what Statement created it. Also, the ExecSQL()
method in Connection needs to know the maxrows to return.

The fix is to modify ExecSQL so that the maxrows can be optionally passed to it
when called from Statement. This would then allow a local copy of maxRows to be
stored in Statement and not the global Connection.

Peter

>
> thanks,
> --Barry
>
>
> Bruce Momjian wrote:
> >
> > Any comments on this from the JDBC croud?
> >
> > > Bruce,
> > >
> > > I went and grabbed the newest JAR from Peter's site.  Calling
> setMaxRows()
> > > on one Statement object still affects all other objects.  I checked
> out the
> > > most recent source from CVS and discovered that the PostgreSQL
> driver
> > > Statement.setMaxRows() modifies a public instance variable in
> Connection.
> > >
> > > I quickly looked at the JDBC API and Sun's "For Driver Writers"
> document at
> > > http://java.sun.com/products/jdbc/driverdevs.html.  Neither says
> anything
> > > about how setMaxRows() should be implemented.  I am also relatively
> new to
> > > Java, so my following suggestion may be off the mark.
> > >
> > > I would suggest that the PostgreSQL JDBC driver allow developers to
> call
> > > setMaxRows() on a particular Statement object without it affecting
> other
> > > ResultSet objects obtained by calling execute methods on other
> objects.
> > > This would require making maxrows an instance variable of
> Statement.
> > > Additionally, an argument of maxRows would have to be added to the
> > > Connection.ExecSQL() argument list.  This would enable Statement,
> > > PreparedStatement and CallableStatement objects to pass max rows
> value to
> > > the Connection object when executing queries.
> > >
> > > Jason Southern
> > >
> > >
> > > -----Original Message-----
> > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > > Sent: Tuesday, January 16, 2001 12:00 PM
> > > To: southern@heymax.com
> > > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects
> other
> > > objects intantiated from this class and it's parent class
> > >
> > >
> > > I think you will find it is fixed in the 7.1 JAR file at:
> > >
> > >       http://www.retep.org.uk
> > >
> > > > Bruce,
> > > >
> > > > Sorry for the late reply.  I'd be happy to help.  I'm a newbie at
> open
> > > > source development efforts, so could you point me to any docs on
> the
> > > > postgresql.org web site that will fill me in on to interact with
> your open
> > > > source community?  Meanwhile, I'll get the newest source from the
> CVS web
> > > > interface on postgresql.org.
> > > >
> > > > Jason
> > > >
> > > > -----Original Message-----
> > > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > > > Sent: Friday, January 12, 2001 11:41 AM
> > > > To: southern@heymax.com
> > > > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects
> other
> > > > objects intantiated from this class and it's parent class
> > > >
> > > >
> > > > > Bruce,
> > > > >
> > > > > Thanks for your quick response.  I ran the tests using the 7.1
> beta
> > > driver
> > > > > on Peter Mount's website.
> > > > > (http://www.retep.org.uk/postgres/jars/jdbc7.1-1.2.jar).  The
> results of
> > > > the
> > > > > test using the class I attached in the bug report were the
> identical to
> > > > the
> > > > > 7.0-1.2 driver.
> > > >
> > > > OK, that is bad.  Can I ask you to download the 7.1 source and
> tell me
> > > > where your changes go into that source?  Thanks.
> > > >
> > > > --
> > > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > > >   +  Christ can be your backup.        |  Drexel Hill,
> Pennsylvania 19026
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> > >
> > >
> > >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
>



--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

This is fixed in the current CVS.

---------------------------------------------------------------------------


I agree that the current behavior is wrong.  Since the setMaxRows()
method is on the Statement object and not the Connection object, it
doesn't make sense that by calling setMaxRows() for one statement you
should really set it for all statements in that connection.

thanks,
--Barry


Bruce Momjian wrote:
>
> Any comments on this from the JDBC croud?
>
> > Bruce,
> >
> > I went and grabbed the newest JAR from Peter's site.  Calling setMaxRows()
> > on one Statement object still affects all other objects.  I checked out the
> > most recent source from CVS and discovered that the PostgreSQL driver
> > Statement.setMaxRows() modifies a public instance variable in Connection.
> >
> > I quickly looked at the JDBC API and Sun's "For Driver Writers" document at
> > http://java.sun.com/products/jdbc/driverdevs.html.  Neither says anything
> > about how setMaxRows() should be implemented.  I am also relatively new to
> > Java, so my following suggestion may be off the mark.
> >
> > I would suggest that the PostgreSQL JDBC driver allow developers to call
> > setMaxRows() on a particular Statement object without it affecting other
> > ResultSet objects obtained by calling execute methods on other objects.
> > This would require making maxrows an instance variable of Statement.
> > Additionally, an argument of maxRows would have to be added to the
> > Connection.ExecSQL() argument list.  This would enable Statement,
> > PreparedStatement and CallableStatement objects to pass max rows value to
> > the Connection object when executing queries.
> >
> > Jason Southern
> >
> >
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: Tuesday, January 16, 2001 12:00 PM
> > To: southern@heymax.com
> > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > objects intantiated from this class and it's parent class
> >
> >
> > I think you will find it is fixed in the 7.1 JAR file at:
> >
> >       http://www.retep.org.uk
> >
> > > Bruce,
> > >
> > > Sorry for the late reply.  I'd be happy to help.  I'm a newbie at open
> > > source development efforts, so could you point me to any docs on the
> > > postgresql.org web site that will fill me in on to interact with your open
> > > source community?  Meanwhile, I'll get the newest source from the CVS web
> > > interface on postgresql.org.
> > >
> > > Jason
> > >
> > > -----Original Message-----
> > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > > Sent: Friday, January 12, 2001 11:41 AM
> > > To: southern@heymax.com
> > > Subject: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other
> > > objects intantiated from this class and it's parent class
> > >
> > >
> > > > Bruce,
> > > >
> > > > Thanks for your quick response.  I ran the tests using the 7.1 beta
> > driver
> > > > on Peter Mount's website.
> > > > (http://www.retep.org.uk/postgres/jars/jdbc7.1-1.2.jar).  The results of
> > > the
> > > > test using the class I attached in the bug report were the identical to
> > > the
> > > > 7.0-1.2 driver.
> > >
> > > OK, that is bad.  Can I ask you to download the 7.1 source and tell me
> > > where your changes go into that source?  Thanks.
> > >
> > > --
> > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> > >
> > >
> > >
> >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> >
> >
> >
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026