伊图教程网[www.etoow.com]
http://www.etoow.com/html/2008-08/1218328962.html
class DBQuery
{
.....
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);
}
PHP5 OOP编程中的代理与异常
'http://www.etoow.com/html/2008-08/1218328962.html