I have a number of Strings that I have to store in a DB that I'd like to split using String.split method later. However, I'm concerned about delimiter collisions since at least one field could contain any character and the number of fields may vary. I was thinking of using just a delimiter with an improbable set of characters. But I'm not sure if it is appropiate.
are there any other tricks you can think of?
thanks in advance
Don't store strings in the database that you're going to split. If you have a 1:N relationship, model it with a database table that has a column with a unique key on the 1 side, and a second free-form column for the N side.
If nothing will convince you not to shove lists into DB columns, then maybe use an integrity constraint to make sure that the values in the column have the expected format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With