The SQLite does not support below insert SQL statement:
INERT INTO table(col1, col2, ..., coln) VALUES (1v1, 1v2, ..., 1vn), (2v1, 2v2, ..., 2vn), (3v1, 3v2, ..., 3vn), ..., (nv1, nv2, ..., nvn);
This is the solution:
INSERT INTO table(col1, col2, ..., coln)
SELECT 1v1, 1v2, ..., 1vn UNION ALL SELECT 2v1, 2v2, ..., 2vn UNION ALL SELECT 3v1, 3v2, ..., 3vn ... UNION ALL SELECT nv1, nv2, ..., nvn;
Recently, I handled a project that every 50 millisecond or 20 millisecond the main process would receive a message to insert a record into DB.
It is strange that the DB function was called successfully, but the messages of main process were blocked, which lead the main window blocked.
It took me much time to find the reason. but i got nothing.
Then I thought maybe something was being blocked in SQLite Lib, when "insert operating" so frequently executed.
Why not insert multiple records into the DB one time??
So, I write a thread to handle it. insert records to DB every 5 second.