public function execute($bindValues = array(), $additionalParameters = array()) { $query = $this->getQuery(); if (empty($bindValues)) { if (empty($this->bindValues)) { $bindValues = array(); } else { $bindValues = $this->escape($this->bindValues); foreach ($bindValues as $k => $v) { $bindValues["@{$k}@"] = $v; unset($bindValues[$k]); } } } if (!empty($this->binaries)) { for ($i = 0, $c = count($this->binaries); $i < $c; $i++) { $query = str_replace(self::BINARY_IDENTIFIER . ($i + 1), $this->binaries[$i]->getData(), $query); } } $start = microtime(true); $result = $this->driver->execute($query, $bindValues, $additionalParameters); self::$queries[] = array("sql" => $query, "time" => microtime(true) - $start, "binds" => $bindValues); if ($this->isInsert()) { return $this->seqColumn === null ? null : $this->driver->getLastInsertId(); } elseif ($this->isUpdate() || $this->isDelete()) { return $this->driver->getAffectedRows(); } else { return $result; } }
public function execute($bindValues = array(), $additionalParameters = array(), $query = null) { if ($query === null) { $query = $this->getQuery(); } if (empty($bindValues)) { $bindValues = empty($this->bindValues) ? array() : $this->escape($this->bindValues); } $start = microtime(true); $result = $this->driver->execute($query, $bindValues, $additionalParameters); self::$queries[] = array("sql" => $query, "time" => microtime(true) - $start, "binds" => $bindValues); if ($this->isInsert()) { return $this->seqColumn === null ? null : $this->driver->getLastInsertId(); } elseif ($this->isUpdate() || $this->isDelete()) { return $this->driver->getAffectedRows(); } else { return $result; } }