Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procedure name contains character ` cannot backup #101

Open
mrXim opened this issue Mar 14, 2023 · 3 comments
Open

Procedure name contains character ` cannot backup #101

mrXim opened this issue Mar 14, 2023 · 3 comments

Comments

@mrXim
Copy link

mrXim commented Mar 14, 2023

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

@adriancs2
Copy link
Member

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

@mrXim
Copy link
Author

mrXim commented Mar 21, 2023 via email

@adriancs2
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants