-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from eeliu/feat-php8.1
ProfilerMysqli_Stmt in php8.1
- Loading branch information
Showing
9 changed files
with
401 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/****************************************************************************** | ||
* Copyright 2020 NAVER Corp. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); * | ||
* you may not use this file except in compliance with the License. * | ||
* You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software * | ||
* distributed under the License is distributed on an "AS IS" BASIS, * | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
* See the License for the specific language governing permissions and * | ||
* limitations under the License. * | ||
******************************************************************************/ | ||
namespace Pinpoint\Plugins\Sys\mysqli7; | ||
|
||
class Mysqli extends \mysqli | ||
{ | ||
public function prepare ($query) | ||
{ | ||
$plugin = new MysqliPreparePlugin("Mysqli::prepare",$this,$query); | ||
try{ | ||
$plugin->onBefore(); | ||
$ret = parent::prepare($query); | ||
$plugin->onEnd($ret); | ||
return $ret; | ||
|
||
}catch (\Exception $e) | ||
{ | ||
$plugin->onException($e); | ||
} | ||
} | ||
|
||
public function query ($query, $resultmode = NULL) | ||
{ | ||
$plugin = new MysqliQueryPlugin("Mysqli::query",$this,$query, $resultmode); | ||
try{ | ||
$plugin->onBefore(); | ||
$ret = parent::query($query,$resultmode); | ||
$plugin->onEnd($ret); | ||
return $ret; | ||
|
||
}catch (\Exception $e) | ||
{ | ||
$plugin->onException($e); | ||
} | ||
} | ||
} | ||
|
||
function mysqli_init() { | ||
return new Mysqli(); | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/****************************************************************************** | ||
* Copyright 2020 NAVER Corp. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); * | ||
* you may not use this file except in compliance with the License. * | ||
* You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software * | ||
* distributed under the License is distributed on an "AS IS" BASIS, * | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
* See the License for the specific language governing permissions and * | ||
* limitations under the License. * | ||
******************************************************************************/ | ||
namespace Pinpoint\Plugins\Sys\mysqli7; | ||
|
||
|
||
use Pinpoint\Plugins\Common\PinTrace; | ||
|
||
class MysqliPreparePlugin extends PinTrace | ||
{ | ||
function onBefore() | ||
{ | ||
$myqli = $this->who; | ||
pinpoint_add_clue(PP_SERVER_TYPE,PP_MYSQL); | ||
pinpoint_add_clue(PP_SQL_FORMAT, $this->args[0]); | ||
pinpoint_add_clue(PP_DESTINATION,$myqli->host_info); | ||
} | ||
|
||
function onEnd(&$ret) | ||
{ | ||
$origin = $ret; | ||
$ret = new ProfilerMysqli_Stmt($origin); | ||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/****************************************************************************** | ||
* Copyright 2020 NAVER Corp. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); * | ||
* you may not use this file except in compliance with the License. * | ||
* You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software * | ||
* distributed under the License is distributed on an "AS IS" BASIS, * | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
* See the License for the specific language governing permissions and * | ||
* limitations under the License. * | ||
******************************************************************************/ | ||
namespace Pinpoint\Plugins\Sys\mysqli7; | ||
|
||
|
||
use Pinpoint\Plugins\Common\PinTrace; | ||
|
||
class MysqliQueryPlugin extends PinTrace | ||
{ | ||
|
||
function onBefore() | ||
{ | ||
$myqli = $this->who; | ||
pinpoint_add_clue(PP_SERVER_TYPE,PP_MYSQL); | ||
pinpoint_add_clue(PP_SQL_FORMAT,$this->args[0]); | ||
pinpoint_add_clue(PP_DESTINATION,$myqli->host_info); | ||
} | ||
|
||
function onEnd(&$ret) | ||
{ | ||
|
||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/****************************************************************************** | ||
* Copyright 2020 NAVER Corp. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); * | ||
* you may not use this file except in compliance with the License. * | ||
* You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software * | ||
* distributed under the License is distributed on an "AS IS" BASIS, * | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
* See the License for the specific language governing permissions and * | ||
* limitations under the License. * | ||
******************************************************************************/ | ||
namespace Pinpoint\Plugins\Sys\mysqli7; | ||
|
||
class ProfilerMysqliResult | ||
{ | ||
protected $_instance; | ||
public function __construct(&$instance) | ||
{ | ||
$this->_instance = &$instance; | ||
} | ||
|
||
public function __call($name, $arguments) | ||
{ | ||
return call_user_func_array([&$this->_instance,$name],$arguments); | ||
} | ||
|
||
} |
Oops, something went wrong.