Delete

@param string $table
@param array $values
@param string|array $conditions
@param array $params
@return int Rows affected, false on error
977701
public function delete($table, $conditions, $params = array())
    {
        $sql = 'DELETE FROM ' . $this->db->quoteTable($table);
        $conditions = $this->buildConditions($conditions);
        if ('' === $conditions) {
            throw new Exception('Delete condition must not be empty');
        }

        $sql .= ' WHERE ' . $conditions;

        return $this->setSql($sql)->execute($params);
    }
42176
protected function doDelete(array $conditions)
    {
        !$this->useTransaction ?: $this->db->getTransaction(true)->start();

        try {
            $result = $this->db->getWriter()->delete($this->table, $conditions);
        } catch (\Throwable $e) {
            !$this->useTransaction ?: $this->db->getTransaction(true)->rollback();

            throw $e;
        }

        !$this->useTransaction ?: $this->db->getTransaction(true)->commit();

        return $result;
    }
716928
public function delete(\FreeFW\Core\StorageModel &$p_model, array $p_conditions = [])
    {
        $source     = $p_model::getSource();
        $properties = $p_model::getProperties();
        $values     = [];
        $ok         = false;
        /**
         * @var \FreeFW\Model\Condition $oneCondition
         */
        $where = '';
        foreach ($p_conditions as $idx => $oneCondition) {
            $part = $this->renderCondition($oneCondition);
            if ($where != '') {
                $where = $where . ' AND ';
            }
            $where  = $where . $part['sql'];
            $values = array_merge($values, $part['values']);
        }
        // Build query
        $sql = 'DELETE FROM ' . $source . ' WHERE ' . $where;
        $this->logger->debug('PDOStorage.delete : ' . $sql);
        // I got all, run query...
        try {
            // Get PDO and execute
            $query = $this->provider->prepare($sql, array(\PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY));
            if ($query->execute($values)) {
                $ok = true;
            } else {
                $this->logger->debug('PDOStorage.delete.error : ' . print_r($query->errorInfo(), true));
                $localErr = $query->errorInfo();
                $code     = 0;
                $message  = 'PDOStorage.delete.error : ' . print_r($query->errorInfo(), true);
                if (is_array($localErr) && count($localErr) > 1) {
                    $code    = intval($localErr[0]);
                    $message = $localErr[2];
                }
                $p_model->addError($code, $message);
            }
        } catch (\Exception $ex) {
            var_dump($ex);
        }
        return $ok;
    }
1103427
public function delete($conditions = false)
    {
        $this->andWhere($conditions);
        $this->type = self::DELETE;
        return $this->execute();
    }
20248
public function delete($tables = null)
    {
        if (null !== $tables) {
            $this->tables($tables);
        }
        $this->action = 'delete';
        return $this;
    }
300894
public static function delete($table, $condition = null)
    {
        $query = array("DELETE FROM $table ");
        array_push($query, (isset($condition))?" WHERE $condition":'');
        return implode($query);
    }
486330
public static function deleteAll($condition, $params = array())
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition')) {
            $condition = ModelCondition::getFrom($condition, get_called_class());
        }
        /* @var $condition ModelCondition */
        $condition->setParams($params);
        return static::getDb()->execQuery($condition->forDelete(), $condition->getParams());
    }
1150814
public function update($table, $columns, $condition = [], array $params = [])
    {
        $request = $this->db->getQueryBuilder()->update($table, $columns, $condition, $params);

        return $this->setRequest($request);
    }
964880
public function delete(array $tables=[]) {
		$sql = $this->buildDeleteSQL($tables);
		$params = $this->getParameters();
		return $this->db->query($sql, $params)->affected();
	}
1139385
public function deleteBy($conditions = [])
    {
        if (count($conditions)) {
            if (method_exists($this, 'beforeDelete')) {
                $this->beforeDelete();
            }

            if (method_exists($this, 'beforeDelete')) {
                $this->beforeDelete();
            }

            if ($this->qb->table($this->table)->limit(1)->delete($conditions)) {
                if (method_exists($this, 'afterDelete')) {
                    return $this->afterDelete();
                }

                return $this->db->getAffectedRows();
            }
        }

        return false;
    }
36293
public function delete(string $from, $wheres, array $options = [])
    {
        if (!$wheres) {
            throw new \InvalidArgumentException('Safety considerations, where conditions can not be empty');
        }

        list($where, $bindings) = DBHelper::handleConditions($wheres, $this);

        $options['from'] = $this->qn($from);
        $options['where'] = $where;

        $statement = $this->compileDelete($options);

        if (isset($options['returnSql'])) {
            return [$statement, $bindings];
        }

        return $this->fetchAffected($statement, $bindings);
    }
767368
public function deleteFrom(string $table, array $where): int
    {
        $delete = new Delete($this->options);
        $sqlParams = $delete->buildQuery($table, $where);
        return $this->query($sqlParams->getSql(), $sqlParams->getParams())->getAffected();
    }
438351
public function update($table, array $values){
        $res= FALSE;
        try{
            $query= $this->prepareUpdate($table, $values, $this->where);
            //Uno los values pasados y los del where
            $values= array_merge($values, $this->where_values);
            //Ejecuto la consulta
            $query->execute($values);
            //Veo si salio todo bien
            $res= $this->isOk($query);
            //Limpio las variables del AR
            $this->cleanVars();
        } catch (\PDOException $e) {
            $this->cleanVars();
            throw $e;
        }
        return $res;
    }
714526
protected function CreateDelete(Table $table, Condition $condition = null, OrderList $orderList = null, $offset = 0, $count = 0)
    {
        return new Delete($this->connection, $table, $condition, $orderList, $offset, $count);
    }
1138828
function delete(string $tableName, $wheres = null)
  {
    if ($wheres === null)
    {
      $this->q("truncate $tableName");
    }
    else if (is_int($wheres) || (is_string($wheres) && ctype_digit($wheres)))
    {
      // 'wheres' is an ID value
      $this->q("delete from $tableName where id=$wheres");
    }
    else
    {
      assert(is_array($wheres));
      $wClause = implode(" and ", $this->makeClauses($wheres));
      $this->q("delete from $tableName where $wClause");
    }

    return $this->affected_rows;
  }
1178724
public function delete($where, $table = null)
    {
        $table = ($table) ?: $this->getTable();
        $sql = $this->getSql();
        $delete = $sql->delete($table);

        $delete->where($where);

        $statement = $sql->prepareStatementForSqlObject($delete);
        $result = $statement->execute();

        return $result->getAffectedRows();
    }
1330558
function delete($condition = '', $params = []) {
        $sql = "DELETE FROM `$this->table`";

        if($this->where) {
            $sql .= ' '.$this->where;
        }

        if ($condition) {
            if(is_array($condition)) {
                $sql .= $this->w . $this->parseWhere($condition[0]);
            }
            elseif ($params) {
                //using prepared statement.
                if (!is_array($params)) {
                    $params = [$params];
                }
                $sql .= $this->w . $condition;
                $this->params = array_merge($this->params, $params);
            }
            else {
                $sql .= $this->w . $condition;
            }
        }

        $sql = str_replace('table.',$this->table.'.',$sql);
        $params = $this->params;

        $this->_reset();

        return $this->execute($sql, $params,false);
    }