Example usage for java.sql PreparedStatement executeUpdate

List of usage examples for java.sql PreparedStatement executeUpdate

Introduction

In this page you can find the example usage for java.sql PreparedStatement executeUpdate.

Prototype

int executeUpdate() throws SQLException;

Source Link

Document

Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.

Usage

From source file:dao.DeleteColBlobTagsQuery.java

/**
 * This method is used to delete a blobtags in a collabrum
 * @param conn the connection//from  w ww.j a v  a2 s  . co m
 * @param cid the collabrum id
 * @exception BaseDaoException
 */
public void run(Connection conn, String cid) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from collblobtags where collabrumid=" + cid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException(
                "Error while executing db query, delete from collblobtags where collabrumid=" + cid, e);
    }
}

From source file:dao.DeleteColBlogTagsQuery.java

/**
 * This method is used to delete a blogtags in a collabrum
 * @param conn the connection//from w  w  w  . j a va  2 s. co m
 * @param cid the collabrum id
 * @exception BaseDaoException
 */
public void run(Connection conn, String cid) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from collblogtags where collabrumid=" + cid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException(
                "Error while executing db query, delete from collblogtags where collabrumid=" + cid, e);
    }
}

From source file:dao.InboxDeleteAllQuery.java

/**
 *   This method deletes profile of the user 
 *   @param conn - the connection/* w w  w  .ja v  a 2s .  c o m*/
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String loginid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete LOW_PRIORITY from inbox where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing inbox query ", e);
    }
}

From source file:dao.PblogDeleteQuery.java

/**
 *   This method deletes profile of the user 
 *   @param conn - the connection/*from  w ww  .  j av a 2  s.c  o  m*/
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String loginid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete LOW_PRIORITY from pblog where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing pblog query ", e);
    }
}

From source file:dao.DeleteCollabrumIndexQuery.java

/**
 * This method is used to delete a collabrumId in a collabrum_ind
 * @param conn the connection/*from  w w  w .  j  av a  2  s . c  o m*/
 * @param cid the collabrum id
 * @exception BaseDaoException
 */
public void run(Connection conn, String cid) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from collabrum_ind where collabrumid=" + cid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException(
                "Error while executing db query, delete from collabrum_ind where collabrumid=" + cid, e);
    }
}

From source file:dao.DirectoryAllowDeleteAllQuery.java

/**
 *   This method deletes a user from blocked directory
 *   @param conn - the connection/*from  w  ww. ja v a2s.  c o m*/
 *   @param directoryid - the directoryid
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String directoryid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from dirallow where directoryid=" + directoryid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error deleting DirectoryAllowDeleteAllQuery , directoryid = " + directoryid,
                e);
    }
}

From source file:dao.DirectoryBlockDeleteAllQuery.java

/**
 *   This method deletes a user from blocked directory
 *   @param conn - the connection//  w  w w.  ja v a 2s . c  o  m
 *   @param directoryid - the directoryid
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String directoryid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from dirblock where directoryid=" + directoryid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error deleting DirectoryBlockDeleteAllQuery , directoryid = " + directoryid,
                e);
    }
}

From source file:dao.CarryonDefaultDeleteQuery.java

/**
 *   This method deletes defcarryon /*from  w w  w.  ja v  a 2  s  . co m*/
 *   @param conn - the connection
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 *   Used as part of the transaction, skip LOW_PRIORITY
 **/
public void run(Connection conn, String loginid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from defcarryon where loginid=" + loginid + " limit 1");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing defcarryon query ", e);
    }
}

From source file:dao.CarryonDeleteAllQuery.java

/**
 *   This method deletes profile of the user 
 *   @param conn - the connection/*from w ww.ja  v  a  2s  .  c  om*/
 *   @param loginid - the loginid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String loginid) throws BaseDaoException {
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete LOW_PRIORITY from carryon where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing carryon query ", e);
    }
}

From source file:dao.DeleteColBlockedMembersQuery.java

/**
 * Deletes all collabrum message belonging to tid 
 * @param conn the connection//from  www  .  ja  v a  2s  .  c o  m
 * @param loginIdStr the loginId
 * @param isAdmin - true if the user is a DiaryAdmin or a Moderator for this collabrum
 * @exception BaseDaoException
 */
public void run(Connection conn, String loginIdStr) throws BaseDaoException {

    //Integer loginId = new Integer(loginIdStr);
    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from collblock where loginid=" + loginIdStr + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        logger.warn("Error occured while executing db query ", e);
        throw new BaseDaoException("Error occured while executing db query ", e);
    }
}