Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * @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);
 }