Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.sql.PreparedStatement;

import java.sql.SQLException;

public class Main {
    public static void execute_delete_stmt(PreparedStatement pstmt, int[] indexes) throws SQLException {
        int cnt = 0;
        for (int i = 0; i < indexes.length; i++) {

            pstmt.setInt(1, indexes[i]);
            pstmt.addBatch();
            cnt++;
            if (cnt > 5000) {
                pstmt.executeBatch();
                cnt = 0;
            }
        }
        if (cnt > 0)
            pstmt.executeBatch();
    }
}