Solution 1
Gcanhete, the ideal is to review your database modeling, there should be a clean way to store the data in the database, preferably following the first 3 formal standards.
I understand that the way you want to do it now you are wanting to store a database row for each group and comment, however this is not sustainable, for example, what size field you will use to accommodate this data, what you will do when there are more comments than you expect?
The ideal is to store so that each comment has its own record, with all relevant information to them.
If the problem is performance ai is the case of adjusting at other points (indices, cache, etc).
If you still want to store the array inside the database you still have options:
- Fully store (pass array to string and store it)
- In this case you still have the benefits of being able to search and change and can be direct in SQL as in other languages (for Apis for example).
- Serial storage (go through serialization)
- You lose some of the ability to edit and read, since any error can invalidate the information.
- Encoding with Base64 or other reversible algorithms.
Solution 2
Another option if you want to store a data structure that is not rigid (like a relational database) is to use Nosql databases like Redis and Mongodb, where you can pass your entire arrays for persistence.
In this second case you can store them and recover them practically ready for use.
Not possible. What problem with serializing?
– Papa Charlie
Do you think it takes more trouble to serialize than to create a POG? If you turn an array into a string using the types of information you want, it will be IMPOSSIBLE to reverse the process assuming that the comments will ensure the use of any char by the user.
– Papa Charlie