Page 1 of 1

Can you add global settings to connections

Posted: Tue 10 Aug 2010 17:36
by ccmcbride
For instance, I never, ever, ever, want to see the error 'update failed, 0 records'.
By default, it seems this flag is turned on.
so I've had to add code to set record options whenever a table is opened.
However, if I 'miss' a table, I get the error in unexpected places.

Would be SO much easier if I could just set the option on a connection, and the settings were copied to the table when the table is added.

Posted: Wed 11 Aug 2010 13:35
by Ludek
Hi, why don't you create a subclass with your preferred default and use only this class as global replacement for tmsquery? or you still don't have any subclass and using tmsquery as is?

BTW I really don't find general setting strictupdate = false to be a correct design pattern... I could count queries with strictupdate = false on my fingers in our code with a few millions of lines...

Posted: Thu 12 Aug 2010 08:43
by Dimon
Ludek is right.
Also you can create procedures to create objects with the same options if you don't want to use subclasses.

change source

Posted: Fri 10 Sep 2010 18:19
by wilton_rad
.....SOURCE\DBACCESS.PAS

constructor TDADataSetOptions.Create(Owner: TCustomDADataSet);
begin
inherited Create;

FOwner := Owner;

RequiredFields := True;
StrictUpdate := True; --->> change for False
TrimFixedChar := True;
LongStrings := True;
FlatBuffers := False;
RemoveOnRefresh := True;
FDetailDelay := 0;
UpdateBatchSize := 1;
end;
-------------------
public
constructor Create(Owner: TCustomDADataSet);

property SetFieldsReadOnly: boolean read FSetFieldsReadOnly write FSetFieldsReadOnly default False;
property RequiredFields: boolean read FRequiredFields write SetRequiredFields default True;
property StrictUpdate: boolean read FStrictUpdate write FStrictUpdate default True; -->>change for False