PDO Event Constants

I have a bit of a doubt about PHP with PDO constants. How do I use it? No documentation, no example, and no questions here.

Does anyone put this to work knows how to use it?


 Deallocation event


 Event triggered prior to execution of a prepared statement.


 Event triggered subsequent to execution of a prepared statement.


 Event triggered prior to fetching a result from a resultset.


 Event triggered subsequent to fetching a result from a resultset.


 Event triggered during bound parameter registration allowing the driver to normalize the parameter name.




source to share

1 answer

These constants are not needed in PHP code and I don't think they will be very useful any time soon. As you can see here They are part of the internal PDO api. Event hooks are used internally to distinguish between drivers: the distribution of a prepared statement and its associated values ​​require different approaches to different drivers. (pay attention to macros #if PDO_USE_MYSQLND

and #else


They may have been added as class constants to allow users to submit callbacks for these events if they so desire. If so, I don't think this is considered a top priority for PDO developers, though ...
Bottom line: You can't use them, just ignore them



All Articles