Hello,
Describe please, how to proper use FetchAll option.
I have a big table (more then 2M complex records) and I want to scan it and use some information to insert or update other table.
Example:
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.Options.DefaultValues:=true;
UQ.UniDirectional := true;
UQ.FetchRows := 10000;
UQ.SpecificOptions.Values['FetchAll'] := 'False';
UQ.SQL.Add('SELECT * FROM big_table;');
UQ.Open;
if UQ.RecordCount>0 then begin
....
end;
UQ.Close;
UQ.Free;
1. The first of all is the scope of FetchAll option. Is this value assigned only for the current query or to the entire connection ?
2. The UniDirectional property scope is only for the current query or to the entire connection??
Regards
Michal
PostgreSQL, UniQuery, FetchAll questions
Re: PostgreSQL, UniQuery, FetchAll questions
1. FetchAll is a dataset property:
https://www.devart.com/pgdac/docs/devar ... chall.htm . Therefore, it cannot influence the connection. FetchAll influences each dataset separately. For example, in such a code:
You can be sure that UniQuery1 and UniQuery2 do not influence each other. They do not influence UniConnection1 either.
2. TUniQuery.UniDirectional influences only a dataset. TUniQuery.Connection and a database connection are not influenced either.
https://www.devart.com/pgdac/docs/devar ... chall.htm . Therefore, it cannot influence the connection. FetchAll influences each dataset separately. For example, in such a code:
Code: Select all
UniQuery1.Connection := UniConnection1;
UniQuery2.Connection := UniConnection1;
UniQuery1.FetchAll := True;
UniQuery2.FetchAll := False;
UniQuery1.Open;
UniQuery2.Open;
2. TUniQuery.UniDirectional influences only a dataset. TUniQuery.Connection and a database connection are not influenced either.
Re: PostgreSQL, UniQuery, FetchAll questions
Thank you.
What difference are between:
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.UniDirectional := true;
UQ.FetchRows := 10000;
and
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.FetchRows := 10000;
UQ.FetchAll := False;
In link you posted is written that FetchAll needs active transaction. Why ?
Regards
Michal
What difference are between:
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.UniDirectional := true;
UQ.FetchRows := 10000;
and
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.FetchRows := 10000;
UQ.FetchAll := False;
In link you posted is written that FetchAll needs active transaction. Why ?
Regards
Michal
Re: PostgreSQL, UniQuery, FetchAll questions
UQ:=TUniQuery.Create(nil);
UQ.Connection:=DM_01.UniConnection1;
UQ.UniDirectional := true;
UQ.FetchRows := 10000;
It means that the dataset will be readonly and you will be able to scroll it only to the end. UniDAC will request PostgreSQL for FetchRows records per request.
UQ: = TUniQuery.Create (nil);
UQ.Connection: = DM_01.UniConnection1;
UQ.FetchRows: = 10,000;
UQ.FetchAll: = False;
It means that dataset can be edited and records can be scrolled in both directions.
PostgreSQL does not support multiple transactions within a single connection. Therefore, it is necessary to either fetch all records or close the dataset.
UQ.Connection:=DM_01.UniConnection1;
UQ.UniDirectional := true;
UQ.FetchRows := 10000;
It means that the dataset will be readonly and you will be able to scroll it only to the end. UniDAC will request PostgreSQL for FetchRows records per request.
UQ: = TUniQuery.Create (nil);
UQ.Connection: = DM_01.UniConnection1;
UQ.FetchRows: = 10,000;
UQ.FetchAll: = False;
It means that dataset can be edited and records can be scrolled in both directions.
PostgreSQL does not support multiple transactions within a single connection. Therefore, it is necessary to either fetch all records or close the dataset.
Re: PostgreSQL, UniQuery, FetchAll questions
Thank you.
Regards
Michal
Regards
Michal
Re: PostgreSQL, UniQuery, FetchAll questions
If any questions about our products come up , please contact us.