List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 13 2000 8:56pm
Subject:Re: forcing the SET type column to return the decimal value
View as plain text  
At 6:07 PM +0200 10-13-2000, Stas Bekman wrote:
>Hi,
>
>I'm using mysql 3.23.25:
>
>I have a column:
>
>   karma  SET("AA","BB","CC","DD") NOT NULL,
>
>I want to retrieve the value of the 'karma' column as a decimal number, so
>I'll be able to continue performing bit-wise operations in perl code
>domain. By default it returns a string of symbolic names.
>
>I've found this hack doing what I want:
>
>   SELECT karma|0 FROM foo where ...
>
>e.g:
>
>   SELECT karma|0 FROM foo where karma&1 and (karma&2 or karma&4);
>
>I didn't find any other method that forces the SET column to return the
>decimal value. Did I miss something? I was using the latest documentation
>that came with ver 3.23.25.
>
>I was looking for something like this:
>
>   SELECT DEC(karma) as dec_karma FROM foo where ...


Is there something about karma|0 that you don't like?
It's perfectly acceptable.  So is karma+0.

-- 
Paul DuBois, paul@stripped
Thread
forcing the SET type column to return the decimal valueStas Bekman13 Oct
  • Re: forcing the SET type column to return the decimal valueStephen Vance13 Oct
  • Re: forcing the SET type column to return the decimal valuePaul DuBois13 Oct
    • Re: forcing the SET type column to return the decimal valueStas Bekman13 Oct
      • Re: forcing the SET type column to return the decimal valuePaul DuBois14 Oct
        • Re: forcing the SET type column to return the decimal valuePete Harlan15 Oct
          • Re: forcing the SET type column to return the decimal valueDon Read15 Oct