예제 #1
0
 private function apply_where_conditions($args)
 {
     require_once 'Expressions.php';
     $num_args = count($args);
     if ($num_args == 1 && is_hash($args[0])) {
         $hash = is_null($this->joins) ? $args[0] : $this->prepend_table_name_to_fields($args[0]);
         $e = new Expressions($this->connection, $hash);
         $this->where = $e->to_s();
         $this->where_values = array_flatten($e->values());
     } elseif ($num_args > 0) {
         // if the values has a nested array then we'll need to use Expressions to expand the bind marker for us
         $values = array_slice($args, 1);
         foreach ($values as $name => &$value) {
             if (is_array($value)) {
                 $e = new Expressions($this->connection, $args[0]);
                 $e->bind_values($values);
                 $this->where = $e->to_s();
                 $this->where_values = array_flatten($e->values());
                 return;
             }
         }
         // no nested array so nothing special to do
         $this->where = $args[0];
         $this->where_values =& $values;
     }
 }
예제 #2
0
 private function apply_where_conditions($args)
 {
     $num_args = count($args);
     if ($num_args == 1 && is_hash($args[0])) {
         $e = new Expressions($args[0]);
         $e->set_connection($this->connection);
         $this->where = $e->to_s();
         $this->where_values = array_flatten($e->values());
     } elseif ($num_args > 0) {
         // if the values has a nested array then we'll need to use Expressions to expand the bind marker for us
         $values = array_slice($args, 1);
         foreach ($values as $name => &$value) {
             if (is_array($value)) {
                 $e = new Expressions($args[0]);
                 $e->set_connection($this->connection);
                 $e->bind_values($values);
                 $this->where = $e->to_s();
                 $this->where_values = array_flatten($e->values());
                 return;
             }
         }
         // no nested array so nothing special to do
         $this->where = $args[0];
         $this->where_values =& $values;
     }
 }