- I'm currently working on a PHP application that uses a MySQL database for its backend
- All of my queries contain backticks to escape the field names. This is so I can have fields like "password" in a query without causing issues (see example)
- I know that backticks are not universal between relational-database engines (SQLite uses a double-quote, for example)
- All of the queries in my php application are executed using PHP's PDO interface
My question is this: If I want to switch database engines, say from MySQL to SQLite, what do I need to do to handle the backticks in all of my queries? I really don't want to have to go through all of my code and change / remove the backticks. Any suggestions? Am I doing something wrong or not within the boundaries of best practices?
Sample Query:
SELECT
`username`,
`password`,
`email_address`
FROM
`users`
WHERE
`id` = '1'