MySqlBackup.Net icon indicating copy to clipboard operation
MySqlBackup.Net copied to clipboard

Procedure name contains character ` cannot backup

Open mrXim opened this issue 2 years ago • 3 comments
trafficstars

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

mrXim avatar Mar 14 '23 09:03 mrXim

This is ok. I'll include this in the next release

adriancs2 avatar Mar 21 '23 04:03 adriancs2

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: @.***>

mrXim avatar Mar 21 '23 06:03 mrXim

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.

adriancs2 avatar May 25 '23 05:05 adriancs2