public function execute($input_parameters = null) { if (!kQueryCache::isCurrentQueryHandled()) { kApiCache::disableConditionalCache(); } $search = array(); $replace = array(); if (is_null($input_parameters)) { $search = array_reverse(array_keys($this->values)); $replace = array_reverse($this->values); } else { $i = 1; foreach ($input_parameters as $value) { $search[] = ':p' . $i++; if (is_null($value)) { $replace[] = "NULL"; } else { $replace[] = "'{$value}'"; } } $search = array_reverse($search); $replace = array_reverse($replace); } $sql = str_replace($search, $replace, $this->queryString); KalturaLog::debug($sql); $sqlStart = microtime(true); if (self::$dryRun && !preg_match('/^(\\/\\*.+\\*\\/ )?SELECT/i', $sql)) { KalturaLog::debug("Sql dry run - " . (microtime(true) - $sqlStart) . " seconds"); } else { try { parent::execute($input_parameters); } catch (PropelException $pex) { KalturaLog::alert($pex->getMessage()); throw new PropelException("Database error"); } $sqlTook = microtime(true) - $sqlStart; KalturaLog::debug("Sql took - " . $sqlTook . " seconds"); KalturaMonitorClient::monitorDatabaseAccess($sql, $sqlTook); } }
public function query() { kApiCache::disableConditionalCache(); $args = func_get_args(); $sql = $args[0]; KalturaLog::debug($sql); $comment = $this->getCommentWrapped(); $sql = $comment . $sql; $sqlStart = microtime(true); try { if (version_compare(PHP_VERSION, '5.3', '<')) { $result = call_user_func_array(array($this, 'parent::query'), $args); } else { $result = call_user_func_array('parent::query', $args); } } catch (PropelException $pex) { KalturaLog::alert($pex->getMessage()); throw new PropelException("Database error"); } $sqlTook = microtime(true) - $sqlStart; KalturaLog::debug("Sql took - " . $sqlTook . " seconds"); KalturaMonitorClient::monitorDatabaseAccess($sql, $sqlTook, $this->hostName); return $result; }