How it is Better to Store Multiple Options
-
I am going to have data that will be represented in code by multiple flag-type enums. Is it preferable to store this data in a database record as the integer value of the enum instance, or should I have a separate field for each value and store either a zero or a one to indicate whether that field is in use?
The difficult we do right away... ...the impossible takes slightly longer.
-
I am going to have data that will be represented in code by multiple flag-type enums. Is it preferable to store this data in a database record as the integer value of the enum instance, or should I have a separate field for each value and store either a zero or a one to indicate whether that field is in use?
The difficult we do right away... ...the impossible takes slightly longer.
-
I am going to have data that will be represented in code by multiple flag-type enums. Is it preferable to store this data in a database record as the integer value of the enum instance, or should I have a separate field for each value and store either a zero or a one to indicate whether that field is in use?
The difficult we do right away... ...the impossible takes slightly longer.
-
Richard Andrew x64 wrote:
I [...] have data that will be represented in code by multiple flag-type enums.
..and what's the relational representation of the same data?
I are Troll :suss:
Well, I'm writing a rules engine and it will go something like this:
Where subject A, B, C, and/or D
performs function A, B, C, and/or D
raise alert A, B, C, and/or D.
And each record in the database will represent one rule. So the choices from A to D will be represented in code by flag enums. And I'm wondering if it's better to store each of the choices as the int value of the enum, or as separate fields.
The difficult we do right away... ...the impossible takes slightly longer.
-
Well, I'm writing a rules engine and it will go something like this:
Where subject A, B, C, and/or D
performs function A, B, C, and/or D
raise alert A, B, C, and/or D.
And each record in the database will represent one rule. So the choices from A to D will be represented in code by flag enums. And I'm wondering if it's better to store each of the choices as the int value of the enum, or as separate fields.
The difficult we do right away... ...the impossible takes slightly longer.
Then think of the typical searches you expect to perform on the data; that should tell you the most fitting answer. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Well, I'm writing a rules engine and it will go something like this:
Where subject A, B, C, and/or D
performs function A, B, C, and/or D
raise alert A, B, C, and/or D.
And each record in the database will represent one rule. So the choices from A to D will be represented in code by flag enums. And I'm wondering if it's better to store each of the choices as the int value of the enum, or as separate fields.
The difficult we do right away... ...the impossible takes slightly longer.