MyDAC 3.55 -> 5.xx Units Changed - Need Compiler Directive

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ShaiLeTroll
Posts: 10
Joined: Thu 18 Jun 2009 16:15

MyDAC 3.55 -> 5.xx Units Changed - Need Compiler Directive

Post by ShaiLeTroll » Thu 18 Jun 2009 16:30

Hello,

Finally, my company provides the budget for the move to MySQL 5.1
But, we use an old version of MyDAC, 3.55, is not work with MySQL 5.1 (it worked for 4.1 and 5.0)
we work on many projects, and the migration from 3.55 to 5.00 requires changes (the TMyTable doesn't without SQL and there was abuse TMyTable with only TableName, I replace everything by TMyQuery)

the problem is that I must maintain a unique code for 3.55 and 5.00 because we can not migrate all the applications, I use MyAccess.MyDACVersion in RunTime, but I have problem in DesignTime, I have not found a compiler directive because TErrorAction has been moved from MyScript to DAScript

I want to do that

Code: Select all

uses
  ... {$IFDEF MYDAC_VER_500}DAScript, MyScript{$ENDIF}
      {$IFDEF MYDAC_VER_355}MyScript{$ENDIF} ...;
I am open to other ideas


PS : Sorry for my poor english

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

Re: MyDAC 3.55 -> 5.xx Units Changed - Need Compiler Directive

Post by eduardosic » Thu 18 Jun 2009 16:59

ShaiLeTroll wrote:Hello,

Finally, my company provides the budget for the move to MySQL 5.1
But, we use an old version of MyDAC, 3.55, is not work with MySQL 5.1 (it worked for 4.1 and 5.0)
we work on many projects, and the migration from 3.55 to 5.00 requires changes (the TMyTable doesn't without SQL and there was abuse TMyTable with only TableName, I replace everything by TMyQuery)

the problem is that I must maintain a unique code for 3.55 and 5.00 because we can not migrate all the applications, I use MyAccess.MyDACVersion in RunTime, but I have problem in DesignTime, I have not found a compiler directive because TErrorAction has been moved from MyScript to DAScript

I want to do that

Code: Select all

uses
  ... {$IFDEF MYDAC_VER_500}DAScript, MyScript{$ENDIF}
      {$IFDEF MYDAC_VER_355}MyScript{$ENDIF} ...;
I am open to other ideas


PS : Sorry for my poor english
TMyTable from MyDAC 3.55 and MyDAC 5.00 is total compatible.

you need upgrade MyDAC and open all forms from the project and make a Build All.

please, delete all files from a old version of MyDAC 3.55

go to work's fine.

ShaiLeTroll
Posts: 10
Joined: Thu 18 Jun 2009 16:15

Post by ShaiLeTroll » Fri 19 Jun 2009 16:16

I tested several times, I have changed in this day between 3.55, 4.30, 5.55 and 5.80 (trial) and Engine with MySQL 4.1 (EasyPHP 1.8), MySQL 5.0 (Wampserver 2.0c and mysql-essential), MySQL 5.1 ( Wampserver 2.0G-1 and mysql-essential, embedded) ... at a given moment, it did not work, surely my Delphi could do more (neither I)

I retested this afternoon, I use virtual machine, I uninstall 3.55, I check and delete files, dcu, bpl, ... I install 5.55, I Complete Build Internal Library DPK (herited object from TMy*...) and I Complete Buid Project Application it works (in fact, the another day, DataSetManager had crash before my problem)

We not use TMyTable on Forms, sometimes on DataModule, but the problem is with dynamically instantiated objects in the internal library of my company (no form, no owner) but I have not reproduced the bug (high probability of mixed file, I have not deleted each time the lib MyDac), then it is solved for this part

Otherwise, with more than 1000 forms in 10 projects, open them one by one is tedious but normally no developer has done that, the deposit is to use a Factory

And for the Compiler Directive and section "uses" problems,
you have an idea ?


.

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

Post by swierzbicki » Fri 19 Jun 2009 19:39

Hi,

Do you need some advices ? (as tu besoin d'aide ?).
I'm working a lot with dynamically created MyQueries and didn't face any issues so far.

Ps : glad to see that your firm has decided to update your MyDac components

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

Post by eduardosic » Fri 19 Jun 2009 20:08

ShaiLeTroll wrote:I tested several times, I have changed in this day between 3.55, 4.30, 5.55 and 5.80 (trial) and Engine with MySQL 4.1 (EasyPHP 1.8), MySQL 5.0 (Wampserver 2.0c and mysql-essential), MySQL 5.1 ( Wampserver 2.0G-1 and mysql-essential, embedded) ... at a given moment, it did not work, surely my Delphi could do more (neither I)

I retested this afternoon, I use virtual machine, I uninstall 3.55, I check and delete files, dcu, bpl, ... I install 5.55, I Complete Build Internal Library DPK (herited object from TMy*...) and I Complete Buid Project Application it works (in fact, the another day, DataSetManager had crash before my problem)

We not use TMyTable on Forms, sometimes on DataModule, but the problem is with dynamically instantiated objects in the internal library of my company (no form, no owner) but I have not reproduced the bug (high probability of mixed file, I have not deleted each time the lib MyDac), then it is solved for this part

Otherwise, with more than 1000 forms in 10 projects, open them one by one is tedious but normally no developer has done that, the deposit is to use a Factory

And for the Compiler Directive and section "uses" problems,
you have an idea ?


.
ShaiLeTroll, i create a small project in Delphi 7 with mydac 3.55... after this.. i open the project in Delphi 2007 with Mydac 5, last build.. i compile sucessful.. no problems with uses clause..

you can create a smal video ou project to show this problem?

thanks.

ShaiLeTroll
Posts: 10
Joined: Thu 18 Jun 2009 16:15

Post by ShaiLeTroll » Mon 22 Jun 2009 09:35

eduardosic wrote:you can create a smal video ou project to show this problem?
No, I can not reproduce this anomaly (it seems to me that it was only with MySQL 1.8 EasyPhp 4.1), I think that during my test day, I changed 5 times in a version (including 5.80 in trial) and I was confused (I maybe forgot a complete build)

ShaiLeTroll
Posts: 10
Joined: Thu 18 Jun 2009 16:15

Post by ShaiLeTroll » Wed 09 Dec 2009 15:58

Hello

I Found the reason of problèm with TMyTable,

Code: Select all

> # Set the SQL mode to strict
> sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
I change config file :

Code: Select all

> sql-mode=""
I don't have anymore errors !

the parameters sql-mode depends on the MySQL Kit Install :
WampServer = Empty
Essentials = "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"


Other subjects :
I create my own directive EPC_MYDAC_VER_500_UP to keep a compatible code on internal library of my office with MyDac 3.55 et 5.55.
Also, I have solved the problem with DASript unit
I Change Project Options (I use VirtualBox) depending on the version of installed MyDac

Post Reply