| | 791 | * Adds an "in" condition to the where clause |
| | 792 | * |
| | 793 | * @param string Name of the column being examined |
| | 794 | * @param mixed An array or string to match against |
| | 795 | * @return object This Database object. |
| | 796 | */ |
| | 797 | public function in($field, $values) |
| | 798 | { |
| | 799 | if (is_array($values)) |
| | 800 | { |
| | 801 | $escaped_values = array(); |
| | 802 | foreach ($values as $v) |
| | 803 | { |
| | 804 | if (is_numeric($v)) |
| | 805 | { |
| | 806 | $escaped_values[] = $v; |
| | 807 | } |
| | 808 | else |
| | 809 | { |
| | 810 | $escaped_values[] = "'".$this->driver->escape_string($v)."'"; |
| | 811 | } |
| | 812 | } |
| | 813 | $values = implode(",", $escaped_values); |
| | 814 | } |
| | 815 | $this->where($this->driver->escape_column($field).' IN('.$values.')'); |
| | 816 | |
| | 817 | return $this; |
| | 818 | } |
| | 819 | |
| | 820 | /** |