From: | Daniel Schuchardt <daniel_schuchardt(at)web(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Delphi - Developers start develop Access components |
Date: | 2005-05-10 23:31:46 |
Message-ID: | d5rg8b$2o1u$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tony Caduto schrieb:
> unless we are thinking of something different I do this:
>
> sql.clear;
> sql.add('select myfunction();');
> sql.add('fetch all from return_cursor;');
> open;
>
> >
> > ??
> > How? On EoF of a TDataSet? Its clear that you can fetch manually.
> How do you do that?
> >
>
>
??? Thats not really cursor fetch. You always fetch all data this way.
Cursor fetch for example :
DECLARE c_test CURSOR FOR SELECT * FROM art ORDER BY ak_nr;
FETCH FORWARD 10 FROM c_test;
now only 10 Records are fetched via network. So networktraffic is low
and the user has a result imediatly.
now you can do again
FETCH FORWARD 10 FROM c_test;
With CURSOR FETCH I mean fetch data on demand and not as a complete block.
And why you dont return your resulset directly from your function?
example:
CREATE TYPE testresulttest AS (id INTEGER, test VARCHAR);
CREATE OR REPLACE FUNCTION testresult() RETURNS SETOF testresulttest AS $$
DECLARE t testresulttest;
BEGIN
t.id:=1; t.test:='first row'; --or some record data
RETURN NEXT t;
t.id:=2; t.test:='middle row';
RETURN NEXT t;
t.id:=3; t.test:='last row';
RETURN NEXT t;
RETURN;
END $$ LANGUAGE plpgsql;
SELECT * FROM testresult();
this works fine from delphi too.
Daniel
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Fein | 2005-05-10 23:43:28 | Re: JOIN on set of rows? |
Previous Message | Mischa Sandberg | 2005-05-10 23:24:01 | Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL |