Skip to content

houtaroy/sqlite-jdbc

 
 

Repository files navigation

Houtaroy SQLite JDBC Driver

本项目fork自SQLite JDBC Driver

拓展功能

执行批量SQL

public class Batch {
    public void batch() throws SQLException {
        Connection connection = DriverManager.getConnection("jdbc:sqlite:/database.db");
        PreparedStatement batch = connection.prepareStatement("delete from batch;insert into batch values (?);")
        // 事务
        PreparedStatement transactionBatch = connection.prepareStatement(
            "begin transaction;delete from batch;insert into batch values (?);commit;"
        )
        batch.execute();
        transactionBatch.execute();
        connection.close()
    }
}

使用ORM框架时, 如已自动开启事务, 请不要书写begin transactioncommit

About

SQLite JDBC Driver

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 67.4%
  • C++ 16.5%
  • C 8.1%
  • Shell 7.2%
  • Makefile 0.8%