public function execute($str, $bind = array())
{
$this->initConnect(true);
if (!$this->_linkID) {
return false;
}
$this->queryStr = $str;
if (!empty($bind)) {
$this->queryStr .= '[ ' . print_r($bind, true) . ' ]';
}
$flag = false;
if ($this->dbType == 'OCI') {
if (preg_match("/^\\s*(INSERT\\s+INTO)\\s+(\\w+)\\s+/i", $this->queryStr, $match)) {
$this->table = $match[2];
$flag = (bool) $this->query("SELECT * FROM user_sequences WHERE sequence_name='" . strtoupper($this->table) . "'");
}
}
//释放前次的查询结果
if (!empty($this->PDOStatement)) {
$this->free();
}
//N('db_write',1);
// 记录开始执行时间
// G('queryStartTime');
$this->PDOStatement = $this->_linkID->prepare($str);
if (false === $this->PDOStatement) {
//E($this->error());
throw new Exception($this->error());
}
// 参数绑定
$this->bindPdoParam($bind);
$result = $this->PDOStatement->execute();
$this->debug();
if (false === $result) {
$this->error();
return false;
} else {
$this->numRows = $this->PDOStatement->rowCount();
if ($flag || preg_match("/^\\s*(INSERT\\s+INTO|REPLACE\\s+INTO)\\s+/i", $str)) {
$this->lastInsID = $this->getLastInsertId();
}
return $this->numRows;
}
}