Re: streaming result sets: progress

From: nferrier(at)tapsellferrier(dot)co(dot)uk
To: snpe <snpe(at)snpe(dot)co(dot)yu>
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:30:11
Message-ID: ur8doi06k.fsf@tapsellferrier.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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).

Nic

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message snpe 2002-11-14 16:46:01 Re: streaming result sets: progress
Previous Message snpe 2002-11-14 16:26:19 Re: streaming result sets: progress