for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace suda\database\statement;
use suda\database\middleware\NullMiddleware;
class QueryStatement extends Statement
{
use PrepareTrait;
protected $withKey = null;
/**
* 创建写
*
* @param string $query
* @param array $args
*/
public function __construct(string $query, ...$args)
parent::__construct($query, ...$args);
$this->type = self::READ;
$this->fetch = self::FETCH_ONE;
$this->middleware = new NullMiddleware;
}
* 设置取一条记录
* @param string|null $class
* @return $this
public function wantOne(?string $class = null, array $args = [])
if ($class !== null) {
$this->setFetchType($class, $args);
return $this;
* 设置取全部记录
public function wantAll(?string $class = null, array $args = [])
$this->fetch = self::FETCH_ALL;
* 设置取值类
public function wantType(?string $class = null, array $args = [])
* 设置使用某个字段做Key
* @param string $key
public function withKey(string $key)
$this->withKey = $key;
$this->wantAll();
* Get the value of withKey
public function getWithKey()
return $this->withKey;
* 滚动获取
public function scroll()
$this->scroll = true;