Closed stefandoorn closed 9 years ago
+1 on this. I would love to see that if PDO typehint was cleared to pass a closure to solve the problem to initialize PDO when used for the first time, because now you have to open a database connection even if you dont use it at all.
Just a heads up: I am currently quite busy and won't be able to look into this issue before the weekend. Expect an answer on Sunday :)
So these are basically two related issues. I have merged the pull-request and created a new release based on code on stefandoorn.
@tgabi333: If I understand this correctly, you want to pass a closure that is evaluated on first usage returning the required pdo object? Could you please file a separate issue for this? Thanks!
Best, Daniel
I changed $pdo into a nullable parameter. Allows me to extend your class and add my own PDO class into the object. Point is that I use a PDO connection, but it's wrapped in another object for debugging purposes (PHPDebugBar).
Besides that I adjusted the VARCHAR(200) into TEXT. In some cases more logging is required. Data storage required is length + 2 bytes, so still people can insert short data without big problems.