summaryrefslogtreecommitdiff
path: root/lang/sql/jdbc/testg.java
blob: a32942a1cef9071b8e9d0168d3c757eb66cc4574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import SQLite.Constants;
import SQLite.Database;
import SQLite.Exception;
import SQLite.Stmt;

public class testg {
    public static void main(String[] args) throws Exception {
	Database db = new Database();
	db.open(":memory:", Constants.SQLITE_OPEN_READWRITE);
	Stmt createTable = db.prepare("CREATE TABLE test (col1)");
	createTable.step();
	createTable.close();
	Stmt beginTx = db.prepare("BEGIN TRANSACTION");
	beginTx.step();
	beginTx.close();
	for (int i = 0; i < 1000000; i++) {
	    Stmt insert = db.prepare("INSERT INTO test VALUES ('whatever')");
	    insert.step();
	    insert.close();
	}
	Stmt commitTx = db.prepare("COMMIT TRANSACTION");
	commitTx.step();
	commitTx.close();
	db.close();
    }
}