Build and execute the SQL DELETE sentence
Return how many rows where altered
@param string $extraWhereClause
@return int|false
4752
final public function delete($extraWhereClause = '')
    {
        if (self::RSMODE_CONNECTED_EDIT !== $this->mode) {
            throw new \LogicException('Recordset: The recordset is not on edit mode [current: ' . $this->mode . ']');
        }
        // check the entity is not empty
        if ('' === $this->entity) {
            throw new \LogicException('Recordset: The recordset does not have a valid unique entity');
        }
        $sql = $this->sqlDelete($extraWhereClause);
        $altered = $this->dbal->execute($sql);
        if (0 === $altered) {
            $this->logger->warning(print_r([
                'message' => "Recordset: The statement '$sql' return zero affected rows"
                    . ' but it should delete at least one record',
                'entity' => $this->entity,
                'extraWhereClause' => $extraWhereClause,
                'original' => $this->originalValues,
            ], true));
        }
        return $altered;
    }
719631
public function count($table = '', $where = '')
    {
        // if table name not pass
        if (!empty($table)) {
            if (empty($where)) {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table`;"; // create count query
            } else {
                $this->sql = "SELECT COUNT(*) AS NUMROWS FROM `$table` WHERE $where;";  // create count query
            }

            // pdo prepare statement
            $this->STH = $this->prepare($this->sql);

            try {
                if ($this->STH->execute()) {
                    // fetch array result
                    $this->results = $this->STH->fetch();
                    // close pdo
                    $this->STH->closeCursor();
                    // return number of count
                    return $this->results['NUMROWS'];
                } else {
                    self::error($this->STH->errorInfo());
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            }
        } else {
            self::error('Table name not found..');
        }
    }
927541
public function deleteWhere(array $wheres)
    {
        $query = $this->getSqlObject()
            ->delete()
            ->where($wheres);

        return $this->execute($query);
    }
217203
public function getStatement()
    {
        $cql = '';

        if (!$this->getFrom() || !$this->getWhere()) {
            throw new \Exception('Delete statement must contain from and where values');
        }

        $cql .= $this->getType().$this->getColumns().' FROM '.$this->getFrom().' WHERE '.$this->getWhere();

        if ($this->isIfExists()) {
            $cql .= ' IF EXISTS';
        }

        return $cql;
    }
429291
protected function DeleteExecute()
    {
        $oOrder = clone $this->oTable;
        $bReturn = parent::DeleteExecute();
        if (!empty($oOrder->sqlData['data_extranet_user_id'])) {
            $oTmpuser = TdbDataExtranetUser::GetNewInstance();
            $oTmpuser->Load($oOrder->sqlData['data_extranet_user_id']);
            if (!is_null($oTmpuser)) {
                TdbDataExtranetGroup::UpdateAutoAssignToUser($oTmpuser);
            }
        }

        return $bReturn;
    }
1276259
public function delete($table, $where)
    {
        $context = $this->getCommandContext();
        $context->table    = $table;
        $context->data    = null;
        $context->where    = $where;
        $context->operation    = AnDatabase::OPERATION_DELETE;

        //Excute the delete operation
        if ($this->getCommandChain()->run('before.delete', $context) !== false) {
            //Create query statement
            $context->query = 'DELETE FROM '.$this->quoteName($this->getTableNeedle().$context->table)
                  .' '.$context->where
            ;

            //Execute the query
            $context->result = $this->execute($context->query);

            $context->affected = $this->_affected_rows;
            $this->getCommandChain()->run('after.delete', $context);
        }

        return $context->affected;
    }
609555
public int deleteAll() throws SQLException {

		int count = 0;

		if (isTableExists()) {
			DeleteBuilder<FeatureTileLink, FeatureTileLinkKey> db = deleteBuilder();
			PreparedDelete<FeatureTileLink> deleteQuery = db.prepare();
			count = delete(deleteQuery);
		}

		return count;
	}
253671
public function countByWhereClause($whereClause = '')
    {
        $completeWhereClause = ($whereClause === '')
            ? ''
            : $whereClause . ' AND ';

        return \Tx_Oelib_Db::count($this->getTableName(), $completeWhereClause . $this->getUniversalWhereClause());
    }
650914
public function GetCount($Table = '', $Where = FALSE) {
      if($Table != '') {
         //$this->MapAliases($Table);
         $this->From($Table);
      }

      if ($Where !== FALSE)
         $this->Where($Where);

      $this->Select('*', 'count', 'RowCount'); // count * slow on innodb
      $Sql = $this->GetSelect();
      $Result = $this->Query($Sql);

      $CountData = $Result->FirstRow();
      return $CountData->RowCount;
   }
1024329
public function count( $where = 'all', $options = array() )
	{

		$dbr = wfGetDB( DB_SLAVE );

		if ( !is_array( $where ) && $where == 'all' ) {

			/* Fetch all entities */
			$collection = $dbr->select( static::$table,
				'id',
				array(),
				__METHOD__,
				$options
			);

		} else {

			/* Fetch conditional entities */
			$collection = $dbr->select( static::$table,
				'id',
				$where,
				__METHOD__,
				$options
			);

		}

		/* Check result */
		if ( !$collection ) return 0;

		$count = $dbr->numRows( $collection );

		return $count;

	}
131276
public function count($beanType,$addSQL = '',$params = array()) {
		$sql = "SELECT count(*) FROM {$this->safeTable($beanType)} ";
		if ($addSQL!='') $addSQL = ' WHERE '.$addSQL; 
		return (int) $this->adapter->getCell($sql.$addSQL,$params);
	}
241075
public function count($table, $condition = false, $group = false, $rows = false)
	{
        Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
		$q = Eresus_DB::getHandler()->createSelectQuery();
		$e = $q->expr;

		$q->select($q->alias($e->count('*'), 'count'));
        $q->from($table);

		if ($condition)
		{
			$q->where($condition);
		}

		if ($group)
		{
			$q->groupBy($group);
		}

		$result = $q->fetchAll();
		if ($rows)
		{
			return count($result);
		}
		else
		{
			return intval($result[0]['count']);
		}
	}
1117110
public function GetCountWhere($Where = FALSE) {
      if (is_array($Where))
         $this->SQL->Where($Where);
         
      return $this->SQL->Select('CommentID', 'count', 'CountComments')
         ->From('Comment')
         ->Get()
         ->FirstRow()
         ->CountComments;
   }
112408
final public function count($table = '', $resetselect = true)
    {

        if (!empty($table)) {
            $this->traceTableAlias($table);
            $this->fromTable($table);
        }
        $sql = $this->compile($this->_countString . $this->identifiers('totalcount'), true);
        $statement = $this->DBO->prepare($sql);

        $results = $statement->execute();

        if ($resetselect) $this->resetSelect();
        if ($results->rowCount() == 0) return '0';

        $row = $results->fetchObject();

        return $row->totalcount;
    }
1031168
public function count_by()
    {
        if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
        {
            $this->_database->where($this->soft_delete_key, (bool)$this->_temporary_only_deleted);
        }

        $where = func_get_args();
        $this->_set_where($where);

        return $this->_database->count_all_results($this->_table);
    }
995149
public function getMultiCount($collection, $column, array $values, array $extra = array())
	{
		$queryParts = ['SELECT COUNT(*) FROM', $collection, 'WHERE', "$column IN (?)"];

		foreach ($extra as $key => $extraValue) {
			$queryParts[] = "AND $key = ?";
		}

		$query = $this->createQueryFrom($queryParts);
		$query->setParameter(1, implode(',', $values));

		foreach ($extra as $key => $extraValue) {
			$query->setParameter($key + 2, $extraValue);
		}

		return $query->count();
	}
1298633
public function increment($column, $amount = 1, array $extra = array())
    {
        $extra = $this->addUpdatedAtColumn($extra);

        return $this->query->increment($column, $amount, $extra);
    }