-
Notifications
You must be signed in to change notification settings - Fork 7.8k
PDO and driver specific methods #5765
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
Conversation
This should be based of the master branch and not PHP 7.4. Doesn't seem like there is much to review currently as it's still a W.I.P. so you may want to mark this PR as a draft. :) |
Thanks @Girgias, Draft was new to me! |
@pbowyer have you considered leaving PDO class as is but moving driver methods into driver specific classes implementing a PDODriver empty interface (maybe with some getName() at max) and then allowing to access these drivers from for eg. At least this is something which came to my mind today when trying to figure out if the pdo driver for sqlite should and where get added the mapping for But if not then I can think of doing something like it. |
In 8.4 we have https://wiki.php.net/rfc/pdo_driver_specific_subclasses - can this be closed? |
Yeah this seems reasonable to close now. |
This pull request is a spin-off from https://externals.io/message/110578.
What is it trying to achieve?
To provide full functionality there is a need to add driver-specific methods to PDO.
I discovered that I cannot load SQLite extensions such as GIS functions when using PDO-SQLite, and raised this on the mailing list. Rightly, no one wants to add driver-specific functionality to PDO - what's in PDO should be portable.
The consensus is that adding driver-specific subclassing of PDO is the way to go, and driver-specific functionality should be added here.
Why a Pull Request now?
I last wrote C 2 decades ago, and those were simple programs. I'm enjoying the challenge of digging into the PHP source code and doing copy&paste development but I don't know enough to complete this. I'm getting stuck and I need help.
I've been using SQLite as my testbed; if taken forward the work would need scaling to all drivers.
Preliminary plans
PDO::connect()
methodPDO::connect()
do the same asnew PDO()
but return the right driver-instance (PDOSQLite in this case)Far-Future plans
PDO
continue to work