public function where($field, $cond = UNDEFINED, $value = UNDEFINED, $kind = 'where')
    {
        if (is_array($field)) {
            // or conditions
            $or = $this->orExpr();
            foreach ($field as $row) {
                if (is_array($row)) {
                    $or->where(
                        $row[0],
                        array_key_exists(1, $row) ? $row[1] : UNDEFINED,
                        array_key_exists(2, $row) ? $row[2] : UNDEFINED
                    );
                } elseif (is_object($row)) {
                    $or->where($row);
                } else {
                    $or->where($or->expr($row));
                }
            }
            $field = $or;
        }

        if (is_string($field) && !preg_match('/^[.a-zA-Z0-9_]*$/', $field)) {
            // field contains non-alphanumeric values. Look for condition
            preg_match(
                '/^([^ <>!=]*)([><!=]*|( *(not|is|in|like))*) *$/',
                $field,
                $matches
            );
            $value = $cond;
            $cond = $matches[2];
            if (!$cond) {
                // IF COMPAT
                $matches[1] = $this->expr($field);
                if ($value && $value !== UNDEFINED) {
                    $cond = '=';
                } else {
                    $cond = UNDEFINED;
                }
            }
            $field = $matches[1];
        }

        $this->args[$kind][] = array($field, $cond, $value);

        return $this;
    }