On Dec 7, 2005, at 10:24 AM, Ed Howland wrote:
> Sets are by def. unordered. Sets actually store the numeric value
> (1,2,4,8.16) of each set position.

Which makes sense for efficiency.  But it sure would be nice to have  
an API which abstracts out the bit-shifting.

For example:

   update t set pets = remove_from_set('cat', pets)

is a lot easier to understand and not dependent on the order in which  
the set was defined than:

   update t set pets = pets & ~2

After all there's already a find_in_set.

So I'm curious to know if that API exists.  If it does, I haven't  
found it, yet.  If it doesn't, that's OK, too.  I'll probably do as M  
suggested and break out the fields into different tables.

Or is MySQL extensible in that I can easily create my own API?  That  
is, how easy is it to create a remove_from_set() function?

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

 
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to