I want to do following operation:
Code: Select all
select myfunction(:myparameter);
fetch all from cursor
Alternatively, I can use a second query and do something likePgConnection1.StartTransaction;
(Execute first query with first line)
(Execute second query with second line - fetch statement)
PgConnection1.Commit;
PgQuery2.Cursor := TPgCursorField(PgQuery1.Fields[0]).AsCursor;
But whatever I do, this operation requires 4 round-trips to the server. Through a slow connection this takes more than twice as long than what I had before with PostgresDAC which allowed multiple statements in a single query with parameters.
Taking twice as long is a serious issue for me. What's the solution to this? There must be a way of using stored procedures with cursors without loss of that much speed.
Thanks