Java SQL PreparedStatement deleteOldData(Connection connection, PreparedStatement stmt, String funcId)

Here you can find the source of deleteOldData(Connection connection, PreparedStatement stmt, String funcId)

Description

delete Old Data

License

Open Source License

Declaration

private static void deleteOldData(Connection connection, PreparedStatement stmt, String funcId)
            throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.PreparedStatement;

public class Main {
    private final static String DELETE_PARAM_SQL = "delete from P_S_PARAM_SQL t where t.param_id in (select p.param_id from p_s_param p where p.func_id = ?)";
    private final static String DELETE_PARAM_CRITERIA = "delete from P_S_PARAM_CRITERIA t where t.sql_id in (select s.sql_id from p_s_sqlarea s where s.func_id = ?)";
    private final static String DELETE_PARAM = "delete from P_S_PARAM t where t.func_id = ?";
    private final static String DELETE_COLUMN = "delete from P_S_COLUMN t where t.func_id = ?";
    private final static String DELETE_SQLAREA = "delete from P_S_SQLAREA t where t.func_id = ?";
    private final static String DELETE_BLOCK = "delete from P_S_BLOCK t where t.func_id = ?";
    private final static String DELETE_FUNC = "delete from P_S_FUNC t where t.func_id = ?";
    private final static String DELETE_BLOCK_CHART = "delete from P_S_BLOCK_CHART t where t.func_id = ?";
    private final static String DELETE_BLOCK_MTABLE = "delete from P_S_BLOCK_MTABLE t where t.func_id = ?";
    private final static String DELETE_BLOCK_CUSTOMISE = "delete from P_S_BLOCK_CUSTOMIZE t where t.func_id = ?";

    private static void deleteOldData(Connection connection, PreparedStatement stmt, String funcId)
            throws Exception {
        stmt = connection.prepareStatement(DELETE_PARAM_SQL);
        stmt.setString(1, funcId);/*  ww w . ja  v  a2  s .  c  om*/
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_PARAM_CRITERIA);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_PARAM);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_PARAM_SQL);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_COLUMN);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_SQLAREA);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_BLOCK);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_FUNC);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_BLOCK_CHART);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_BLOCK_MTABLE);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

        stmt = connection.prepareStatement(DELETE_BLOCK_CUSTOMISE);
        stmt.setString(1, funcId);
        stmt.executeUpdate();

    }
}

Related

  1. closeStatement(PreparedStatement ps)
  2. closeStatement(PreparedStatement theStatement)
  3. createInsertPrepareStatement(Connection conn, String tableName, String[] dataColumnNames)
  4. createPreparedStatement(Connection conn, String sql, String[] args)
  5. createProjectInfo(PreparedStatement ps, long projectId, long projectInfoTypeId, String value, long modUserId)
  6. fillArgs(Object[][] args, PreparedStatement pstmt, int i)
  7. fillInClause(PreparedStatement ps, int startIndex, Collection clauses, int sqlType)
  8. fillParameters(PreparedStatement stmt, List params)
  9. fillPreparedStatementParams(PreparedStatement ps, Object... obj)

  10. HOME | Copyright © www.java2s.com 2016