Files
mrbs-equbao-2026/lib/MRBS/DB/DBStatement.php
T
人事系统开发 1ba6efd8ed MRBS 1.12.2 等保2.0二级整改完整提交
包含:登录失败锁定、90天密码有效期、30分钟会话超时、
强制改密、登录审计日志、屏幕水印、企业背景图、
备案信息固定底部、favicon、JS空集合保护、
会话过期体验优化(403 JSON)、display_errors 关闭、
固定 key 根治 Integrity check failed 等全部改动

注意:config.inc.php/.htaccess/.user.ini 含敏感信息,
通过 .gitignore 排除,勿推送到公开仓库。
2026-09-09 16:55:02 +08:00

79 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace MRBS\DB;
use PDO;
use PDOStatement;
class DBStatement
{
protected $db_object = null;
protected $statement = null;
public function __construct(DB $db_obj, PDOStatement $sth)
{
$this->db_object = $db_obj;
$this->statement = $sth;
}
/**
* Fetch the next row from a result set
*
* @return mixed[]|false An array indexed by column number as returned in the result set, starting at column 0,
* or FALSE if there are no more rows.
*/
public function next_row()
{
return $this->statement->fetch(PDO::FETCH_NUM);
}
/**
* Returns the next row from a statement as an associative array.
*
* @return array<string,mixed>|false The next row indexed by column name, or FALSE if there are no more rows.
*/
public function next_row_keyed()
{
return $this->statement->fetch(PDO::FETCH_ASSOC);
}
/**
* Return all the rows from a statement object, as an array of arrays keyed on the column name.
*/
public function all_rows_keyed() : array
{
$result = array();
while (false !== ($row = $this->next_row_keyed()))
{
$result[] = $row;
}
return $result;
}
/**
* Returns the number of rows affected by the last SQL statement.
*
* For DELETE, INSERT, or UPDATE statements the number of rows affected is returned, though note that this depends
* on the setting of Pdo\Mysql::ATTR_FOUND_ROWS for MySQL.
*
* For statements that produce result sets, such as SELECT, the behaviour is undefined and can be different for each driver.
*/
public function count() : int
{
return $this->statement->rowCount();
}
// Returns the number of fields in a statement.
public function num_fields() : int
{
return $this->statement->columnCount();
}
}