At 11:12 PM +0200 10-13-2000, Stas Bekman wrote:
>On Fri, 13 Oct 2000, Paul DuBois wrote:
> > Is there something about karma|0 that you don't like?
>> It's perfectly acceptable. So is karma+0.
>
>It looks like a hack, and it's not obvious to the reader of my code what
>is being returned.
>
>karma+0 is not different than karma|0, at least the later gives the hint
>that the variable must be a of the SET type (because of the bit-wise OR).
You could put a comment in your code. :-)
>
>Of course it works for me, but I just thought that there should be an
>operand that tells mysql to return the data as a number or string
>explicitly.
It's unnecessary, given that +0 or |0 work.
>
>This remind me of perl variables where scalars are always has both
>types: string and numerical, and the appropriate value is returned
>according to the context.
>
>The only request that I have is to add this note to the SET section in the
>mysql documentation. I didn't come up with this trick right away, because
>I was sure that mysql has a special function for that, so I've spent quite
>a lot of time looking for it. When I gave up I've found the solution by
>trial and error.
Done. Thanks for the suggestion.
--
Paul DuBois, paul@stripped