I'm trying to insert many different rows into an sqlite database using a single operation. Each of the rows has multiple columns, and I have the data represented as an array of arrays.
I've read the user guide and other tutorials, but all the ones that mention inserting multiple rows work for rows with only a single column.
I'm trying to insert a much larger array, but for testing it I've broken it down into two entries.
let testArtist = [["string", 1, 2, "string"], ["string", 3, 4, "string"]];
let artistQuery = "INSERT INTO artists (artist, numSongs, numAlbums, picture) VALUES (?, ?, ?, ?), (?, ?, ?, ?)";
db.serialize(
db.run(artistQuery, [testArtist], function(err){
if(err) throw err;
});
});
Here's the results of the insert operation
select * from artists;
1||||
2||||
So the AUTOINCREMENT
integer ID is being inserted, but the data is not.