Tony Caduto schrieb:
??? Thats not really cursor fetch. You always fetch all data this way. Cursor fetch for example :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?
>
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