/** * creates a condition statment * * @param string $table table name * @param string $field field name * @param string $action what comparison method to use * @param mixed $argument what to compare with. can be: int, string, array (for IN statements) and Query instance (for sub-queries) * @param string|array $function a function name|an array of function name and paramters for the function * * @access public * @return subCondition a condition object */ public function createCondition($table, $field, $action, $argument, $function = '') { $cond = array(); if (in_array($action, $this->_actions) == false) { $cond['action'] = '='; } else { $cond['action'] = $action; } if (is_array($function) && in_array($function[0], $this->_functions)) { $cond['func'] = $function; } elseif (is_string($function) && in_array($function, $this->_functions)) { $cond['func'][0] = $function; $cond['func'][1] = ''; } else { $cond['func'] = false; } if ($argument instanceof query) { $cond['argument'] = $argument; } elseif (is_numeric($argument) === false && is_string($argument) && NewDao::connected()) { $cond['argument'] = NewDao::escape($argument); } else { $cond['argument'] = $argument; } $cond['fields'] = array($table, $field); return new subCondition($cond); }