/** * @return string */ public function getSqlDelete() { $sql = 'delete from `' . $this->scheme->getTableName() . '`'; $sql_where = $this->implodeFilters(); if (null !== $sql_where) { $sql .= ' where ' . $sql_where; } if (!count($this->order_by) && $this->scheme->getField('date_public')) { $this->order_by['date_public'] = array('date_public', 'asc'); } $sql .= ' limit ' . $this->limit_limit; return $sql; }
/** * @param string $field_name * @param int $value */ public function counterReset($field_name, $value = 0) { $sql = 'update ' . $this->factory->getTableName() . ' set `' . $field_name . '`=' . intval($value) . ' where `' . ORM_Record::FIELD_ID . '`=' . intval($this->Id) . ' limit 1'; $this->{$field_name} = $value; $this->factory->db->execute($sql); }