Re: streaming result sets: progress - Mailing list pgsql-jdbc

From snpe
Subject Re: streaming result sets: progress
Date
Msg-id 200211141646.01455.snpe@snpe.co.yu
Whole thread Raw
In response to Re: streaming result sets: progress  (nferrier@tapsellferrier.co.uk)
Responses Re: streaming result sets: progress  (nferrier@tapsellferrier.co.uk)
List pgsql-jdbc
On Thursday 14 November 2002 04:30 pm, nferrier@tapsellferrier.co.uk wrote:
> snpe <snpe@snpe.co.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


pgsql-jdbc by date:

Previous
From: nferrier@tapsellferrier.co.uk
Date:
Subject: Re: streaming result sets: progress
Next
From: nferrier@tapsellferrier.co.uk
Date:
Subject: Re: streaming result sets: progress