Returns the number of comments associated with the details of this object

@global moodle_database $DB
@return int
971794
public function count() {
        global $DB;
        if ($this->totalcommentcount === null) {
            list($where, $component) = $this->get_component_select_sql();
            $where .= ' AND itemid = :itemid AND commentarea = :commentarea AND contextid = :contextid';
            $params = array(
                'itemid' => $this->itemid,
                'commentarea' => $this->commentarea,
                'contextid' => $this->context->id,
            );
            if ($component) {
                $params['component'] = $component;
            }

            $this->totalcommentcount = $DB->count_records_select('comments', $where, $params);
        }
        return $this->totalcommentcount;
    }
427286
public function getCount()
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $sNewsViewName = getViewName('oxnews');
        $oBaseObject = $this->getBaseObject();
        //$sSelectFields = $oBaseObject->getSelectFields();

        if ($oUser = $this->getUser()) {
            // performance - only join if user is logged in
            $sSelect = "select COUNT($sNewsViewName.`oxid`) from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
            $sSelect .= "oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='" . $oUser->getId() . "' ) or ";
            $sSelect .= "( oxobject2group.oxgroupsid is null ) ";
        } else {
            $sSelect = "select COUNT($sNewsViewName.`oxid`) from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
        }

        $sSelect .= " and " . $oBaseObject->getSqlActiveSnippet();

        // loading only if there is some data
        $iRecCnt = (int) $oDb->getOne($sSelect);

        return $iRecCnt;
    }
1126438
public function count(): ?int
    {
        // no where, count all simply
        $where = $this->query['where'] ?? null;
        if ($where == null) {
            return $this->agent->count($this->table);
        }

        $from = '';
        if ($this->query) {
            $isSub = $this->isSub;
            $this->isSub = true;
            $from = $this->toString();
            $this->isSub = $isSub; // restore
        }

        if ($from == '') {
            $from = "SELECT 1 FROM {$this->table} ". trim($this->toQueryString('where', false));
        }
        $from = trim($from);

        $query = "SELECT count(*) AS count FROM (\n\t{$from}\n) AS tmp";
        $result = $this->agent->get($query, null, 'object');

        return isset($result->count) ? intval($result->count) : null;
    }
620283
public function GetCount($DiscussionID) {
      $this->FireEvent('BeforeGetCount');
      
      if (!empty($this->_Where)) {
         return FALSE;
      }
      
      return $this->SQL->Select('CommentID', 'count', 'CountComments')
         ->From('Comment')
         ->Where('DiscussionID', $DiscussionID)
         ->Get()
         ->FirstRow()
         ->CountComments;
   }
89127
public function num_rows()
	{
		return is_int($this->num_rows)
			? $this->num_rows
			: $this->num_rows = @sqlite_num_rows($this->result_id);
	}
135794
public function rowCount()
    {
        if (!$this->_stmt) {
            return false;
        }

        $num_rows = oci_num_rows($this->_stmt);

        if ($num_rows === false) {
            /**
             * @see Zend_Db_Adapter_Oracle_Exception
             */
            // require_once 'Zend/Db/Statement/Oracle/Exception.php';
            throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
        }

        return $num_rows;
    }
1121493
function objectCount()
    {
        $db = eZDB::instance();

        $languageID = $this->ID;
        if ( $db->databaseName() == 'oracle' )
        {
            $whereSQL = "bitand( language_mask, $languageID ) > 0";
        }
        else
        {
            $whereSQL = "language_mask & $languageID > 0";
        }

        $count = $db->arrayQuery( "SELECT COUNT(*) AS count FROM ezcontentobject WHERE $whereSQL" );
        return $count[0]['count'];
    }
1168175
public function num_rows()
	{
		if (is_int($this->num_rows))
		{
			return $this->num_rows;
		}
		elseif (count($this->result_array) > 0)
		{
			return $this->num_rows = count($this->result_array);
		}
		elseif (count($this->result_object) > 0)
		{
			return $this->num_rows = count($this->result_object);
		}
		elseif (($num_rows = $this->result_id->rowCount()) > 0)
		{
			return $this->num_rows = $num_rows;
		}

		return $this->num_rows = count($this->result_array());
	}
602672
public function GetNumberOfHits()
    {
        if ($this->fieldNumberOfRecordsFound < 0) {
            $query = "SELECT COUNT(*) AS recs FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
            if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
                $this->fieldNumberOfRecordsFound = $row['recs'];
                $this->sqlData['number_of_records_found'] = $this->fieldNumberOfRecordsFound;
                $this->AllowEditByAll(true);
                $this->Save();
            }
        }

        return $this->fieldNumberOfRecordsFound;
    }
