Re: user variables and regexp

2004-10-07 Thread Paul DuBois
At 3:12 +0200 10/8/04, Przemyslaw Popielarski wrote:
User variables do not work with REGEXP under MySQL 4.0.21  4.1.5.
Is this a bug or a feature?
It's difficult to provide an answer to this because you're providing
no information about what do not work means.  Can you be more specific?
mysql set @x = 'abc';
Query OK, 0 rows affected (0.13 sec)
mysql select @x like 'a%';
+--+
| @x like 'a%' |
+--+
|1 |
+--+
1 row in set (0.08 sec)
mysql select @x like 'b%';
+--+
| @x like 'b%' |
+--+
|0 |
+--+
1 row in set (0.01 sec)
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: user variables and regexp

2004-10-07 Thread Przemyslaw Popielarski
Paul DuBois [EMAIL PROTECTED] wrote:
 User variables do not work with REGEXP under MySQL 4.0.21  4.1.5.
 Is this a bug or a feature?
 
 It's difficult to provide an answer to this because you're providing
 no information about what do not work means.  Can you be more
 specific? 

Sure. I didn't want to write to not mess in case this is a feature. 
So here goes my test case:

SELECT
   @a:=FIRMLEGALZIPCODE
FROM tCustomers
WHERE @a REGEXP [0-9]
- Empty set (0.03 sec)

SELECT
  @a:=FIRMLEGALZIPCODE
FROM tCustomers
WHERE FIRMLEGALZIPCODE REGEXP [0-9];
- 2803 rows in set (0.03 sec)

-- 
./ premax
./ [EMAIL PROTECTED]
./ koniec i bomba, a kto czytal ten traba. w.g.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: user variables and regexp

2004-10-07 Thread Paul DuBois
At 3:47 +0200 10/8/04, Przemyslaw Popielarski wrote:
Paul DuBois [EMAIL PROTECTED] wrote:
 User variables do not work with REGEXP under MySQL 4.0.21  4.1.5.
 Is this a bug or a feature?
 It's difficult to provide an answer to this because you're providing
 no information about what do not work means.  Can you be more
 specific?
Sure. I didn't want to write to not mess in case this is a feature.
So here goes my test case:
SELECT
   @a:=FIRMLEGALZIPCODE
FROM tCustomers
WHERE @a REGEXP [0-9]
- Empty set (0.03 sec)
You're expecting the value to be selected first so that you then can
test it with the WHERE clause later.
SELECT
  @a:=FIRMLEGALZIPCODE
FROM tCustomers
WHERE FIRMLEGALZIPCODE REGEXP [0-9];
- 2803 rows in set (0.03 sec)

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: user variables and regexp

2004-10-07 Thread Przemyslaw Popielarski
Paul DuBois [EMAIL PROTECTED] wrote:
 SELECT
@a:=FIRMLEGALZIPCODE
 FROM tCustomers
 WHERE @a REGEXP [0-9]
 - Empty set (0.03 sec)

 You're expecting the value to be selected first so that you then can
 test it with the WHERE clause later.

Of course you're right. Thanks. According to your suggestion this one works
okey:

SELECT
 @a
FROM tCustomers
WHERE @a:=FIRMLEGALZIPCODE REGEXP [0-9]

-- 
./ premax
./ [EMAIL PROTECTED]
./ koniec i bomba, a kto czytal ten traba. w.g.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: user variables and regexp

2004-10-07 Thread Paul DuBois
At 4:01 +0200 10/8/04, Przemyslaw Popielarski wrote:
Paul DuBois [EMAIL PROTECTED] wrote:
 SELECT
@a:=FIRMLEGALZIPCODE
 FROM tCustomers
 WHERE @a REGEXP [0-9]
 - Empty set (0.03 sec)
 You're expecting the value to be selected first so that you then can
 test it with the WHERE clause later.
Of course you're right. Thanks. According to your suggestion this one works
okey:
SELECT
 @a
FROM tCustomers
WHERE @a:=FIRMLEGALZIPCODE REGEXP [0-9]
True, although in this case you don't need a user variable at all:
SELECT
 FIRMLEGALZIPCODE
FROM tCustomers
WHERE FIRMLEGALZIPCODE REGEXP [0-9]
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]