Xojo Array saved to Database

Is there a way to store and retrieve an array into a mySQL database without saving each element as a record?

say I have the following:



I know I can loop thru the array and add it to the Database, but is there a simple way to store it as a BLOB or something? If so what datatype do I use I’m MySql?

You could save it as a string by joining the array with an unusual delimiter

Dim s as String = Join(MyStringArray, "!")

When you read it back just split on the same delimiter


Dim s as String = Join(MyStringArray, Chr(30)) // Using the ASCII “Record Separator” char adds a bit extra meaning

Just be sure to use a character that will never occur in the array elements. If not feasible, you should escape the character before doing the join. I will add, though, that it is generally bad database design. With the right structure and a few helper methods, doing it a more db centric way shouldn’t be that time consuming. Maybe you can share a bit more about your structure?