MySqlBackup.Net
MySqlBackup.Net copied to clipboard
Procedure name contains character ` cannot backup
Hi friend,
I have a problem that when my procedure name contains the character `, I get an error that cannot execute.
I cloned the source code and checked it in the file https://github.com/MySqlBackupNET/MySqlBackup.Net/blob/master/source%20code/MySqlBackup(MySql.Data)/MySqlObjects/MySqlProcedure.cs command to get procedure information throws exception
Original code
string sql = string.Format("SHOW CREATE PROCEDURE {0};", procedureName);
I propose
string sql = string.Format("SHOW CREATE PROCEDURE {0};", procedureName.Replace("", "``"));`
This is more extensible to configuration or implementation parameters to support more special characters
Note: Will have the same problem when creating sql content in the generated backup file.
Please consider my offer
Thank
This is ok. I'll include this in the next release
thank friend
On Tue, 21 Mar 2023 at 11:18 adriancs @.***> wrote:
This is ok. I'll include this in the next release
— Reply to this email directly, view it on GitHub https://github.com/MySqlBackupNET/MySqlBackup.Net/issues/101#issuecomment-1477260684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHBAGU4VQ4WDI5DXC6FQD3W5ET2JANCNFSM6AAAAAAV2GT2CI . You are receiving this because you authored the thread.Message ID: @.***>
though, it is possible to create a procedure name with the symbol ` (backtick), it is highly not recommended to do so.
To call a procedure, you would normally do something like:
CALL procedure_name();
But with ` (backtick) as part of the name, in order to run a procedure, now you have to type as follow:
CALL `procedure``name`();
Introducing extra unecessary ` (backtick) to your code.
Which also causes unecessary complexity and introducing potential SQL syntax error.
It doesn't cause any convenience.
But, however, it's your code, so, it's up to you to decide.