public function fetch_array()
{ if (! is_resource($this->result)) { throw new
Exception('Query not executed.'); } return
$this->db->fetch_array($this->result); }
public function
fetch_row() { if (! is_resource($this->result)) { throw
new Exception('Query not executed.'); } return
$this->db->fetch_row($this->result); }
public function
fetch_assoc() { if (! is_resource($this->result)) {
throw new Exception('Query not executed.'); } return
$this->db->fetch_assoc($this->result); }
public function
fetch_object() { if (! is_resource($this->result)) {
throw new Exception('Query not executed.'); } return
$this->db->fetch_object($this->result); }
public function
num_rows() { if (! is_resource($this->result)) { throw
new Exception('Query not executed.'); } return
$this->db->num_rows($this->result); } }
每个函数的实现相当简单。它首先进行检查,以确保已经执行查询,然后把任务代理到DB对象,返回它的结果就好象它是查询对象本身(称作是基本数据库函数)一样。