Last active
January 26, 2021 13:44
-
-
Save avtehnik/ba72c7eea8394b77b2481b0bacd169c7 to your computer and use it in GitHub Desktop.
Revisions
-
avtehnik revised this gist
Jan 26, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php class PDOLog extends PDO{ public $queriesLog = []; -
avtehnik created this gist
Jan 26, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ class PDOLog extends PDO{ public $queriesLog = []; public $transactionCounter = 0; public function prepare(){ $arg_list = func_get_args(); $this->queriesLog[] = $arg_list[0]; return call_user_func_array(array($this, 'parent::' . __FUNCTION__), $arg_list); } public function beginTransaction() { $this->transactionCounter++; return parent::beginTransaction(); } public function commit() { $this->transactionCounter = 0; return parent::commit(); } public function rollback() { $this->transactionCounter = 0; return parent::rollback(); } }