Go Back   SitePoint Forums > Forum Index > Program Your Site > Databases > MySQL
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Jul 5, 2005, 14:00   #1
alig4321
SitePoint Enthusiast
 
Join Date: May 2005
Location: UK
Posts: 65
Using LIKE to match patterns - strange occurence when escaping

Code:
SELECT "A\\" LIKE "A\\"
Effectively this should compare the string 'A\' to the pattern 'A\' yet when I execute this code on v4.1 I get a return of 0.

Can anyone shed light on this?
alig4321 is offline   Reply With Quote
Old Jul 5, 2005, 16:35   #2
r937
SQL Consultant
silver trophybronze trophy
SitePoint Award Recipient
 
r937's Avatar
 
Join Date: Jul 2002
Location: Toronto, Canada
Posts: 31,026
on 4.1.12a-nt, i get a return of 1, not 0
r937 is offline   Reply With Quote
Old Jul 5, 2005, 19:58   #3
alig4321
SitePoint Enthusiast
 
Join Date: May 2005
Location: UK
Posts: 65
Thats real strange. I ran it in the command line client and got 1. I ran it in Query Browser and got 0.

Could it be a bug in Query Browser's parsing maybe?
alig4321 is offline   Reply With Quote
Old Jul 5, 2005, 20:27   #4
longneck
reads the Community Crier
silver trophybronze trophy
SitePoint Award Recipient
 
longneck's Avatar
 
Join Date: Feb 2004
Location: Tampa, FL (US)
Posts: 9,896
maybe. query browser issues a "SET NAMES utf8" command right before it sends the query, and that causes mysql to return 0 when i'm in the CLI, too. i'll post it on the mysql website as a bug in mysql and see waht they say.
longneck is offline   Reply With Quote
Old Jul 6, 2005, 03:34   #5
Tangerine_Dream
SitePoint Evangelist
 
Join Date: Apr 2005
Location: Moscow, Russia
Posts: 559
On MySQL 5.0.2-alpha-nt the query also returns 1 for "SET NAMES latin1" and 0 for "SET NAMES utf8"
Tangerine_Dream is offline   Reply With Quote
Old Jul 6, 2005, 10:14   #6
longneck
reads the Community Crier
silver trophybronze trophy
SitePoint Award Recipient
 
longneck's Avatar
 
Join Date: Feb 2004
Location: Tampa, FL (US)
Posts: 9,896
it is now officially a bug: http://bugs.mysql.com/bug.php?id=11754
longneck is offline   Reply With Quote
Old Sep 25, 2007, 08:46   #7
bangkok_knight
SitePoint Member
 
Join Date: Sep 2007
Posts: 13
Mine is returning 1 too. cheers.
bangkok_knight is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 22:45.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved