예제 #1
0
 /**
  * Return where sql
  * @param boolean $with_values
  * @param boolean $with_optimization
  * @return string
  */
 function getWhereString($with_values = true, $with_optimization = true)
 {
     $where = '';
     $condition_count = 0;
     foreach ($this->conditions as $conditionGroup) {
         if ($condition_count === 0) {
             $conditionGroup->setPipe("");
         }
         $condition_string = $conditionGroup->toString($with_values);
         $where .= $condition_string;
         $condition_count++;
     }
     if ($with_optimization && (strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order'))) {
         if ($condition_count !== 0) {
             $where = '(' . $where . ') ';
         }
         foreach ($this->orderby as $order) {
             $colName = $order->getColumnName();
             if (strstr($colName, 'list_order') || strstr($colName, 'update_order')) {
                 $opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and');
                 if ($condition_count === 0) {
                     $opt_condition->setPipe("");
                 }
                 $where .= $opt_condition->toString($with_values) . ' ';
                 $condition_count++;
             }
         }
     }
     return trim($where);
 }
예제 #2
0
 /**
  * Checks not operation
  */
 public function testConditionString_Not()
 {
     $tag = new ConditionWithoutArgument('"member_srl"', "20", 'not', null);
     $this->assertEquals(' "member_srl" ~ 20', $tag->toString());
 }