Is there any alternative checking technique for valid mysql function/keyword in PHP?
Is there any alternative checking technique for valid mysql function/keyword in PHP?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The list of reserved words changes between different MySQL versions, and whether built-in function names can also be used as raw schema names varies depending on the sql_mode (in particular
IGNORE_SPACE, which is set inANSImode).So, if what you’re trying to do is test a potential schema name for validity, no: you can’t tell whether a schema name is going to be clear or not, short of actually connecting to the database and trying to execute some SQL using the keyword in question. Better to quote schema names to avoid the issue. (A pity, then, that MySQL’s schema-name quotes are backticks instead of the ANSI-standard double-quotes. Again, this is something ANSI sql_mode can fix.)