Storing flags in a DB

前端 未结 3 1533
無奈伤痛
無奈伤痛 2021-01-06 11:12

In my application, I\'d like the user to select his working days. then store them in the database. Of course my application will process the users\' data like: Is today a wo

3条回答
  •  花落未央
    2021-01-06 11:20

    Bitmasking field is a bit more cryptic in nature and you need to create something else to interpret what you store in the bitmask.

    The second approach is a lot more transparent and easily understandable and it's a bit more flexible if you need to add more values. With the bitmask, you again need to redo your bitmap decoder each time you add a value which can be a maintainance nightmare compared to the relational approach.

提交回复
热议问题