get global total no of participants from db
@throws Exception
12947
private int getGlobalNoOfParticipants() throws Exception{
        if(sid == null){
            globalNoOfParticipants = calls.size();
        }else{
            CallDetailRecordsDao dao = storage.getCallDetailRecordsDao();
            globalNoOfParticipants = dao.getTotalRunningCallDetailRecordsByConferenceSid(sid);
        }
        if(logger.isDebugEnabled())
            logger.debug("sid: "+sid+"globalNoOfParticipants: "+globalNoOfParticipants);
        return globalNoOfParticipants;
    }
1164260
public int countAll(){
        checkTable();

        Cursor mCount = null;
        try {
            mCount = database.rawQuery("SELECT COUNT(*) FROM \"" + tableName + "\"", null);
            if (mCount.moveToNext()) {
                return mCount.getInt(1);
            }
        } finally {
            if (mCount != null) {
                mCount.close();
            }
        }
        return 0;
    }
643201
@Override
    public long count() throws PersistenceException {
        logger.debug("enter - count()");
        try {
            Transaction xaction = Transaction.getInstance(true);
            Counter counter = getCounter(null);

            try {
                Map<String,Object> results;
                long count;

                results = xaction.execute(counter, new HashMap<String,Object>(0), readDataSource);
                count = ((Number)results.get("count")).longValue();
                xaction.commit();
                return count;
            }
            finally {
                xaction.rollback();
            }
        }
        finally {
            logger.debug("exit - count()");
        }
    }
1076413
@SuppressWarnings({"unused", "WeakerAccess"})
    public int getCount(String event) {
        EventDetail eventDetail = getLocalDataStore().getEventDetail(event);
        if (eventDetail != null) return eventDetail.getCount();

        return -1;
    }
1058255
public int getSigOpCount() throws ScriptException {
        int sigOps = 0;
        for (TransactionInput input : inputs)
            sigOps += Script.getSigOpCount(input.getScriptBytes());
        for (TransactionOutput output : outputs)
            sigOps += Script.getSigOpCount(output.getScriptBytes());
        return sigOps;
    }
521769
private function _getResult()
    {
        $def = $this->actionChain->getCurrentAction();
        $result = $def['result'];
        if (! $result) {
            return null;
        } elseif (is_string($result)) {
            return $result;
        } elseif (is_array($result)) {
            return array_shift($result);
        } else {
            throw new Exception('invalid action result.');
        }
    }
1288147
public function get_total_responses_count() {
        global $DB;
        if ($this->grandtotal === null) {
            $this->grandtotal = $DB->count_records_sql($this->countsql, $this->countparams);
        }
        return $this->grandtotal;
    }
659644
@Override
  public final void sample()
  {
    long totalCount = _totalCount.get();
    long lastTotal = _lastTotal;
    _lastTotal = totalCount;

    _value = totalCount - lastTotal;
  }
1124134
protected int count(UserCustomResultSet resultSet) {
		int count = 0;
		try {
			count = resultSet.getCount();
		} finally {
			resultSet.close();
		}
		return count;
	}
821847
public int getConsumersCount()
    {
    	synchronized (sessions)
		{
    		if (sessions.isEmpty())
    			return 0;
    
    		int total = 0;
    		Iterator<AbstractSession>sessionsIterator = sessions.values().iterator();
			while (sessionsIterator.hasNext())
			{
				AbstractSession session = sessionsIterator.next();
				total += session.getConsumersCount();
			}
			return total;
		}
    }
618330
public int getTotalTriples() throws Exception {
		int total = 0;
		for (HashMap<String, Integer> mappingStat : statistics.values()) {
			for (Integer triplesCount : mappingStat.values()) {
				int triples = triplesCount.intValue();
				if (triples == -1) {
					throw new Exception("An error was occurred in the counting process.");
				}
				total = total + triples;
			}
		}
		return total;
	}
1199238
public static function count($where = null): int
    {
        $select = static::select();

        if ($where !== null) {
            if ($where instanceof Where) {
                $select->field('COUNT(*)', 'total');
                $select->where(clone $where);

            } else if (is_array($where)) {
                $select->field('COUNT(*)', 'total');
                foreach ($where as $field => $value) {
                    $select->where($field, $value);
                }

            } else if (!is_array(static::$primaryKey) && (is_numeric($where) || is_string($where))) {
                $select->field('COUNT(' . static::$primaryKey . ')', 'total');
                $select->where(static::$primaryKey, $where);

            }
        } else {
            $pk = is_string(static::$primaryKey) ? static::$primaryKey : '*';
            $select->field('COUNT(' . $pk . ')', 'total');
        }

        $results = $select->fetchAll();

        if (isset($results[0])) {
            $r = $results[0];
            if (array_key_exists('total', $r)) {
                return (int)$r['total'];
            } else {
                return 0;
            }
        } else {
            return 0;
        }
    }
939193
public function count() {
        $sql    = $this->getSQL();
        $values = $this->values;
        if ($sql) {
            try {
                $statement = $this->dialect->prepare($sql);
                foreach ($values as $value) {
                    list ($name, $val, $type) = $value;
                    if (!$statement->bindValue($name, $val, $type)) {
                        $this->errorSQL    = $sql;
                        $this->errorValues = $values->__toString();
                        $this->error       = 'can not bind the value ' . $val . '[' . $type . '] to the argument:' . $name;

                        return false;
                    }
                }
                $rst = $statement->execute();
                $cnt = false;
                if ($rst) {
                    $cnt = $statement->rowCount();
                } else {
                    $this->dumpSQL($statement);
                }
                if ($statement) {
                    $statement->closeCursor();
                    $statement = null;
                }
                QueryBuilder::addSqlCount();

                return $cnt;
            } catch (\PDOException $e) {
                $this->exception   = $e;
                $this->error       = $e->getMessage();
                $this->errorSQL    = $sql;
                $this->errorValues = $values->__toString();

                return false;
            }
        } else {
            $this->error       = 'Can not generate the delete SQL';
            $this->errorSQL    = '';
            $this->errorValues = $values->__toString();
        }

        return false;
    }
879414
public static function countAll () : int
	{
        $dbObject  	= Database::getInstance();
		$sqlQuery 	= "SELECT COUNT(*) FROM ".static::$tableName;
		$resultSet 	= $dbObject->query($sqlQuery);
		$row 		= Database::fetchAssoc($resultSet);
		return (int) array_shift($row);
	}
303190
function getTotal() {
		if ($this->total === null) {
			$q = clone $this->query;
			$q->setLimit(null);
			$q->setOffset(null);
			if ($this->className) {
				$total = call_user_func(array($this->className, 'doCount'), $q);
			} else {
				$total = $q->doCount();
			}
			$this->total = $total;
		}
		return $this->total;
	}
340802
protected static int getTotalAttempts(ClientRequestContext ctx) {
        final State state = ctx.attr(STATE).get();
        if (state == null) {
            return 0;
        }
        return state.totalAttemptNo;
    }
1073787
public function count_entries() {
        global $DB;
        if ($this->totalentries === null) {
            if ($sqlarray = $this->get_entry_fetch_sql(true)) {
                $this->totalentries = $DB->count_records_sql($sqlarray['sql'], $sqlarray['params']);
            } else {
                $this->totalentries = 0;
            }
        }
        return $this->totalentries;
    }