Create a SQLite database with a script
Create the following two files in turn:
1) One bat file: Script.bat
@ECHO offc:cd%homepath%/desktopsqlite3 test_db. DB < A.sqlsqlite3 test_db. DB. Dump > Result.sql
The Sqlite3 program can be downloaded from SQLite's official website to
2) A SQL file: A.sql, which stores the SQLite library script, as in the following example:
--sqlite script a.sql--Creating PERSONS class Create TABLE PERSONS (ID INTEGER PRIMARY KEY, NAME TEXT not NULL COLLATE nocase, SEX CHAR not NULL, age INTEGER, TEL TEXT); Insert into PERSONS (name, sex, age, TEL) VALUES (' Tsybius ', ' M ', +, ' 12345678901 '); insert into PERSONS (name, sex, A GE, TEL) VALUES (' GALATEA ', ' F ', 21, ' 98765432109 '); . Quit
You can create a database test_db by double-clicking Script.bat. DB, back up the established database to file Result.sql
The database created by the statement in A.sql will be saved in the Result.sql form as follows
PRAGMA Foreign_keys=off; BEGIN TRANSACTION; CREATE TABLE PERSONS (ID INTEGER PRIMARY KEY, NAME TEXT not null COLLATE nocase, SEX CHAR isn't null, age Intege R, TEL TEXT); insert into PERSONS values (1, ' Tsybius ', ' M ', +, ' 12345678901 '); insert into PERSONS values (2, ' GALATEA ', ' F ', 2 1, ' 98765432109 '); COMMIT;
Set up a good database, you can use SQLiteSpy.exe software to view
END
Windows builds SQLite database by script