Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDO Event Constants

i've a little doubt about on PHP with PDO constants. How i use it? There is no documentation and no example and no questions here about it.

Did some one put this into work knows how to use it?

PDO::PARAM_EVT_FREE (integer)

 Deallocation event

PDO::PARAM_EVT_EXEC_PRE (integer)

 Event triggered prior to execution of a prepared statement.

PDO::PARAM_EVT_EXEC_POST (integer)

 Event triggered subsequent to execution of a prepared statement.

PDO::PARAM_EVT_FETCH_PRE (integer)

 Event triggered prior to fetching a result from a resultset.

PDO::PARAM_EVT_FETCH_POST (integer)

 Event triggered subsequent to fetching a result from a resultset.

PDO::PARAM_EVT_NORMALIZE (integer)

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

http://php.net/manual/en/pdo.constants.php

like image 934
Carlos Avatar asked Dec 07 '25 10:12

Carlos


1 Answers

These constants have no use in PHP code, and I don't really think they will be of much use 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: allocating a prepared statement, and its bound values happens requires different approaches on different drivers. (notice the #if PDO_USE_MYSQLND and #else macro's)

Perhaps they were added as class constants to enable users to pass in callbacks for these events if they so wish. If this is so, I don't think this is considered to be top priority for the PDO developers, though...
Bottom line: You can't use them, simply ignore them

like image 193
Elias Van Ootegem Avatar answered Dec 09 '25 22:12

Elias Van Ootegem