def conditions
      return ['1=0'] if !valid?

      conds       = []
      values      = []
      for col in klass.columns do
        col_str = col_name(col)
        val     = @attrs[encode_name(col)]
        if !val.blank?
          case col.type
          when :string, :text
            if val =~ /\*$/
              conds   << col_str + ' like ?'
              values  << val.gsub(/\*$/, '%')
            else
              conds   << col_str + '=?'
              values  << val
            end
          when :datetime
            case is_dbms?
            when Dbms::MYSQL
#             conds   << col_str + @_operator.exp(encode_name(col))
              conds   << sprintf("date(%s)",
                  col_str) +
                  @_operator.exp(encode_name(col))
            else
              conds   << sprintf("date(timezone('%s',%s))",
                  DEFAULT_TIMEZONE_FOR_TIMESTAMP_DATE_COMPARISON,
                  col_str) +
                  @_operator.exp(encode_name(col))
            end
            values  << val.to_s
          when :boolean
            case is_dbms?
            when Dbms::MYSQL
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << (val=='true')
            else
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << val
            end
          else
            conds   << col_str + @_operator.exp(encode_name(col))
            values  << val
          end
        end
      end
      return [conds.join(' and ')] + values
    end
def conditions
      return ['1=0'] if !valid?

      conds       = []
      values      = []
      for col in klass.columns do
        col_str = col_name(col)
        val     = @attrs[encode_name(col)]
        if !val.blank?
          case col.type
          when :string, :text
            if val =~ /\*$/
              conds   << col_str + ' like ?'
              values  << val.gsub(/\*$/, '%')
            else
              conds   << col_str + '=?'
              values  << val
            end
          when :datetime
            case is_dbms?
            when Dbms::MYSQL
#             conds   << col_str + @_operator.exp(encode_name(col))
              conds   << sprintf("date(%s)",
                  col_str) +
                  @_operator.exp(encode_name(col))
            else
              conds   << sprintf("date(timezone('%s',%s))",
                  DEFAULT_TIMEZONE_FOR_TIMESTAMP_DATE_COMPARISON,
                  col_str) +
                  @_operator.exp(encode_name(col))
            end
            values  << val.to_s
          when :boolean
            case is_dbms?
            when Dbms::MYSQL
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << (val=='true')
            else
              conds   << col_str + @_operator.exp(encode_name(col))
              values  << val
            end
          else
            conds   << col_str + @_operator.exp(encode_name(col))
            values  << val
          end
        end
      end
      return [conds.join(' and ')] + values
    end
Generate search-conditions.
 Wildcard search by '*' is supported on string attribute.

 === RETURN
 condition_string, value_array:: values for :conditions option on model