Re: some MDB2 questions

From: Date: Thu, 17 Feb 2005 14:33:13 +0000
Subject: Re: some MDB2 questions
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36243@lists.php.net to get a copy of this message
Andreas Korthaus wrote:
Lukas Smith schrieb:
function countQueries(&$db, $scope, $message) {
    GLOBALS['count']++;
} $mdb2->setOption('debug_handler', 'countQueries'); $mdb2->setOption('debug', true); $mdb2->query(); $mdb2->query(); echo GLOBALS['count'];
Great! Thank you! I think autoExecute()... is also counted, right?
every query calls the debug method. my example is not quite complete though. the second parameter $scope tells you what part of MDB2 issued the debug callback. For example starting and ending a transaction will also start the callback. Also I think that it may be possible for executing a prepared query to issue multiple debug callbacks in some drivers that emulate prepared queries. regards, Lukas

« previous php.pear.dev (#36243) next »