mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-10-31 11:24:51 +01:00 
			
		
		
		
	DbQuery: Add getter for GROUP BY clauses
Allows to override this in a child to provide group by clauses not until they are actually required. refs #9009
This commit is contained in:
		
							parent
							
								
									4d72832933
								
							
						
					
					
						commit
						386447b847
					
				| @ -145,8 +145,9 @@ class DbQuery extends SimpleQuery | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if ($this->group) { | ||||
|             $select->group($this->group); | ||||
|         $group = $this->getGroup(); | ||||
|         if ($group) { | ||||
|             $select->group($group); | ||||
|         } | ||||
| 
 | ||||
|         $select->columns($this->columns); | ||||
| @ -321,8 +322,9 @@ class DbQuery extends SimpleQuery | ||||
|     { | ||||
|         // TODO: there may be situations where we should clone the "select"
 | ||||
|         $count = $this->dbSelect(); | ||||
|         if ($this->group) { | ||||
|             $count->group($this->group); | ||||
|         $group = $this->getGroup(); | ||||
|         if ($group) { | ||||
|             $count->group($group); | ||||
|         } | ||||
|         $this->applyFilterSql($count); | ||||
|         if ($this->useSubqueryCount || $this->group) { | ||||
| @ -393,6 +395,16 @@ class DbQuery extends SimpleQuery | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Return the GROUP BY clause | ||||
|      * | ||||
|      * @return  string|array | ||||
|      */ | ||||
|     public function getGroup() | ||||
|     { | ||||
|         return $this->group; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Return whether the given table has been joined | ||||
|      * | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user