mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Query类的select方法的返回结果集判断 Connection类增加getNumRows方法
This commit is contained in:
@@ -700,6 +700,16 @@ abstract class Connection
|
|||||||
return $this->linkID->lastInsertId($sequence);
|
return $this->linkID->lastInsertId($sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取返回或者影响的记录数
|
||||||
|
* @access public
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getNumRows()
|
||||||
|
{
|
||||||
|
return $this->numRows;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最近的错误信息
|
* 获取最近的错误信息
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
@@ -1883,7 +1883,7 @@ class Query
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 返回结果处理
|
// 返回结果处理
|
||||||
if ($resultSet) {
|
if ($this->connection->getNumRows()) {
|
||||||
// 数据列表读取后的处理
|
// 数据列表读取后的处理
|
||||||
if (!empty($this->model)) {
|
if (!empty($this->model)) {
|
||||||
// 生成模型对象
|
// 生成模型对象
|
||||||
@@ -1898,7 +1898,7 @@ class Query
|
|||||||
}
|
}
|
||||||
$resultSet[$key] = $result;
|
$resultSet[$key] = $result;
|
||||||
}
|
}
|
||||||
if (!empty($options['with'])) {
|
if (!empty($options['with']) && $result instanceof Model) {
|
||||||
// 预载入
|
// 预载入
|
||||||
$resultSet = $result->eagerlyResultSet($resultSet, $options['with'], is_object($resultSet) ? get_class($resultSet) : '');
|
$resultSet = $result->eagerlyResultSet($resultSet, $options['with'], is_object($resultSet) ? get_class($resultSet) : '');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user