So sprach Benjamin Pflugmann am Sun, Jun 03, 2001 at 11:42:34PM +0200:
> Hello.

Nabend!

> Yes, this is the documented behaviour:

Oh, I must have overlooked the last sentence.  Thanks for pointing it out.

> Regardless, this is an interesting proposal which should be
> considered. Only problem is, that it would break old programs which
> rely on using insertions like like "BLONDE,TALL" currently.

Hmm, yes, it will break old programs which used to insert 'BLONDE\,TALL' and
where clever enough to not have it clash with possible other values.  Ie.
programs/programmers which not allowed the three values 'BLONDE', 'TALL' and
'BLONDE,TALL' to exist in one SET column.

Adding a \ before each and every returned , of one value would allow all the
three column values, though.

Or is there currently some workaround that I can use?  Sadly, trying to
escape the , when adding the column doesn't work:

mysql> alter table test add SetCol2 SET ('BLONDE', 'TALL', 'BLONDE\,TALL');
Query OK, 2 rows affected (0.03 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> sho
show databases    show fields from  show keys from    show tables       
mysql> show fields from test;
+---------+------------------------------------+------+-----+---------+----------------+
| Field   | Type                               | Null | Key | Default | Extra          
||
+---------+------------------------------------+------+-----+---------+----------------+
| ID      | tinyint(3) unsigned zerofill       |      | PRI | NULL    | auto_increment 
||
| SetCol  | set('BLONDE','TALL','BLONDE,TALL') | YES  |     | NULL    |                
||
| SetCol2 | set('BLONDE','TALL','BLONDE,TALL') | YES  |     | NULL    |                
||
+---------+------------------------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

As you can see, SetCol2 contains 'BLONDE,TALL' and not 'BLONDE\,TALL'.
BTW: I consider this to be an error as well...  Someone please point me to
where it's mentioned in the manual that I'm wrong this time :)

Uh - more strangeness:


mysql> alter table test add SetCol3 SET ('BLONDE', 'TALL', 'BLONDE\\,TALL');
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> show fields from test;
+---------+--------------------------------------+------+-----+---------+----------------+
| Field   | Type                                 | Null | Key | Default | Extra        
|  |
+---------+--------------------------------------+------+-----+---------+----------------+
| ID      | tinyint(3) unsigned zerofill         |      | PRI | NULL    | 
|auto_increment |
| SetCol  | set('BLONDE','TALL','BLONDE,TALL')   | YES  |     | NULL    |              
|  |
| SetCol2 | set('BLONDE','TALL','BLONDE,TALL')   | YES  |     | NULL    |              
|  |
| SetCol3 | set('BLONDE','TALL','BLONDE\\,TALL') | YES  |     | NULL    |              
|  |
+---------+--------------------------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> insert into test set SetCol3 = 'BLONDE\\,TALL';
Query OK, 1 row affected (0.01 sec)

mysql> select * from test;
+-----+-------------+---------+---------+
| ID  | SetCol      | SetCol2 | SetCol3 |
+-----+-------------+---------+---------+
| 001 | BLONDE,TALL | NULL    | NULL    |
| 002 | BLONDE,TALL | NULL    | NULL    |
| 003 | NULL        | NULL    | TALL    |
+-----+-------------+---------+---------+
3 rows in set (0.00 sec)

Now, why is for ID == 003   SetCol3 == TALL, and not 'BLONDE\\,TALL'?  If
it's because of a stripped escape character, than I don't understand at all
why the \\ in my ALTER TABLE statement survived.

This is very strange/I don't understand it all....

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die g�nstige Art an Linux Distributionen zu kommen
                Uptime: 9 hours 12 minutes

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