MySqlBackup.Net
                                
                                 MySqlBackup.Net copied to clipboard
                                
                                    MySqlBackup.Net copied to clipboard
                            
                            
                            
                        Can you use dependency on MySqlConnector.net (MIT License) instead of MySql.Data( GPL License)
MySqlConnector.Net licensing seems to be a better choice for many, also performance-wise it has a slight edge.
Thanks for the info. I'll look into this
I'd appreciate this as well.
May I know how do you insert scripts? The blocks of SQL statements for creating procedures, functions, etc?
In MySql.Data, the code will be something like this:
string text = @"DELIMITER |
CREATE PROCEDURE `proceduresample1`()
    DETERMINISTIC
    COMMENT 'A procedure'
BEGIN
SELECT 'Hello World !';
END |";
using (MySqlConnection conn = new MySqlConnection(ConnectionString))
{
	MySqlScript script = new MySqlScript(conn);
	script.Query = text;
	script.Execute();
}
What is the equivalent of above code if using MySqlConnector.net?
I've never done that so far sorry.
Hi!! You may look into this discussion: https://github.com/mysql-net/MySqlConnector/issues/382 Best regards
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Adrian Voomailto:[email protected] Sent: 21 January 2021 16:43 To: MySqlBackupNET/MySqlBackup.Netmailto:[email protected] Cc: himanshukodwanimailto:[email protected]; Authormailto:[email protected] Subject: Re: [MySqlBackupNET/MySqlBackup.Net] Can you use dependency on MySqlConnector.net (MIT License) instead of MySql.Data( GPL License) (#63)
May I know how do you insert scripts? The blocks of SQL statements for creating procedures, functions, etc?
In MySql.Data, the code will be something like this:
string text = @"DELIMITER |
CREATE PROCEDURE proceduresample1()
DETERMINISTIC
COMMENT 'A procedure'
BEGIN
SELECT 'Hello World !';
END |";
using (MySqlConnection conn = new MySqlConnection(ConnectionString))
{
    MySqlScript script = new MySqlScript(conn);
    script.Query = text;
    script.Execute();
    script = null;
}
What is the equivalent code of if using MySqlConnector.net?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MySqlBackupNET/MySqlBackup.Net/issues/63#issuecomment-764562643, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ7O4IRKJR56MIES52J54LTS3AD6ZANCNFSM4QISV3PQ.
Can confirm you can just use a MySQLCommand in MySQLConnector to run multiple things. Using it and was looking for a backup-integration into my software and ended up here ;)
In my buildsystem I create different sql files for either full creating of my schema or patching a schema between to versions of my database-schema. I can simply load my file into a string, put it into a MySQLCommand and run it and it'll work as expected running all the create/alter statements in it.
From that discussion, MySQLScript from Oracle sounds like a hack to fix a designflaw in their MySQLCommand o.o
Well, MySqlConnector.Net not support DELIMITER statement, DELIMITER it's only work with MySqlClient:
https://github.com/mysql-net/MySqlConnector/issues/645
So, consider notify user do not use DELIMITER.
Your sql can remove DELIMITER and code will be:
string text = @"DROP PROCEDURE IF EXISTS`proceduresample1`;
-- DELIMITER |
CREATE PROCEDURE `proceduresample1`()
    DETERMINISTIC
    COMMENT 'A procedure'
BEGIN
    SELECT 'Hello World !';
