You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
/** * @var int * @see rowCount */private$affected_rows;
/** * swoole并不支持select返回影响数据行 * Returns the number of rows affected by the last SQL statement * @link https://php.net/manual/en/pdostatement.rowcount.php * @return int the number of rows. */publicfunctionrowCount()
{
if (is_array($this->data)){
returncount($this->data);
}
return$this->affected_rows;
}
affected_rows会在query执行时,被影响
public function execute($input_parameters = null)
{
try {
$client = $this->pdo->getClient();
$this->data = $client->query($this->getRawSql());
$this->affected_rows = $client->affected_rows;
if ($this->data === false && $client->error != null) {
throw new \PDOException($client->error,$client->errno);
}
} finally {
if (!$this->pdo->inTransaction()) {
$this->pdo->releaseConnect();
}
}
return is_array($this->data);
}
1.运行环境
centos7 Linux 3.10.0-957.el7.x86_64
php7.2.19
swoole4.3.5
yii2-basic 2.0.20
2.在开启日志功能,将日志信息写入到数据库表中时,会报下面的错误:
不过,日志信息是可以正常插到数据库里,经过跟踪代码,问题出在这个文件:
tsingsun/yii2-swoole/src/db/mysql/PDOStatement.php
下面这个函数:
$this->data的值可能是数字或者数组,当是数字时在PHP7.2上会有警告,参考官方文档:
https://www.php.net/manual/en/function.count.php
下面是一种解决办法:
这应该是个兼容问题,还有没有其他更好的解决方法,可以一起交流一下,谢谢~~
The text was updated successfully, but these errors were encountered: