I currently have a list of defined constants and a function that regex’es every pulled MySQL string and looks for things like CLIENT_NAME, LOCAL_API_ADDRESS and auto-changes it.
// several fields
define ('CLIENT_NAME', '...');
define ('LOCAL_API_ADDRESS', '...');
...
The thing is, as my app is getting larger I feel this is pretty inefficient and bound to loose strings (forgetting to regex here or there).
How do you guys cope with this?
MySQL has had User-defined variables since v3.23.6, but they…
Effectively, there’s no convention in MySQL for storing constants.
You could store the values in a table, but things like MySQL’s REGEXP might require dynamic SQL (using MySQL’s Prepared Statements) in order to take advantage of the setup.