fetchall to false and queryrecount to true for postgresql
fetchall to false and queryrecount to true for postgresql
Hi,
I want to set fetchall to false QueryRecCount to true by default for postgresql, i have unidac src vers 4.1.4.
in witch files i have to change this?
i have to convert some code from bde and interbase to unidac postgresql.
Thanks
I want to set fetchall to false QueryRecCount to true by default for postgresql, i have unidac src vers 4.1.4.
in witch files i have to change this?
i have to convert some code from bde and interbase to unidac postgresql.
Thanks
Hello,
Property values are not automatically initialized to the default value. That is, the default directive controls only when property values are saved to the form file, but not the initial value of the property on a newly created instance. Therefore you should set this option to True in the class constructor too
Property values are not automatically initialized to the default value. That is, the default directive controls only when property values are saved to the form file, but not the initial value of the property on a newly created instance. Therefore you should set this option to True in the class constructor too
Hello AlexP,
thanks for you response.
I change the property QueryRecCount for unitable in file uni.pas
Constructor TUniTable.create(Owner: Tcomponent);
and work fine.
But i have probleme for TUniQUery
if i change the property in
Constructor TCustomUniDataSet.create(Owner: Tcomponent);
the program run in infinite loop.
Can you tell me where i can change this property?
Regards
thanks for you response.
I change the property QueryRecCount for unitable in file uni.pas
Constructor TUniTable.create(Owner: Tcomponent);
and work fine.
But i have probleme for TUniQUery
if i change the property in
Constructor TCustomUniDataSet.create(Owner: Tcomponent);
the program run in infinite loop.
Can you tell me where i can change this property?
Regards
Hello,
The basic class for both TUniTable.Options and ТUniQuery.Options is the TDADataSetOptions class. The QueryRecCount property should be set to true in its constructor. In this case, the property will be set to True in all DataSets.
The basic class for both TUniTable.Options and ТUniQuery.Options is the TDADataSetOptions class. The QueryRecCount property should be set to true in its constructor. In this case, the property will be set to True in all DataSets.
Code: Select all
constructor TDADataSetOptions.Create(Owner: TCustomDADataSet);
begin
inherited Create;
FOwner := Owner;
SetFieldsReadOnly := True;
RequiredFields := True;
StrictUpdate := True;
TrimFixedChar := True;
LongStrings := True;
FlatBuffers := False;
RemoveOnRefresh := True;
UpdateBatchSize := 1;
QueryRecCount := True;
end;Hi,
I do that in the constructor for queryreccount , and i don't know where i have to change for fetchall to set to false, i try many places, but everytime, the program enter in an infini loop.
can you help me please.
Can you explain me step by step what i have to change
for setting default QueryRecCount = true and fetchall= false for postgresql.
Thanks
sorry for my english...
I do that in the constructor for queryreccount , and i don't know where i have to change for fetchall to set to false, i try many places, but everytime, the program enter in an infini loop.
can you help me please.
Can you explain me step by step what i have to change
for setting default QueryRecCount = true and fetchall= false for postgresql.
Thanks
sorry for my english...
Hello,
- 1) Delete completely all the UniDAC components from the IDE (IDE Main Menu->Component->Install Packages...-> delete all the Devart packages);
2) QueryRecCount installation. Since this option is global for all packages, this change will affect all providers:- 2.1) Open the dacXX.dpk package;
2.2) Open the DBAccess.pas file from this package;
2.3) In the DADataSetOptions class constructor, add the line QueryRecCount := True;
Code: Select all
constructor TDADataSetOptions.Create(Owner: TCustomDADataSet); begin inherited Create; FOwner := Owner; SetFieldsReadOnly := True; RequiredFields := True; StrictUpdate := True; TrimFixedChar := True; LongStrings := True; FlatBuffers := False; RemoveOnRefresh := True; UpdateBatchSize := 1; QueryRecCount := True; end;- 2.4) Save the DBAccess.pas and build the dacXX.dpk package;
4) Open and build the dcldacXX.dpk package;
5) Open and build the unidacXX.dpk package;
6) Open and build the unidacvclXX.dpk package;
7) Open, build, and install the dclunidacXX.dpk package;
8) The FetchAll option installation for the PostgreSQL provider:- 8.1) Open the pgproviderXX.dpk package;
8.2) Open thePostgreSQLUniProvider.pas file from this package;
8.3) In the TPostgreSQLUniProvider.GetDataSetOptions method change True to False in the line with the FetchAll property setting:
Code: Select all
FDataSetOptions.Add(TBooleanOption.Create('FetchAll', prFetchAll, [TPgSQLRecordSet], FALSE));- 8.4)Build and install the pgproviderXX.dpk package.
- 2.1) Open the dacXX.dpk package;
Hello Alex,
I try exactly what you say.
I create a new project.
on the form i put 1 uniconnection, 1 uniquery, 1 postgresprovider,1 button,1 dbgrid and 1 datasource;
the code for the button is : Uniquery1.active := True;
i don't change any option.
when i run the program and click on the button, the program enter in an infini loop.
Regards
I try exactly what you say.
I create a new project.
on the form i put 1 uniconnection, 1 uniquery, 1 postgresprovider,1 button,1 dbgrid and 1 datasource;
the code for the button is : Uniquery1.active := True;
i don't change any option.
when i run the program and click on the button, the program enter in an infini loop.
Regards
Hello,
For resolving this problem, you should add the following code to the DBAccess.pas file into the TDADataSetUpdater.CheckUpdateQuery method:
For resolving this problem, you should add the following code to the DBAccess.pas file into the TDADataSetUpdater.CheckUpdateQuery method:
Code: Select all
....................
TCustomDADataSet(FUpdateQuery).Options.SetEmptyStrToNull := FDataSet.Options.SetEmptyStrToNull;
TCustomDADataSet(FUpdateQuery).Options.FlatBuffers := True;
TCustomDADataSet(FUpdateQuery).Options.QueryRecCount := False; //<-add this lineRe: fetchall to false and queryrecount to true for postgresq
Hi,
is it possible to use fetchall with postgresql without transaction?
Thanks
is it possible to use fetchall with postgresql without transaction?
Thanks
Re: fetchall to false and queryrecount to true for postgresq
Hi, lao
Yes, if there is no active transaction, PgDAC itself opens an additional internal connection and starts transaction on this connection.
If don't like it, you can use the TPgDataSetOptions.CursorWithHold option to work without additional internal connection.
Set CursorWithHold to True (False by default). PgDAC will use the DECLARE CURSOR ... WITH HOLD statement to open the query. In this case no active transaction is required but this may take additional server resources.
Yes, if there is no active transaction, PgDAC itself opens an additional internal connection and starts transaction on this connection.
If don't like it, you can use the TPgDataSetOptions.CursorWithHold option to work without additional internal connection.
Set CursorWithHold to True (False by default). PgDAC will use the DECLARE CURSOR ... WITH HOLD statement to open the query. In this case no active transaction is required but this may take additional server resources.
Re: fetchall to false and queryrecount to true for postgresq
Hi ROD,
thank you for your reply.
i have some problems after use tcrbatchmove:
provider postgresql.
i have 2 tables A and B.
i have 1 uniquery named QSource with options:queryreccount:=true and fetchall :=false
and sql = 'select * from A'
i have 1 other query named qtest with sames options and sql= 'select * from B'
i have 1 tunitable named tdest with same options;
i have 1 tcrbatchmove with source =qsources and destination = tdest.
if i do that:
create new table C with same fields than table A;
tdest.tablename = C
QTEST.ACTIVE :=True.(just opened)
tcrbatchmove.execute;
i close tdest.
i change the sql of qsource for deleting the table c 'drop table C'.
and the program frezze.
it's very strange because if the Qtest is not active everything is ok.
and some times i can't update other tables.it's look like a transaction is active and table are locked.
Can you try to reproduce the error?
sorry for my bad english
Thanks
thank you for your reply.
i have some problems after use tcrbatchmove:
provider postgresql.
i have 2 tables A and B.
i have 1 uniquery named QSource with options:queryreccount:=true and fetchall :=false
and sql = 'select * from A'
i have 1 other query named qtest with sames options and sql= 'select * from B'
i have 1 tunitable named tdest with same options;
i have 1 tcrbatchmove with source =qsources and destination = tdest.
if i do that:
create new table C with same fields than table A;
tdest.tablename = C
QTEST.ACTIVE :=True.(just opened)
tcrbatchmove.execute;
i close tdest.
i change the sql of qsource for deleting the table c 'drop table C'.
and the program frezze.
it's very strange because if the Qtest is not active everything is ok.
and some times i can't update other tables.it's look like a transaction is active and table are locked.
Can you try to reproduce the error?
sorry for my bad english
Thanks