database design - Storing different parameter types in a single table -
I have a Java class in which there is an event in which some data is included, and a list of 'parameters' of different types There is also a lack of a better word I want to keep it in a database, and I am confused as the best approach.
In the attempt to clarify my rambles:
'Event', contains the hostname, port, date, service name, message of time, digest of certificate (byte array) , Etc.
I think the closest parallel is a printf format string and parameter (though it is not what I am doing). It is easy to store the format string, but it is difficult to store the parameters, because I will need to get them back to their original type after recovering them.
I am trying to extract a way to store parameters that will be of different types, should I encode them as some string format and put them in varchar (), then when I get the parameters of the event, so what to decode?
Storing everything in the form of code / string is a bad idea in my humble opinion if you have any If you need to store different data types in the database, then store them with the correct type. In this way your presentation can handle layer formatting.
Comments
Post a Comment