List of usage examples for java.sql PreparedStatement executeUpdate
int executeUpdate() throws SQLException;
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. From source file:dao.CarryonDefaultAddQuery.java
/** * Adds keywords for a given user/*from ww w.j ava2 s.co m*/ * @param conn - the connection * @param yourKeyword - your keywords * @param loginid - the loginid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String entryid, String loginid) throws BaseDaoException { Long myloginid = new Long(loginid); try { PreparedStatement stmt = conn .prepareStatement("insert into defcarryon values(" + myloginid + ", '" + entryid + "')"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing CarryonDefaultAddQuery ", e); throw new BaseDaoException("Error occured while executing CarryonDefaultAddQuery ", e); } }
From source file:dao.DisplaypageDeleteQuery.java
/** * This method deletes profile of the user * @param conn - the connection/*from ww w.j a v a 2 s. 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 displayuser where loginid=" + loginid + " limit 1"); stmt.executeUpdate(); } catch (Exception e) { throw new BaseDaoException("Error occured while executing displayuser query ", e); } }
From source file:dao.DirectoryDeleteCobrandQuery.java
/** * This method deletes yourkeywords //from w ww. j a v a 2 s .c om * @param conn - the connection * @param directoryid - the directoryid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String directoryid) throws BaseDaoException { try { PreparedStatement stmt = conn .prepareStatement("delete LOW_PRIORITY from dircobrand where directoryid=" + directoryid + ""); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing dircobrand query ", e); throw new BaseDaoException("Error occured while executing dircobrand query ", e); } }
From source file:dao.DisplaypagePhotosUpdateQuery.java
public void run(Connection conn, int displayPhoto, String loginid) throws BaseDaoException { try {//from w w w . j a v a 2 s .c om PreparedStatement stmt = conn.prepareStatement( "update displayuser set photos=" + displayPhoto + " where loginid=" + loginid + ""); stmt.executeUpdate(); } catch (Exception e) { throw new BaseDaoException("Error occured while updating 'set photos' in displayuser table.", e); } }
From source file:adept.kbapi.sql.QuickJDBC.java
/** * execute database update/*from ww w . j a va2 s.co m*/ */ public void executeSqlUpdate(PreparedStatement preparedStmt) throws SQLException { try { preparedStmt.executeUpdate(); } finally { preparedStmt.close(); } }
From source file:dao.CollabrumDeleteCobrandQuery.java
/** * This method deletes collabrum cobrand * @param conn - the connection/* w w w. j av a 2s. c o m*/ * @param collabrumid - the collabrumid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String collabrumid) throws BaseDaoException { try { PreparedStatement stmt = conn .prepareStatement("delete LOW_PRIORITY from collcobrand where collabrumid=" + collabrumid + ""); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing collcobrand query ", e); throw new BaseDaoException("Error occured while executing collcobrand query ", e); } }
From source file:dao.ColStreamBlobDeleteQuery.java
/** * @param conn the connection/* w w w.ja v a 2 s .co m*/ * @param ridStr the reply id * @param memberid the id of the member * @exception BaseDaoException */ public void run(Connection conn, String entryid) throws BaseDaoException { try { PreparedStatement stmt = conn .prepareStatement("delete LOW_PRIORITY from collblob where entryid=" + entryid + " limit 1"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing db query ", e); throw new BaseDaoException("Error occured in dbquery, delete from collblob where entryid = " + entryid, e); } }
From source file:dao.DefaultDirectoryBlobAddQuery.java
/** * Adds keywords for a given user/*from w w w . j av a 2 s .c o m*/ * @param conn - the connection * @param yourKeyword - your keywords * @param loginid - the loginid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String entryid, String directoryid) throws BaseDaoException { //Long dirId = new Long(directoryid); try { PreparedStatement stmt = conn .prepareStatement("insert into defdirblob values(" + directoryid + ", '" + entryid + "')"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing DefaultDirectoryBlobAddQuery ", e); throw new BaseDaoException("Error occured while executing DefaultDirectoryBlobAddQuery ", e); } }
From source file:dao.PblogMessageDeleteAllQuery.java
/** * Deletes all pblog messages/*from w w w .jav a2 s . co m*/ * @param conn the connection * @param memberid the id of the member * @exception BaseDaoException */ public void run(Connection conn, String memberid) throws BaseDaoException { /** * delete all pblogmessages belonging to this user */ try { PreparedStatement stmt = conn .prepareStatement("delete LOW_PRIORITY from pblogmessages where ownerid='" + memberid + "'"); stmt.executeUpdate(); } catch (Exception e) { throw new BaseDaoException("Error in query, delete from pblogmessages where ownerid=" + memberid, e); } }
From source file:dao.ContactTagDeleteQuery.java
/** * This method deletes usertags /*from ww w. j av a 2 s.c om*/ * @param conn - the connection * @param contactid - the contactid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String contactid) throws BaseDaoException { try { PreparedStatement stmt = conn.prepareStatement( "delete LOW_PRIORITY from contactstag where contactid=" + contactid + " limit 1"); stmt.executeUpdate(); } catch (Exception e) { throw new BaseDaoException("Error occured while executing contactstag query ", e); } }