Re: Delphi - Developers start develop Access components

Поиск
Список
Период
Сортировка
От Daniel Schuchardt
Тема Re: Delphi - Developers start develop Access components
Дата
Msg-id d5rg8b$2o1u$1@news.hub.org
обсуждение исходный текст
Ответ на Re: Delphi - Developers start develop Access components  (Tony Caduto <tony_caduto@amsoftwaredesign.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Mischa Sandberg
Дата:
Сообщение: Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
Следующее
От: Peter Fein
Дата:
Сообщение: Re: JOIN on set of rows?