src/DB/StatementBuilder.php
public function buildCountStatement()
	{
		if( !$this->keys )
			throw new RuntimeException( 'No Columns defined.' );
		if( !$this->tables )
			throw new RuntimeException( 'No Tables defined.' );

		$tables		= array();
		$tables		= "\nFROM\n\t".implode( ",\n\t", $this->tables );
		$conditions	= "";
		$groupings	= "";
		$havings	= "";
		if( $this->conditions )
			$conditions	= "\nWHERE\n\t".implode( " AND\n\t", $this->conditions );
		if( $this->groupings )
			$groupings	= "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings );
		if( $this->havings )
			$havings	= "\nHAVING\n\t".implode( ",\n\t", $this->havings );
		$column	= preg_replace( '/(.+)( AS .+)/i', '\\1', $this->keys[0] );
		$statement = "SELECT COUNT(".$column.") as rowcount".$tables.$conditions.$groupings.$havings;
		return $statement;
	}
public function buildCountStatement()
	{
		if( !$this->keys )
			throw new RuntimeException( 'No Columns defined.' );
		if( !$this->tables )
			throw new RuntimeException( 'No Tables defined.' );

		$tables		= array();
		$tables		= "\nFROM\n\t".implode( ",\n\t", $this->tables );
		$conditions	= "";
		$groupings	= "";
		$havings	= "";
		if( $this->conditions )
			$conditions	= "\nWHERE\n\t".implode( " AND\n\t", $this->conditions );
		if( $this->groupings )
			$groupings	= "\nGROUP BY\n\t".implode( ",\n\t", $this->groupings );
		if( $this->havings )
			$havings	= "\nHAVING\n\t".implode( ",\n\t", $this->havings );
		$column	= preg_replace( '/(.+)( AS .+)/i', '\\1', $this->keys[0] );
		$statement = "SELECT COUNT(".$column.") as rowcount".$tables.$conditions.$groupings.$havings;
		return $statement;
	}
public function buildCountStatement ( ) { if ( ! $ this -> keys ) throw new RuntimeException ( 'No Columns defined.' ) ; if ( ! $ this -> tables ) throw new RuntimeException ( 'No Tables defined.' ) ; $ tables = array ( ) ; $ tables = "\nFROM\n\t" . implode ( ",\n\t" , $ this -> tables ) ; $ conditions = "" ; $ groupings = "" ; $ havings = "" ; if ( $ this -> conditions ) $ conditions = "\nWHERE\n\t" . implode ( " AND\n\t" , $ this -> conditions ) ; if ( $ this -> groupings ) $ groupings = "\nGROUP BY\n\t" . implode ( ",\n\t" , $ this -> groupings ) ; if ( $ this -> havings ) $ havings = "\nHAVING\n\t" . implode ( ",\n\t" , $ this -> havings ) ; $ column = preg_replace ( '/(.+)( AS .+)/i' , '\\1' , $ this -> keys [ 0 ] ) ; $ statement = "SELECT COUNT(" . $ column . ") as rowcount" . $ tables . $ conditions . $ groupings . $ havings ; return $ statement ; }
Builds SQL Statement for counting only.
@access		public
@return		string
Builds SQL Statement for counting only .