Page 1 of 1

How did it know it was the same?

Posted: Mon Apr 10, 2006 11:31 am
by xterra
I realized earlier that a code bug would allow two different users "test" and "Test" to exist at one time, so I needed to fix that. However, to my surprise, when I woke up earlier to test my flaw, it worked flawlessy. In other words, somehow my query knew that "test" and "Test" were infact the same, and it would not allow the user to register "test". So that's actually good.


But I'd like to know why did it know? I figured it was because I used LIKE. So, testing my theory I replaced LIKE with "=". I assumed that = checks for exactly case, and LIKE disregards case. But no, still! No matter what keyword I use, whether I use LIKE or = , it knows that TEST and test are infact the same.


Can someone explain this to me? Or did I just confuse everyone?


Thanks in advance.

Posted: Mon Apr 10, 2006 11:36 am
by JayBird
show your exact queries

Posted: Mon Apr 10, 2006 12:10 pm
by feyd
The fields are strings, but not binary. MySQL will allow case variance in non-binary fields. What variances are allowed, I believe is controlled by the collation used on the tables.

Posted: Mon Apr 10, 2006 3:24 pm
by xterra
That would make sense because it also allowed me to do < > and = comparisons.

Thanks.