From: | Peter T Mount <peter(at)retep(dot)org(dot)uk> |
---|---|
To: | Barry Lind <barry(at)xythos(dot)com> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL jdbc list <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Re: [BUGS] JDBC PreparedStatement.setMaxRows() affects other objectsinstantiated from this class and it's parent class |
Date: | 2001-01-26 09:39:57 |
Message-ID: | 980501997.3a7145ed14823@webmail.retep.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Quoting Barry Lind <barry(at)xythos(dot)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(at)candle(dot)pha(dot)pa(dot)us]
> > > Sent: Tuesday, January 16, 2001 12:00 PM
> > > To: southern(at)heymax(dot)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(at)candle(dot)pha(dot)pa(dot)us]
> > > > Sent: Friday, January 12, 2001 11:41 AM
> > > > To: southern(at)heymax(dot)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(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)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(at)retep(dot)org(dot)uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 2001-01-26 12:34:27 | RE: Re: Postgresql JDBC driver - Support for Scrollable Re sult Sets |
Previous Message | Peter T Mount | 2001-01-26 09:33:00 | Re: [JDBC] Re: JDBC buggy in 7.1beta3 |