> Neither I, it seams strange. This value has to be stored in some kind
> of pointer to an object or char * in the program it self. I would first
> assume that the content of the pointer is tested, but that cant be true
> since the content in this case is the number 65.

You're assuming a very low-level and crude behavior with regard to strings.
Rather, MySQL takes an unexpectedly "high level" approach.


> I don't know how MySQL tokenizes the SQL query, but if it breaks up
> the token in a certain way, then it is possible that the interpreter
> finds the string 'a', and then assumes it MUST have an operator, but
> the operator might then point to NULL, an dthen nobody know what
> happens after that, except that the end results evaluates to zero.
>
> Hmmm... this is indeed interesting to know what really happens, maybe
> I should download the source code and stepdebug just top see what actually
> happens. But that has to be a later project...

Nope.  It's not an obscure parser bug, it's just coercing strings to
integers.

Consider the following C code which behaves in the same manner:

#include <stdio.h>

int main(int argc, char** argv)
{
        printf("Got: %d.\n", atoi("0"));
        printf("Got: %d.\n", atoi("1"));
        printf("Got: %d.\n", atoi("-1"));
        printf("Got: %d.\n", atoi("1aaa"));
        printf("Got: %d.\n", atoi("aaa1"));
        printf("Got: %d.\n", atoi("a"));
}

The output being:
Got: 0.
Got: 1.
Got: -1.
Got: 1.
Got: 0.
Got: 0.


-JF


---------------------------------------------------------------------
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