Reputation: 9
I'm creating my own CMS, part of this is making sure it is interoperable with different database types. PDO is therefore my default choice, my question is:
Is there any way to dynamically detect and set the database type in a PDO connection class?
As far as i can see there isn't so i was thinking just doing a bunch of try/catch on different database types then writing the one that doesn't throw an exception to a config file.
Upvotes: 0
Views: 140
Reputation: 157880
Although PHP has extension_loaded()
function, as it was noted in the comments, multiple databases support is not that easy.
Your question is a typical example of premature engineering. You don't have your CMS yet, you don't have support for even one database, but your only concern is how to detect it.
Upvotes: 5