Avatar of tonelm54
tonelm54
 asked on

bindValue override

Im trying to debug several SQL statments, and thinking a way around is to override the 'bindValue' method so I can log what is being bound to the query. So what I currently do is:-
$rsRowImport = $this->pdo->prepare($this->JSONRec['SQL']);
$rsRowImport->bindValue(':field`, 'Test'l,PDO::PARAM_STR);

Open in new window


So, what I want to do is override the return of prepare to $rwRowImport, and then override the bindValue so I can add in a logging method, then I can call the parent bindValue to do the actual bindValue.

My issue is, I have no idea how i can capture what is returned and then override it. Any ideas?
PHP

Avatar of undefined
Last Comment
As Network

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ben Sch

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
As Network

Please use this code:
$rsRowImport = $this->pdo->prepare($this->JSONRec['SQL']);
$rsRowImport->bindValue(':field', 'Testl', PDO::PARAM_STR);

Open in new window


thank you
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy