Changeset 2060
- Timestamp:
- 02/15/2008 10:33:49 AM (11 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Database.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Database.php
r2058 r2060 789 789 790 790 /** 791 * Adds an " in" condition to the where clause791 * Adds an "IN" condition to the where clause 792 792 * 793 793 * @param string Name of the column being examined 794 794 * @param mixed An array or string to match against 795 * @param bool Generate a NOT IN clause instead 795 796 * @return object This Database object. 796 797 */ 797 public function in($field, $values )798 public function in($field, $values, $not = FALSE) 798 799 { 799 800 if (is_array($values)) … … 813 814 $values = implode(",", $escaped_values); 814 815 } 815 $this->where($this->driver->escape_column($field).' IN('.$values.')'); 816 817 return $this; 816 $this->where($this->driver->escape_column($field).' '.(!$not) ? 'NOT ' : ''.'IN ('.$values.')'); 817 818 return $this; 819 } 820 821 /** 822 * Adds a "NOT IN" condition to the where clause 823 * 824 * @param string Name of the column being examined 825 * @param mixed An array or string to match against 826 * @return object This Database object. 827 */ 828 public function notin($field, $values) 829 { 830 return $this->in($field, $values, TRUE); 818 831 } 819 832
