MyDac FastReport component is obsolete

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

MyDac FastReport component is obsolete

Post by mvalent » Wed 02 Nov 2005 13:33

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;

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 02 Nov 2005 15:37

Thank you for information. We will check your patch when time permits.
Also please specify your FastReport version.

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Wed 02 Nov 2005 15:48

Version is 3.19 (last available)

Guest

Post by Guest » Sat 25 Feb 2006 13:11

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.

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Sat 25 Feb 2006 13:14

I don't know why it was post as "Guest" but it is me "mvalent"...

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

no...

Post by eduardosic » Mon 27 Feb 2006 02:58

mvalent wrote:Version is 3.19 (last available)
I'm a registered user of FastReport, the last version Stable is 3.20

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Mon 27 Feb 2006 07:56

???

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Mon 27 Feb 2006 08:43

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...).

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Mon 27 Feb 2006 09:06

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.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 27 Feb 2006 10:31

We will examine your problem in the future.

oquz
Posts: 11
Joined: Mon 02 Jan 2006 15:16

the solution is here

Post by oquz » Fri 03 Mar 2006 11:41

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.

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Fri 03 Mar 2006 23:34

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 !

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 06 Mar 2006 10:46

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.

oquz
Posts: 11
Joined: Mon 02 Jan 2006 15:16

IMPORTANT

Post by oquz » Mon 06 Mar 2006 11:14

IMPORTANT!..

This solution is belong me not mvalent.

mvalent
Posts: 62
Joined: Thu 04 Nov 2004 17:42

Post by mvalent » Wed 15 Mar 2006 21:35

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-

Post Reply