public function delete($table, $params) { $cond = array(); foreach ($params as $field => $value) { if (is_int($field)) { $cond[] = $value; } else { $cond[] = "`{$field}` = '{$value}'"; } } $cond = implode(' AND ', $cond); $query = $this->__renderQuery('delete', array('conditions' => $cond, 'table' => $table)); $start = getMicroTime(); mysql_query($query); $took = getMicroTime() - $start; if (Config::read('debug_mode') == 1) { AtmDebug::addRow('DB Queries', array($query, $took)); } }
/** * @param string $content data for parse and view * @access protected */ protected function _view($content) { $Register = Register::getInstance(); if (!empty($this->template) && $this->wrap == true) { Plugins::intercept('before_parse_layout', $this); $this->View->setLayout($this->template); $markers = $this->getGlobalMarkers(file_get_contents($this->View->getTemplateFilePath('main.html'))); $markers['content'] = $content; // Cache global markers if ($this->cached) { if ($this->Cache->check($this->cacheKey . '_global_markers')) { $gdata = $this->Cache->read($this->cacheKey . '_global_markers'); $this->globalMarkers = array_merge($this->globalMarkers, unserialize($gdata)); } else { $gdata = serialize($this->globalMarkers); $this->Cache->write($gdata, $this->cacheKey . '_global_markers', $this->cacheTags); } } $boot_time = round(getMicroTime() - $Register['fps_boot_start_time'], 4); $markers = array_merge($markers, array('boot_time' => $boot_time)); $output = $this->render('main.html', $markers); } else { $output = $content; } $this->_afterRender(); echo $output; if (Config::read('debug_mode') == 1) { echo AtmDebug::getBody(); } die; }
public function delete($table, $params) { $this->queryParams = array(); $cond = array(); $data = array(); foreach ($params as $field => $value) { if (is_int($field)) { $cond[] = $value; } else { $cond[] = "`{$field}` = :{$field}"; $data[":{$field}"] = $value; } } $cond = implode(' AND ', $cond); $this->queryParams = $data; $query = $this->__renderQuery('delete', array('conditions' => $cond, 'table' => $table)); $start = getMicroTime(); $this->runQuery($query); $took = getMicroTime($start); if (Config::read('debug_mode') == 1) { AtmDebug::addRow('DB Queries', array($this->getQueryDump($query), $took)); } }