Storing single bits efficiently

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mrT

    #1

    Storing single bits efficiently

    Hi,
    My latest web project includes loads of user-customisable features,
    lots of which are on/off values. Currently I'm storing each one of the
    15 or so properties in tinyint fields, as 1s or 0s. There must be a
    smarter way...

    I know it's possible to store a set of 8 bits in a tinyint column, but
    the work involved in retrieving, and (more importantly) updating the
    flags is off-putting. I had a look at the set field type, but can't
    find any mysql functions for updating sets - I want to be able to
    change specific bits in a set without having to retrieve the set
    first.

    What do the pros do? Any help is appreciated.

    TIA!
    Thomas
Working...