0

React client is sending color to my server with this format {"r":1 "g":8 "b":5 "a":2}, for instance.

I'm not sure what is the best way to record color in MySQL.

I don't want to use this data in server. Just I want to send it to the client with the same format.

closed as unclear what you're asking by mustaccio, Max Vernon, RDFozz, LowlyDBA, Mr.Brownstone Nov 15 '18 at 0:12

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Further to the first comment, how are you filtering/joining/sorting/grouping by r,g,b values? Are you doing maths operations on them? – danblack Nov 14 '18 at 21:29
3

If "you want to send it to the client with the same format", then it is reasonable to treat it as "opaque".

That is, store it as a string with no meaning or structure that you care about. And it does not matter (within limits) what datatype you use. VARCHAR(99), TEXT, BLOB -- any of these would suffice.

Not the answer you're looking for? Browse other questions tagged or ask your own question.