Skip to content

Commit

Permalink
Added DB::preselect method.
Browse files Browse the repository at this point in the history
  • Loading branch information
zntr committed Jul 13, 2023
1 parent 4bad38a commit 67c8284
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions Internal/package-database/DB.php
Expand Up @@ -103,13 +103,20 @@ class DB extends Connection
private $transStart , $transError , $duplicateCheck , $duplicateCheckUpdate ;
private $joinType , $joinTable , $unionQuery = NULL, $caching = [], $jsonDecode ;
private $hashId , $hashIdColumn, $isUpdate = false , $unset = [], $object ;
private $from , $results , $returnQueryType , $paging = 'row' ;
private $preselect , $results , $returnQueryType , $paging = 'row' ;

/**
* Callable talking queries.
*/
use CallableTalkingQueries;

public function preselect($preselect)
{
$this->preselect = $preselect . ' ';

return $this;
}

/**
* Defines SQL SELECT
*
Expand Down Expand Up @@ -759,7 +766,8 @@ public function get(string $table = NULL, string $return = 'object')
{
$this->tableName = $table = $this->addPrefixForTableAndColumn($table, 'table');

$finalQuery = 'SELECT ' .
$finalQuery = $this->preselect .
'SELECT ' .
$this->distinct . $this->highPriority . $this->straightJoin .
$this->smallResult. $this->bigResult . $this->bufferResult .
$this->cache . $this->calcFoundRows. $this->buildSelectClause() .
Expand Down Expand Up @@ -3229,8 +3237,8 @@ protected function resetSelectQueryVariables()
$this->bufferResult = NULL;
$this->cache = NULL;
$this->calcFoundRows = NULL;
$this->preselect = NULL;
$this->select = NULL;
$this->from = NULL;
$this->table = NULL;
$this->where = NULL;
$this->groupBy = NULL;
Expand Down
2 changes: 1 addition & 1 deletion zeroneed.php
Expand Up @@ -30,4 +30,4 @@
|
*/

ZN\ZN::run('FE', '8.3.3', 'Mustafa Kemal Atatürk');
ZN\ZN::run('FE', '8.4.0', 'Mustafa Kemal Atatürk');

0 comments on commit 67c8284

Please sign in to comment.