A large amount of test data needs to be inserted into the sqlite database and the transaction is intended to be inserted cyclically. However, sqlite does not support the definition of the declare variable, so it cannot be achieved by defining the cyclic variable value.
You need to use a batch processing file to repeatedly call the insert sqlite statement. The method is as follows:
Create a batch file named sqlite. bat that is called cyclically.Copy codeThe Code is as follows: @ ECHO OFF
For/L % I in (10000,) do (sqlite3.exe test. db <insertdb. bat)
Pause
This file indicates that loop 10000 calls insertdb. bat to operate the test. db database. Write the sqlite statement in the insertdb. bat file.Copy codeThe Code is as follows: insert into test (col1, col2, col3, col4, col5, col6, col7 ,)
Values
('Col1', 'col2', 'col3', 'col4', 'col5', 6, 7 );
Note: The SQL statement in the insertdb. bat file must end with a semicolon; otherwise, sqlite execution may fail. Sqlite. bat, insertdb. bat, and test. db files must be stored in the same directory.