-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
92 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,6 +448,81 @@ public function getModelClass() | |
return $this->modelClass; | ||
} | ||
|
||
/** | ||
* Return table alias for model class for query | ||
* | ||
* @return Model|string | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.0 | ||
* @since 0.0 | ||
*/ | ||
public function getTableAlias() | ||
{ | ||
return $this->tableAlias; | ||
} | ||
|
||
/** | ||
* Set in query part where expression 'in (?)' | ||
* | ||
* @param $fieldName | ||
* @param array $fieldValue | ||
* @param array $modelTableData | ||
* @param string $sqlLogical | ||
* @param bool $isUse | ||
* @return QueryBuilder | ||
* @throws Exception | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.13 | ||
* @since 0.0 | ||
*/ | ||
public function in($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = QueryBuilder::SQL_LOGICAL_AND, $isUse = true) | ||
{ | ||
if (empty($fieldValue)) { | ||
$fieldValue = [0]; | ||
} | ||
|
||
return $this->where( | ||
[$fieldName => $fieldValue], | ||
$modelTableData, | ||
QueryBuilder::SQL_COMPARISON_KEYWORD_IN, | ||
$sqlLogical, | ||
$isUse | ||
); | ||
} | ||
|
||
/** | ||
* Set in query part where expression 'not in (?)' | ||
* | ||
* @param $fieldName | ||
* @param array $fieldValue | ||
* @param array $modelTableData | ||
* @param string $sqlLogical | ||
* @param bool $isUse | ||
* @return QueryBuilder | ||
* @throws Exception | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.3 | ||
* @since 0.0 | ||
*/ | ||
public function notIn($fieldName, array $fieldValue, $modelTableData = [], $sqlLogical = QueryBuilder::SQL_LOGICAL_AND, $isUse = true) | ||
{ | ||
if (empty($fieldValue)) { | ||
$fieldValue = [0]; | ||
} | ||
|
||
return $this->where( | ||
[$fieldName => $fieldValue], | ||
$modelTableData, | ||
QueryBuilder::SQL_COMPARISON_KEYWORD_NOT_IN, | ||
$sqlLogical, | ||
$isUse | ||
); | ||
} | ||
|
||
/** | ||
* Append cache validate or invalidate tags for this query builder | ||
* | ||
|
@@ -837,36 +912,6 @@ public function ne($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = | |
); | ||
} | ||
|
||
/** | ||
* Set in query part where expression 'not in (?)' | ||
* | ||
* @param $fieldName | ||
* @param array $fieldValue | ||
* @param array $modelTableData | ||
* @param string $sqlLogical | ||
* @param bool $isUse | ||
* @return QueryBuilder | ||
* @throws Exception | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.3 | ||
* @since 0.0 | ||
*/ | ||
public function notIn($fieldName, array $fieldValue, $modelTableData = [], $sqlLogical = QueryBuilder::SQL_LOGICAL_AND, $isUse = true) | ||
{ | ||
if (empty($fieldValue)) { | ||
$fieldValue = [0]; | ||
} | ||
|
||
return $this->where( | ||
[$fieldName => $fieldValue], | ||
$modelTableData, | ||
QueryBuilder::SQL_COMPARISON_KEYWORD_NOT_IN, | ||
$sqlLogical, | ||
$isUse | ||
); | ||
} | ||
|
||
/** | ||
* Set in query part where expression '== 1' is boolean true(1) | ||
* | ||
|
@@ -1105,21 +1150,6 @@ private function join($joinType, $modelTableData, $condition = null) | |
return $this; | ||
} | ||
|
||
/** | ||
* Return table alias for model class for query | ||
* | ||
* @return Model|string | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.0 | ||
* @since 0.0 | ||
*/ | ||
public function getTableAlias() | ||
{ | ||
return $this->tableAlias; | ||
} | ||
|
||
/** | ||
* @param $joinType | ||
* @param Model $modelTableData | ||
|
@@ -1311,6 +1341,11 @@ private function addJoin($joinType, $modelTableData, array $joins) | |
return false; | ||
} | ||
|
||
public function getBindParts() | ||
{ | ||
return $this->bindParts; | ||
} | ||
|
||
/** | ||
* Prepare select query part | ||
* | ||
|
@@ -1420,11 +1455,6 @@ public function select($fieldName, $fieldAlias = null, $modelTableData = [], $is | |
return $this; | ||
} | ||
|
||
public function getBindParts() | ||
{ | ||
return $this->bindParts; | ||
} | ||
|
||
/** | ||
* Return query result for select query | ||
* | ||
|
@@ -1753,36 +1783,6 @@ public function inPk(array $value, $modelTableData = [], $sqlLogical = QueryBuil | |
return $this->in(reset($pkFieldNames), $value, $modelTableData, $sqlLogical); | ||
} | ||
|
||
/** | ||
* Set in query part where expression 'in (?)' | ||
* | ||
* @param $fieldName | ||
* @param array $fieldValue | ||
* @param array $modelTableData | ||
* @param string $sqlLogical | ||
* @param bool $isUse | ||
* @return QueryBuilder | ||
* @throws Exception | ||
* @author dp <[email protected]> | ||
* | ||
* @version 1.13 | ||
* @since 0.0 | ||
*/ | ||
public function in($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = QueryBuilder::SQL_LOGICAL_AND, $isUse = true) | ||
{ | ||
if (empty($fieldValue)) { | ||
$fieldValue = [0]; | ||
} | ||
|
||
return $this->where( | ||
[$fieldName => $fieldValue], | ||
$modelTableData, | ||
QueryBuilder::SQL_COMPARISON_KEYWORD_IN, | ||
$sqlLogical, | ||
$isUse | ||
); | ||
} | ||
|
||
/** | ||
* Set flag of get count rows | ||
* | ||
|
@@ -2173,11 +2173,6 @@ public function afterSelect($trigger, $params = [], $modelClass = null, $isUse = | |
return $this->addTrigger('afterSelect', $trigger, $params, $modelClass, $isUse); | ||
} | ||
|
||
public function afterSelectCallback($callback, $params = [], $modelClass = null, $isUse = true) | ||
{ | ||
return $this->addTrigger('afterSelect', $callback, $params, $modelClass, $isUse); | ||
} | ||
|
||
private function addTrigger($type, $trigger, $params, $modelClass, $isUse) | ||
{ | ||
if (!$isUse) { | ||
|
@@ -2195,6 +2190,11 @@ private function addTrigger($type, $trigger, $params, $modelClass, $isUse) | |
return $this; | ||
} | ||
|
||
public function afterSelectCallback($callback, $params = [], $modelClass = null, $isUse = true) | ||
{ | ||
return $this->addTrigger('afterSelect', $callback, $params, $modelClass, $isUse); | ||
} | ||
|
||
public function beforeSelect($trigger, $params = [], $modelClass = null, $isUse = true) | ||
{ | ||
return $this->addTrigger('beforeSelect', $trigger, $params, $modelClass, $isUse); | ||
|
@@ -2452,7 +2452,10 @@ public function func($funcName, $argumentString, $modelTableData = []) | |
|
||
$this->select( | ||
($fieldName ? strtoupper($fieldName) : '') . '(' . | ||
(isset($fieldColumns[$argumentString]) ? $tableAlias . '.' . $fieldColumns[$argumentString] : $argumentString) . | ||
(isset($fieldColumns[$argumentString]) | ||
? $tableAlias . '.' . $fieldColumns[$argumentString] | ||
: ($argumentString === '' ? '""' : $argumentString) | ||
) . | ||
')', | ||
$fieldAlias, | ||
$modelTableData | ||
|
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