original_string: public function count($column = null, $distinct = true)
  	{
  		$select = $column ?: \Arr::get(call_user_func($this->model.'::primary_key'), 0);
  		$select = (strpos($select, '.') === false ? $this->alias.'.'.$select : $select);
  
  		// Get the columns
  		$columns = \DB::expr('COUNT('.($distinct ? 'DISTINCT ' : '').
  			\Database_Connection::instance($this->connection)->quote_identifier($select).
  			') AS count_result');
  
  		// Remove the current select and
  		$query = \DB::select($columns);
  
  		// Set from view or table
  		$query->from(array($this->_table(), $this->alias));
  
  		$tmp   = $this->build_query($query, $columns, 'select');
  		$query = $tmp['query'];
  		$count = $query->execute($this->connection)->get('count_result');
  
  		// Database_Result::get('count_result') returns a string | null
  		if ($count === null)
  		{
  			return false;
  		}
  
  		return (int) $count;
  	}
code: public function count($column = null, $distinct = true)
  	{
  		$select = $column ?: \Arr::get(call_user_func($this->model.'::primary_key'), 0);
  		$select = (strpos($select, '.') === false ? $this->alias.'.'.$select : $select);
  
  		// Get the columns
  		$columns = \DB::expr('COUNT('.($distinct ? 'DISTINCT ' : '').
  			\Database_Connection::instance($this->connection)->quote_identifier($select).
  			') AS count_result');
  
  		// Remove the current select and
  		$query = \DB::select($columns);
  
  		// Set from view or table
  		$query->from(array($this->_table(), $this->alias));
  
  		$tmp   = $this->build_query($query, $columns, 'select');
  		$query = $tmp['query'];
  		$count = $query->execute($this->connection)->get('count_result');
  
  		// Database_Result::get('count_result') returns a string | null
  		if ($count === null)
  		{
  			return false;
  		}
  
  		return (int) $count;
  	}
code_tokens: public function count ( $ column = null , $ distinct = true ) { $ select = $ column ? : \ Arr :: get ( call_user_func ( $ this -> model . '::primary_key' ) , 0 ) ; $ select = ( strpos ( $ select , '.' ) === false ? $ this -> alias . '.' . $ select : $ select ) ; // Get the columns $ columns = \ DB :: expr ( 'COUNT(' . ( $ distinct ? 'DISTINCT ' : '' ) . \ Database_Connection :: instance ( $ this -> connection ) -> quote_identifier ( $ select ) . ') AS count_result' ) ; // Remove the current select and $ query = \ DB :: select ( $ columns ) ; // Set from view or table $ query -> from ( array ( $ this -> _table ( ) , $ this -> alias ) ) ; $ tmp = $ this -> build_query ( $ query , $ columns , 'select' ) ; $ query = $ tmp [ 'query' ] ; $ count = $ query -> execute ( $ this -> connection ) -> get ( 'count_result' ) ; // Database_Result::get('count_result') returns a string | null if ( $ count === null ) { return false ; } return ( int ) $ count ; }
docstring: Count the result of a query
  
  @param   bool  $column   False for random selected column or specific column, only works for main model currently
  @param   bool  $distinct True if DISTINCT has to be aded to the query
  
  @return  mixed   number of rows OR false
docstring_tokens: Count the result of a query