Search Postgresql Archives

Re: Delphi - Developers start develop Access components

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux