List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 15 1999 1:54pm
Subject:Re: How to delete a member from a SET column
View as plain text  
Some time ago, on Wed, 1999-07-07 21:54:38 +0200,
Benjamin Pflugmann wrote:
> While 'playing' around with SETs I did not like how to handle them
> (at least the ways I found).

Yea, I also think SET handling still is very rough.

> Presume an application which does not know about all currently
> allowed members of the SET, but only the ones it really needs. I
> really want atomic statements, so 'DESCRIBE table' and do some
> parsing in a programming language is out of the scope.

The best I can think of, as things are now up to MySQL V3.23.3,
is to deal with the numerical values of set members and then use
bit arithmetik.

If you know all the names of allowed list members, I suggest you first
get their numerical values with the help of 'DESCRIBE table'.
(I don't understand your argument above against this approach, though.)

Then, with the numerical values, it's easy to delete/add elements
from/to a set:

adding an element:
   UPDATE settable SET setfield = setfield | elementvalue;

deleting an element:
   UPDATE settable SET setfield = setfield - (setfield & elementvalue);
   (it's this complicated, because there's no bitwise not operator)


> I guess, something like
> 
> UPDATE test SET field=STRIP(field, 'one', 'two');
> 
> (or STRIP(field, 'one,two')) 
> would be nice (choose whatever name you like for STRIP).

Yea, sounds like good an idea!

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
How to delete a member from a SET columnBenjamin Pflugmann7 Jul
  • Re: How to delete a member from a SET columnMartin Ramsch15 Sep
    • Re: How to delete a member from a SET columnJames Manning15 Sep
      • Re: How to delete a member from a SET columnMartin Ramsch16 Sep
        • Re: How to delete a member from a SET columnMartin Ramsch16 Sep
          • Re: How to delete a member from a SET columnJames Manning17 Sep
            • Re: How to delete a member from a SET columnMartin Ramsch17 Sep
              • Re: How to delete a member from a SET columnJames Manning17 Sep
                • Re: How to delete a member from a SET columnMartin Ramsch17 Sep
                  • placeholdersjice17 Sep
                    • Re: placeholdersBob Kline17 Sep
                  • Re: How to delete a member from a SET columnJames Manning17 Sep
        • Re: How to delete a member from a SET columnJames Manning17 Sep
          • Re: How to delete a member from a SET columnMartin Ramsch17 Sep