Enhancing daDBExpress (Report Builder Team)
At version RB 6.03, I have discuted about add method
TdaSQLSession.SetDefaultSQLConnection(Value: TSQLConnection).
I think that this resource is very useful, because same reasons:
* provides a method to define only one database connection (Less database
licence costs! Less client and server resources);
* only one login in application;
* only one database connection configuration.
I have implemented this at RB 6.03 and RB 7.
RB7:
daDBExpress.pas
---------------------------------------------------------------------------
at public session into TdaSQLSession, insert:
class procedure SetDefaultSQLConnection(Value: TSQLConnection);
---------------------------------------------------------------------------
after, implement method:
class procedure TdaSQLSession.SetDefaultSQLConnection(
Value: TSQLConnection);
begin
if FSQLConnection <> Value then
begin
if Assigned(FSQLConnection) then
begin
if FSQLConnection.Name = cDefaultConnection
then FSQLConnection.Free;
end;
FSQLConnection := Value;
if not Assigned(FSQLConnection)
then GetDefaultSQLConnection;
end;
end;
---------------------------------------------------------------------------
at finalization session,
replace:
FSQLConnection.Free;
to:
if FSQLConnection.Name = cDefaultConnection
then FSQLConnection.Free;
---------------------------------------------------------------------------
If you have a TDatamodule named DataModule1 with a TSQLConnection named
SQLConnection1, you
can assign your SQLConnection as DefaultConnection implementing this event:
procedure OnDataModule1Create(Sender: TObject);
begin
TdaSQLSession.SetDefaultSQLConnection(SQLConnection1);
end;
To me, works fine!
---------------------------------------------------------------------------
I would like Report Builder Team add these modifications in daDBExpress.pas,
because all users will can use this without need to change source code. I
think that other users will can need this too! I don't like to change source
code units. I prefer to use official source code unit with this change.
If you want, I can send to you entire daDBExpress.pas modified and a example
about how to use.
If you will reject these changes, please ask to me why.
Best Regards
Nelson H. C. Nepomuceno
nelson@datagricolae.com.br
Datagricolae Inform?tica Ltda.
www.datagricolae.com.br
TdaSQLSession.SetDefaultSQLConnection(Value: TSQLConnection).
I think that this resource is very useful, because same reasons:
* provides a method to define only one database connection (Less database
licence costs! Less client and server resources);
* only one login in application;
* only one database connection configuration.
I have implemented this at RB 6.03 and RB 7.
RB7:
daDBExpress.pas
---------------------------------------------------------------------------
at public session into TdaSQLSession, insert:
class procedure SetDefaultSQLConnection(Value: TSQLConnection);
---------------------------------------------------------------------------
after, implement method:
class procedure TdaSQLSession.SetDefaultSQLConnection(
Value: TSQLConnection);
begin
if FSQLConnection <> Value then
begin
if Assigned(FSQLConnection) then
begin
if FSQLConnection.Name = cDefaultConnection
then FSQLConnection.Free;
end;
FSQLConnection := Value;
if not Assigned(FSQLConnection)
then GetDefaultSQLConnection;
end;
end;
---------------------------------------------------------------------------
at finalization session,
replace:
FSQLConnection.Free;
to:
if FSQLConnection.Name = cDefaultConnection
then FSQLConnection.Free;
---------------------------------------------------------------------------
If you have a TDatamodule named DataModule1 with a TSQLConnection named
SQLConnection1, you
can assign your SQLConnection as DefaultConnection implementing this event:
procedure OnDataModule1Create(Sender: TObject);
begin
TdaSQLSession.SetDefaultSQLConnection(SQLConnection1);
end;
To me, works fine!
---------------------------------------------------------------------------
I would like Report Builder Team add these modifications in daDBExpress.pas,
because all users will can use this without need to change source code. I
think that other users will can need this too! I don't like to change source
code units. I prefer to use official source code unit with this change.
If you want, I can send to you entire daDBExpress.pas modified and a example
about how to use.
If you will reject these changes, please ask to me why.
Best Regards
Nelson H. C. Nepomuceno
nelson@datagricolae.com.br
Datagricolae Inform?tica Ltda.
www.datagricolae.com.br
This discussion has been closed.