* [misc] add quote for getCondition.
This commit is contained in:
@@ -301,7 +301,7 @@ class sqlparser
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getCondition($tableA = null, $columnA = null, $operator = '', $tableB = null, $columnB = null, $group = 1)
|
||||
public function getCondition($tableA = null, $columnA = null, $operator = '', $tableB = null, $columnB = null, $group = 1, $quote = true)
|
||||
{
|
||||
if(is_array($tableA)) return call_user_func_array(array($this, 'getCondition'), $tableA);
|
||||
|
||||
@@ -323,8 +323,10 @@ class sqlparser
|
||||
/* 如果tableB为空,那么columnB是值,需要trim("'")。*/
|
||||
if(empty($tableB)) $columnB = $this->trimExpr($columnB, "'");
|
||||
|
||||
$exprA = empty($tableA) ? "`$columnA`" : "`$tableA`.`$columnA`";
|
||||
$exprB = empty($tableB) ? "'$columnB'" : "`$tableB`.`$columnB`";
|
||||
$columnB = empty($tableB) && $quote ? "'$columnB'" : $columnB;
|
||||
$exprA = empty($tableA) ? "`$columnA`" : "`$tableA`.`$columnA`";
|
||||
$exprB = empty($tableB) ? $columnB : "`$tableB`.`$columnB`";
|
||||
|
||||
|
||||
$operator = strtoupper($operator);
|
||||
$expr = "$exprA $operator $exprB";
|
||||
|
||||
Reference in New Issue
Block a user