Page 1 of 2

MyDac FastReport component is obsolete

Posted: Wed 02 Nov 2005 13:33
by mvalent
I donwloaded the last version of MyDac and realized that the code of the FastReport component (demo folder) is obsolete.
The TfrxMYDACDatabase object is not of the correct type. I had to change the declaration a little bit. Maybe you can correct this in the next MyDac release. Here below is the modified code (frMyDacComponents.pas):

TfrxMYDACDatabase = class(TfrxDialogComponent)
private
FConnection: TMyConnection;
protected
function GetLoginPrompt: Boolean;
procedure SetLoginPrompt(Value: Boolean);
function GetDatabaseName: string;
procedure SetDatabaseName(const Value: string);
function GetPort: integer;
procedure SetPort(Value: integer);
function GetUsername: string;
procedure SetUsername(const Value: string);
function GetPassword: string;
procedure SetPassword(const Value: string);
function GetServer: string;
procedure SetServer(const Value: string);
function GetConnected: Boolean;
procedure SetConnected(Value: Boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
class function GetDescription: String; override;
procedure SetLogin(const Login, Password: String);
property Connection: TMyConnection read FConnection;
published
property LoginPrompt:Boolean read GetLoginPrompt write SetLoginPrompt default True;
property DatabaseName: String read GetDatabaseName write SetDatabaseName;
property Port: integer read GetPort write SetPort default MYSQL_PORT;
property Username: string read GetUsername write SetUsername;
property Password: string read GetPassword write SetPassword;
property Server: string read GetServer write SetServer;
property Connected: Boolean read GetConnected write SetConnected default False;
end;

Posted: Wed 02 Nov 2005 15:37
by Ikar
Thank you for information. We will check your patch when time permits.
Also please specify your FastReport version.

Posted: Wed 02 Nov 2005 15:48
by mvalent
Version is 3.19 (last available)

Posted: Sat 25 Feb 2006 13:11
by Guest
I downloaded the last version of MyDac.
"Demo for FastReport included in MyDAC was built and tested using
Fast Report 3.20". That is what is written in your readme.txt file, however it didn't work for me.
As before, I had to modify the code. Why are you still using the obsolete "TfrxCustomDatabase" class instead of the new "TfrxDialogComponent" class ? Can't you just copy my code and fix this once for all ?

Another problem is that you still don't provide dpk file for Delphi 2005 and Delphi 2006. Is it so difficult to create and provide these files ?

I feel all this a little bit irritating.

Posted: Sat 25 Feb 2006 13:14
by mvalent
I don't know why it was post as "Guest" but it is me "mvalent"...

no...

Posted: Mon 27 Feb 2006 02:58
by eduardosic
mvalent wrote:Version is 3.19 (last available)
I'm a registered user of FastReport, the last version Stable is 3.20

Posted: Mon 27 Feb 2006 07:56
by mvalent
???

Posted: Mon 27 Feb 2006 08:43
by swierzbicki
He just don't understand why you spoke about 3.19 release as that the 3.20 is out ;).

I guess that he didn't check your topic post date (november 2005 when FastReport release was 3.19...).

Posted: Mon 27 Feb 2006 09:06
by mvalent
I see. Yes I am using the last version 3.20.
I am not very sure if "TfrxCustomDatabase" class or "TfrxDialogComponent" class should be used. It looks that in the FastReport documentation it is "TfrxDialogComponent".

The main problem I face now is that the TfrxMyDacX classes are missing in the classes list in FastReport. The result is that I cannot use the query components in scripts in FastReport.

Posted: Mon 27 Feb 2006 10:31
by Antaeus
We will examine your problem in the future.

the solution is here

Posted: Fri 03 Mar 2006 11:41
by oquz
unit frxMYDACRTTI;

interface

{$I frx.inc}

implementation

uses
Windows, Classes, fs_iinterpreter, frxMYDACComponents
{$IFDEF Delphi6}
, Variants
{$ENDIF};


type
TFunctions = class(TfsRTTIModule)
private
function CallMethod(Instance: TObject; ClassType: TClass;
const MethodName: String; var Params: Variant): Variant;
public
constructor Create(AScript: TfsScript); override;
destructor Destroy; override;
end;

var
Functions: TFunctions;


{ TFunctions }

constructor TFunctions.Create(AScript: TfsScript);
begin
inherited Create(AScript);
with AScript do
begin
AddClass(TfrxMYDACDatabase, 'TfrxCustomDatabase');
AddClass(TfrxMYDACTable, 'TfrxCustomTable');
with AddClass(TfrxMYDACQuery, 'TfrxCustomQuery') do
AddMethod('procedure ExecSQL', CallMethod);
end;
end;

destructor TFunctions.Destroy;
begin
if fsGlobalUnit nil then
fsGlobalUnit.RemoveItems(Self);
inherited;
end;

function TFunctions.CallMethod(Instance: TObject; ClassType: TClass;
const MethodName: String; var Params: Variant): Variant;
begin
Result := 0;

if ClassType = TfrxMYDACQuery then
begin
if MethodName = 'EXECSQL' then
TfrxMYDACQuery(Instance).Query.Execute;
end
end;


initialization
fsRTTIModules.Add(TFunctions);

end.

Posted: Fri 03 Mar 2006 23:34
by mvalent
Great ! It solved my problem ! :-)
Now the TfrxMyDac classes are appearing in the classes list in FastReport.
Can I suggest CrLab Team to correct the code in the distribution before releasing a new version of MyDac ? Thanks !

Posted: Mon 06 Mar 2006 10:46
by Antaeus
Please send us (MyDAC*crlab*com) description of changes you would like to see included into MyDAC. May be we will implement them in future versions.

IMPORTANT

Posted: Mon 06 Mar 2006 11:14
by oquz
IMPORTANT!..

This solution is belong me not mvalent.

Posted: Wed 15 Mar 2006 21:35
by mvalent
Yes. Solution is from oquz... :-)

However, it didn't completely solve my problem...
Now the TfrxMyDac classes are appearing in the classes list in FastReport and I can run the report inside the Delphi IDE with success. But at design time when I run my application I still get the weird message "Class Exception : Unknown type TfrxMYDACQuery".
Any idea oquz ?

-marc-