Re: streaming result sets: progress

From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: nferrier(at)tapsellferrier(dot)co(dot)uk
Cc: nferrier(at)tapsellferrier(dot)co(dot)uk, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: streaming result sets: progress
Date: 2002-11-14 16:46:01
Message-ID: 200211141646.01455.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thursday 14 November 2002 04:30 pm, nferrier(at)tapsellferrier(dot)co(dot)uk wrote:
> snpe <snpe(at)snpe(dot)co(dot)yu> writes:
> > I add AbstractJdbc3Statement missing method from AbstractJdbc2Statement
> > and it work.I don't test complete, but simple command on table with 1
> > mil. rows work fine.
>
> Ok.
>
> > > > 2) method nic_execute create query like :
> > > > BEGIN; DECLARE JDBC_CURS_1 CURSOR FOR select * from tab FETCH FORWARD
> > > > 100 FROM JDBC_CURS_1;
> > > > I add ";" before FETCH
> > >
> > > Hmmm... that's odd. Does the statement you supply have a ";" on the
> > > end of it? My patch only works if it does.
> >
> > You send this :
> > BEGIN; DECLARE JDBC_CURS_1 CURSOR FOR select * from tab FETCH FORWARD 100
> > FROM JDBC_CURS_1;
> > I change and send :
> > BEGIN; DECLARE JDBC_CURS_1 CURSOR FOR select * from tab; FETCH FORWARD
> > 100 FROM JDBC_CURS_1;
>
> Yes. But the reason I send:
>
> DECLARE JDBC_CURS_1 CURSOR FOR select * from tab FETCH FORWARD 100 FROM
> JDBC_CURS_1;
>
> is because the SQL statement you supply is _supposed_ to end with a
> ";". The code for the above is actually doing:
>
> DECLARE JDBC_CURS_1 CURSOR FOR $userquery FETCH FORWARD 100 FROM
> JDBC_CURS_1;
>
> where $userquery is what comes in from the client code, eg:
>
> Statement st = con.createStatement();
> ResultSet rs = con.executeQuery("select * from tab;");
>
> then "select * from tab;" is inserted as $userquery. It must always
> end with ";" because that's how PGSQL's normal query processing works.
>
> So if your code does this:
>
> Statement st = con.createStatement();
> ResultSet rs = con.executeQuery("select * from tab");
>
> it won't work. AFAIK it won't work with unpatched PGSQL JDBC either
> (please correct me if I'm wrong).
>
I can't use it, because I haven't change query in 3pty software (btw)
In standard jdbc this is work :
Statement st = con.createStatement();
ResultSet rs = con.executeQuery("select * from tab");

It is same with Your patch if I use next
DECLARE JDBC_CURS_1 CURSOR FOR $userquery ; FETCH FORWARD 100 FROM
JDBC_CURS_1;

If is command like that query work unchanged in standard JDBC and with patch
Of course, Your patch works with large tables

regards
Haris Peco

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message nferrier 2002-11-14 16:51:42 Re: streaming result sets: progress
Previous Message nferrier 2002-11-14 16:30:11 Re: streaming result sets: progress