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.OutboxDeleteAllQuery.java

/**
 *   This method deletes profile of the user 
 *   @param conn - the connection// ww  w .  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 outbox where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        logger.warn("Error occured while executing  outbox query ", e);
        throw new BaseDaoException("Error occured while executing outbox query ", e);
    }
}

From source file:dao.CollBlockDeleteAllQuery.java

/**
 * This method deletes blocked members in a collabrum
 * This method can be invoked only either the admins or the authors/moderators
 * @param conn the connection/*from  w  w w  .  j  av a2s .  com*/
 * @param collabrumid
 * @exception BaseDaoException
 */
public void run(Connection conn, String collabrmid) throws BaseDaoException {

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

From source file:dao.CollMemberBlockDeleteQuery.java

/**
 *   This method deletes profile of the user 
 *   @param conn - the connection//from  ww  w . j  a v  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 collblock where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing collblock query ", e);
    }
}

From source file:dao.CobrandSiteDeleteQuery.java

/**
 *   This method deletes vhosts cobrand 
 *   @param conn - the connection/*from  w  w w . j a va2  s . c om*/
 *   @param vhostid - the vhostid
 *   @throws BaseDaoException - when error occurs
 **/
public void run(Connection conn, String vhostid) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete LOW_PRIORITY from vhosts where entryid=" + vhostid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        logger.warn("Error occured while executing vhost query ", e);
        throw new BaseDaoException("Error occured while executing vhost query ", e);
    }
}

From source file:dao.ColStreamBlobDeleteAllQuery.java

/**
 * @param conn the connection//from w w w . j  ava 2 s  .  co m
 * @param ridStr the reply id
 * @param memberid the id of the member
 * @exception BaseDaoException
 */
public void run(Connection conn, String collabrumId) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from collblob where collabrumid=" + collabrumId + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        logger.warn("ColStreamblobDeleteAllQuery" + collabrumId);
        throw new BaseDaoException(
                "Error occured in dbquery, delete from collblob where collabrumid = " + collabrumId, e);
    }
}

From source file:dao.ContactDeleteAllQuery.java

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

From source file:dao.PblogAddQuery.java

/**
 * This method is not called by spring.//  w  w w.  j  a v  a 2s  .c o m
 *
 * @param conn the connection passed to this.
 * @param pblogid the pblogid (the loginid of this personal blog)
 * @exception BaseDaoException
 */
public void run(Connection conn, String pblogid, String fname) throws BaseDaoException {
    try {
        PreparedStatement query = conn
                .prepareStatement("insert into pblog values(" + pblogid + ", '" + fname + "', 0)");
        query.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured executing pblog add", e);
    }
}

From source file:dao.UserDeleteCobrandQuery.java

/**
 *   This method deletes user cobrand /*from  www. j a  v  a  2 s. c  o m*/
 *   @param conn - the connection
 *   @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 usercobrand where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing usercobrand query ", e);
    }
}

From source file:dao.DirImagesDeleteAllQuery.java

/**
 * This method deletes images for a directory
 * This method can be invoked only either the admins or the authors of this directory
 * @param conn the connection/* w ww .  j a v  a2 s.  c  o  m*/
 * @param cid the category id
 * @param ownerid the id of the owner
 * @exception BaseDaoException
 */
public void run(Connection conn, String directoryId) throws BaseDaoException {

    try {
        PreparedStatement stmt = conn
                .prepareStatement("delete from dirimages where directoryid=" + directoryId + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error executing db query, delete from dirimages where directoryid="
                + directoryId + " Error=" + e.getMessage(), e);
    }
}

From source file:dao.PblogMsgAttrDeleteAllQuery.java

/**
 *   This method deletes pblog msg attributes of the user 
 *   @param conn - the connection/*from w  w  w. j a  va 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 pblogmsgattr where loginid=" + loginid + "");
        stmt.executeUpdate();
    } catch (Exception e) {
        throw new BaseDaoException("Error occured while executing pblog query ", e);
    }
}