-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added multicolumn aggregation to DBA and improved three essential par…
…ts which suffer from many chunks (#1069) * Adding loops to scan through lines to support importing hashes longer then 1024 bytes * added multicolumn aggregation to DBA and improved three essential parts which suffer from many chunks * applied requested changes (constants and query merge) for pull request #1069 --------- Co-authored-by: Jesse van Zutphen <[email protected]>
- Loading branch information
Showing
6 changed files
with
118 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace DBA; | ||
|
||
use DBA\AbstractModelFactory; | ||
|
||
class Aggregation { | ||
private $column; | ||
private $function; | ||
/** | ||
* @var AbstractModelFactory | ||
*/ | ||
private $factory; | ||
|
||
const SUM = "SUM"; | ||
const MAX = "MAX"; | ||
const MIN = "MIN"; | ||
const COUNT = "COUNT"; | ||
|
||
function __construct($column, $function, $factory = null) { | ||
$this->column = $column; | ||
$this->function = $function; | ||
$this->factory = $factory; | ||
} | ||
|
||
function getName() { | ||
return strtolower($this->function) . "_" . $this->column; | ||
} | ||
|
||
function getQueryString($table = "") { | ||
if ($table != "") { | ||
$table = $table . "."; | ||
} | ||
if ($this->factory != null) { | ||
$table = $this->factory->getModelTable() . "."; | ||
} | ||
|
||
return $this->function . "(" . $table . $this->column . ") AS " . $this->getName(); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters