MyDAC 5.0 and TMyDump

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

MyDAC 5.0 and TMyDump

Post by GuzunNicolae » Tue 06 Mar 2007 12:26

Will there be any updates in TMyDump component in MyDAC 5.0??
Especially I am asking about the following changes:
- add a kind of these lines

Code: Select all

/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
at the beginning of the generated script and a kind of these lines

Code: Select all

/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
at the end of the script as mysqldump.exe does
- will there be a good support for dumping views for MySQL 5?

Thanks

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

Post by Antaeus » Tue 06 Mar 2007 15:00

The first feature is already implemented in TMyDump.
Please describe more detailed, what do you mean under a good support for dumping views.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Tue 06 Mar 2007 15:28

The first feature is already implemented in TMyDump.
Is it????? I spent one day on fixing this in my project :cry:
Can you please show me how to turn on this feature? Or where can I read about it. I am using MyDAC 4.30.1.15
Please describe more detailed, what do you mean under a good support for dumping views.
If I dump a database, views are treaded as normal tables, only the data is not dumped (while I saw TBackup backups the data from the view, this should be checked too). But in the script there can be such a situation that the view definition is located before the table definition itself, so when the script executes create view statement you will get an error stating that the table does not exist.
First of all tables should be dumped and after that views.

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

Post by Antaeus » Wed 07 Mar 2007 12:09

Can you please show me how to turn on this feature? Or where can I read about it. I am using MyDAC 4.30.1.15
This feature is added in MyDAC 5. You can download the trial version of MyDAC 5 and test it.
First of all tables should be dumped and after that views.
Thank you for your suggestion. We will think about implementing this in the future.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Wed 07 Mar 2007 15:58

Very nice.
I will wait for it.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Re: MyDAC 5.0 and TMyDump

Post by GuzunNicolae » Wed 11 Apr 2007 09:33

GuzunNicolae wrote:Will there be any updates in TMyDump component in MyDAC 5.0??
Especially I am asking about the following changes:
- add a kind of these lines

Code: Select all

/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
at the beginning of the generated script and a kind of these lines

Code: Select all

/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
at the end of the script as mysqldump.exe does
Thanks
Hello
You said this feature will be implemented in MyDAC 5. But it is not.
Yes there is the above line in the header and in footer but there are many more such lines. Look at what mysqldump.exe generates.

Code: Select all

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
This is for header.
The most important for me is /*!40101 SET NAMES utf8 */;
Without it it is not possible to backup and restore Unicode data normally.

Will this be fixed?

Thanks

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

Re: MyDAC 5.0 and TMyDump

Post by Antaeus » Thu 12 Apr 2007 09:07

GuzunNicolae wrote:The most important for me is /*!40101 SET NAMES utf8 */;
Without it it is not possible to backup and restore Unicode data normally.
Thanks
It is unlikely that this statement will be added to the header of the script generated by TMyDump. This may lead to unforeseen consequences. Try to set the TMyConnection.Options.UseUnicode for forking with Unicode data.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Re: MyDAC 5.0 and TMyDump

Post by GuzunNicolae » Fri 13 Apr 2007 06:56

It is unlikely that this statement will be added to the header of the script generated by TMyDump. This may lead to unforeseen consequences. Try to set the TMyConnection.Options.UseUnicode for forking with Unicode data.
Ok, I solved it with setting TMyConnection.Options.UseUnicode to False while resotring, and TMyConnection.Options.Charset to UTF8.
But what will happen if I will want to restore that file with mysqldump.exe ???

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

Post by Antaeus » Fri 13 Apr 2007 08:27

Most possible all Unicode data will be damaged. You should add this line manually to the script header:

Code: Select all

/*!40101 SET NAMES utf8 */;

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Fri 13 Apr 2007 09:39

So as I understand this feature will not be implemented into MyDAC?

At least as an option. For big files there is a problem adding this line at the beginning of the file. I have to create a temporary file for this cause loading 500Mb in memory is not a very good solution.

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

Post by Antaeus » Fri 13 Apr 2007 10:33

Please specify, why you cannot use TMyDump for dumping and restoring.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Fri 13 Apr 2007 14:02

If I use TMyDump for dumping AND restoring there are no problmes.
But if I use TMyDump for dumping and ANOTHER TOOL for restoring as you said data might be lost. Which is not good.

As for possibility to loose data when you will put

Code: Select all

/*!40101 SET NAMES utf8 */;
in the generated script of TMyDump I guess this will not happen if you will add several lines at the end of the script to restore names variable back.

Why don't you add the same header and footer as in mysqldump.exe?

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

Post by Antaeus » Tue 17 Apr 2007 08:01

We will add support for adding commands to set and restore character sets to the SQL script generated by TMyDump. It will be available in the next MyDAC build. We plan to release it in few days.

Post Reply