Doh.  My bad.  I was indeed thinking of integer context rather than boolean
context.

I was thinking of a Perl construct of the form:

        if("a" + 0) { ... }

I.E. forcing it to an integer context...


-JF


> -----Original Message-----
> From: Keith C. Ivey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 16, 2002 11:07 AM
> To: Mysql List
> Subject: RE: WHERE codition test
>
>
> On 16 Apr 2002, at 10:58, Jon Frisby wrote:
>
> > String literals in a truth test such as you set up are coerced
> to integers.
> > (A la C's 'atoi()' function.)
> [snip]
> > If you're used to weakly-typed languages, such as Perl this is fairly
> > typical behavior although it does seem counterintuitive in the
> context of
> > SQL.
>
> Actually, if you're used to Perl the behavior seems strange, since
> strings are true in Perl unless they're '' or '0'.  Perl does coerce
> strings to integers as you say, but only in integer context, which
> in Perl is separate from boolean context.
>
> --
> Keith C. Ivey <[EMAIL PROTECTED]>
> Tobacco Documents Online
> http://tobaccodocuments.org
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to