I have a MySql database table as shown below:
This table stores language-based text used for various pages in a web application. I have translated text for multiple languages and multiple pages, stored in a JSON file in the following format:
[ ["home","fr",1,"French text item 1"] ["home","fr",2,"French text item 2"] ["home","fr",3,"French text item 3"] ["home","fr",4,"French text item 4"] ["home","fr",5,"French text item 5"] ]
Each JSON document contains data for a specific language and a specific web page.
I have a lot of data to insert and I'm trying to find an efficient way to add this data to my database. I'm assuming using a stored procedure is the best way, but I can't find any tutorials that cover looping through an array like this and inserting.
Is it possible to pass such an array to a stored procedure and loop through it, inserting row by row?
Any help would be greatly appreciated.
fiddle