-- END |
END;
CALL proceduresample1;
";
using (MySqlConnection conn = new MySqlConnection(ConnectionString))
using (MySqlCommand cmd = new MySqlCommand(text, conn))
{
    conn.Open();
    Debug.WriteLine(cmd.ExecuteScalar());
    //Output "Hello World !"
}
News ?
Hi @adriancs2, as i was stuck without it, i made a quick (& maybe dirty) fork supporting it, plus a nuget package.
https://github.com/souchprod/MySqlBackup.Net https://www.nuget.org/packages/MySqlBackup.NET.MysqlConnector/2.3.4.2
It was mostly about changing the reference to MysqlConnector & using a clone of MysqlScript. Let me know if you want a PR or if you prefer to implement it yourself your own way. Once implemented, i will remove my package from Nuget.
Hi @souchprod , nice work :) I have included the 2 additional files ( MySqlScript.cs and MySqlTokenizer.cs ) that done by you and built the DLL. Nice workaround. and thanks.
along with additional for support of MySqlConnector.DLL, I have also added some updates, here are the summary:
[New]
- ExportInformation.EnableComment = true. (new option)
- Added support for MySqlConnector (MIT)
- ExportToFile(), if the directory is not existed. MySqlBackup will attempt to create it.
[Improve]
- ImportInfo.ErrorLogFile = true. Now will include the query that causes the error.
- ExportToFile = Auto created directory if not exists.
- For non delimeter changed query execution, using MySqlCommand in stead of MySqlScript, slightly increase overall import speed.
- Minor clean up.
I did some benchmark between MySqlCommand and MySqlScript, and I found that MySqlCommand is slightly faster than MySqlScript. Therefore, for normal execution, I use MySqlCommand, and for routines creation (store procedures, functions, views, triggers, etc...), I use MySqlScript.
Below is the summary of the benchmark:
Database Size: 380MB
CPU: Intel Core i5
RAM: 12GB
Harddisk: Samsung SSD Evo 860
Time(Avr)   Class - DLL
---         ---
57s         mysql.exe (MySqlWorkbench)
1m 5s       MySqlCommand - MySql.Data.DLL
1m 5s       MySqlCommand - MySqlConnector.DLL
1m 5s       MySqlCommand - Devart.Express.MySql.DLL
1m 16s      MySqlScript  - MySql.Data.DLL
I have already released the binaries for MySqlConnector.DLL. You can download it at:
https://github.com/MySqlBackupNET/MySqlBackup.Net/releases
You can also download the specific files here for testing: MySqlBackupNet.MySqlConnector.DLL(2.3.5).zip
Thanks @souchprod and @Adrian Voo for the nice work done. Was looking forward to it since long. Take care guys. Himanshu Kodwani
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Adrian @.> Sent: 22 September 2021 13:18 To: @.> Cc: @.>; @.> Subject: Re: [MySqlBackupNET/MySqlBackup.Net] Can you use dependency on MySqlConnector.net (MIT License) instead of MySql.Data( GPL License) (#63)
Hi @souchprodhttps://github.com/souchprod , nice work :) I have included the 2 additional files ( MySqlScript.cs and MySqlTokenizer.cs ) and built the DLL. Nice workaround. and thanks.
along with additional for support of MySqlConnector.DLL, I have also added some updates, here are the summary:
[New]
- ExportInformation.EnableComment = true. (new option)
- Added support for MySqlConnector (MIT)
- ExportToFile(), if the directory is not existed. MySqlBackup will attempt to create it.
[Improve]
- ImportInfo.ErrorLogFile = true. Now will include the query that causes the error.
- ExportToFile = Auto created directory if not exists.
- For non delimeter changed query execution, using MySqlCommand in stead of MySqlScript, slightly increase overall import speed.
- Minor clean up.
I did some benchmark between MySqlCommand and MySqlScript, and I found that MySqlCommand is slightly faster than MySqlScript. Therefore, for normal execution, I use MySqlCommand, and for routines creation (store procedures, functions, views, triggers, etc...), I use MySqlScript.
Below is the summary of the benchmark:
Database Size: 380MB
CPU: Intel Core i5
RAM: 12GB
Harddisk: Samsung SSD Evo 860
Time(Avr) Class - DLL
57s mysql.exe (MySqlWorkbench)
1m 5s MySqlCommand - MySql.Data.DLL
1m 5s MySqlCommand - MySqlConnector.DLL
1m 5s MySqlCommand - Devart.Express.MySql.DLL
1m 16s MySqlScript - MySql.Data.DLL
I have already released the binaries for MySqlConnector.DLL. You can download it at: https://github.com/MySqlBackupNET/MySqlBackup.Net/releases
You can also download the specific files here for testing: MySqlBackupNet.MySqlConnector (v2.3.5).ziphttps://github.com/MySqlBackupNET/MySqlBackup.Net/files/7208737/MySqlBackupNet.MySqlConnector.v2.3.5.zip
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MySqlBackupNET/MySqlBackup.Net/issues/63#issuecomment-924673626, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ7O4ITW3ZIKLHXOPOEUVLLUDGC6BANCNFSM4QISV3PQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hi @souchprod I would like to upload the new nuget package for MySqlConnector, can you add me as the owner of the package? https://www.nuget.org/packages/MySqlBackup.NET.MysqlConnector/
HI @adriancs2 , yep i'll search how to do this now, nice to have the changes included in the original repo and glad to see the other improvements