public function query($str, $bind = array())
{
$this->initConnect(false);
if (!$this->_linkID) {
return false;
}
$this->queryStr = $str;
if (!empty($bind)) {
$this->queryStr .= '[ ' . print_r($bind, true) . ' ]';
}
//释放前次的查询结果
if (!empty($this->PDOStatement)) {
$this->free();
}
//N('db_query',1);
// 记录开始执行时间
//G('queryStartTime');
$this->PDOStatement = $this->_linkID->prepare($str);
if (false === $this->PDOStatement) {
throw new Exception($this->error());
}
// E($this->error());
// 参数绑定
$this->bindPdoParam($bind);
$result = $this->PDOStatement->execute();
$this->debug();
if (false === $result) {
$this->error();
return false;
} else {
return $this->getAll();
}
}