904504
public function rowCount(): int
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        return $this->getAdapter()->getStatement()->rowCount();
    }
805348
public function getRowCount()
    {
        $this->parseDefer();
        if(!$this->isSuccess)
        {
            throw new \RuntimeException('Result is not success!');
        }
        return count($this->statement->fetchAll());
    }
431959
public function fetched_count()
    {
        if ($this->statement) {
            return $this->statement->num_rows;
        }
        
        if (!$this->mysqli_result) {
            $this->last_error_id = "db_result_error";
            return false;
        }
        
        // by update, insert, delete it is not an object
        // by select it is an object
        // crazy!
        
        if (!is_object($this->mysqli_result)) {
            return false;
        }
        
        return $this->mysqli_result->num_rows;
    }
1246786
public function id(): int
    {
        return app('cache.array')->rememberForever(__CLASS__ . __METHOD__ . $this->location_name, function () {
            // The "top-level" location won't exist in the database.
            if ($this->parts->isEmpty()) {
                return 0;
            }

            $parent_location_id = $this->parent()->id();

            $location_id = (int) DB::table('placelocation')
                ->where('pl_place', '=', $this->parts->first())
                ->where('pl_parent_id', '=', $parent_location_id)
                ->value('pl_id');

            if ($location_id === 0) {
                $location = $this->parts->first();

                $location_id = 1 + (int) DB::table('placelocation')->max('pl_id');

                DB::table('placelocation')->insert([
                    'pl_id'        => $location_id,
                    'pl_place'     => $location,
                    'pl_parent_id' => $parent_location_id,
                    'pl_level'     => $this->parts->count() - 1,
                    'pl_lati'      => '',
                    'pl_long'      => '',
                    'pl_icon'      => '',
                    'pl_zoom'      => 2,
                ]);
            }

            return $location_id;
        });
    }
1025766
protected function getTotalCount()
    {
        $query = $this->modelRepository->query();

        $this->applyListParentToQuery($query);

        return $query->count();
    }
440690
public function count() {
		if(!$this->initialized)
			$this->initialize();

		return count($this->elements) - count($this->toRemove) + count($this->toAdd);
	}
379895
public function GetCommentCounts() {
      $this->AllowJSONP(TRUE);
      
		$vanilla_identifier = GetValue('vanilla_identifier', $_GET);
		if (!is_array($vanilla_identifier))
			$vanilla_identifier = array($vanilla_identifier);
         
      $vanilla_identifier = array_unique($vanilla_identifier);
      
      $FinalData = array_fill_keys($vanilla_identifier, 0);
      $Misses = array();
      $CacheKey = 'embed.comments.count.%s';
      $OriginalIDs = array();
      foreach ($vanilla_identifier as $ForeignID) {
         $HashedForeignID = ForeignIDHash($ForeignID);
         
         // Keep record of non-hashed identifiers for the reply
         $OriginalIDs[$HashedForeignID] = $ForeignID;
         
         $RealCacheKey = sprintf($CacheKey, $HashedForeignID);
         $Comments = Gdn::Cache()->Get($RealCacheKey);
         if ($Comments !== Gdn_Cache::CACHEOP_FAILURE)
            $FinalData[$ForeignID] = $Comments;
         else
            $Misses[] = $HashedForeignID;
      }
      
      if (sizeof($Misses)) {
         $CountData = Gdn::SQL()
            ->Select('ForeignID, CountComments')
            ->From('Discussion')
            ->Where('Type', 'page')
            ->WhereIn('ForeignID', $Misses)
            ->Get()->ResultArray();
         
         foreach ($CountData as $Row) {
            // Get original identifier to send back
            $ForeignID = $OriginalIDs[$Row['ForeignID']];
            $FinalData[$ForeignID] = $Row['CountComments'];
            
            // Cache using the hashed identifier
            $RealCacheKey = sprintf($CacheKey, $Row['ForeignID']);
            Gdn::Cache()->Store($RealCacheKey, $Row['CountComments'], array(
               Gdn_Cache::FEATURE_EXPIRY     => 60
            ));
         }         
      }
      
		$this->SetData('CountData', $FinalData);
		$this->DeliveryMethod = DELIVERY_METHOD_JSON;
		$this->DeliveryType = DELIVERY_TYPE_DATA;
		$this->Render();
	}
792912
public function findCount()
    {
        $this->compile();
        $queryArr   = $this->queryArr;
        $queryArr['field'] = 'count(*)';
        unset($queryArr['limit']);
        return $this->connection->fetchColumn(implode(" ", $queryArr), $this->arguments);
    }