How is the readonly $queryString
property being set inside PDOStatement class by the PDO::prepare()
execution?
Given the class definition, I don't see any functions which would set that query. Does that mean PDOStatement class can't be used if it's not generated by the PDO class instance through PDO::prepare()
function?
PDOstatement is created internally, by means of C code. And of course C code can set any properties directly.
And yes, you cannot use PDOStatement class (for anything useful) if it's not generated by the PDO class instance through
PDO::prepare()
(orquery()
).However, you can redeclare and tell PDO to use it instead of standard one using code like this