/** * Update BMK_BOOKMARK Data Bindding JavaBean * * @param bean BMK_BOOKMARK Data Bindding JavaBean * @return 更新件数 * @throws SQLException SQL実行例外 */ public int update(BmkBookmarkModel bean) throws SQLException { PreparedStatement pstmt = null; int count = 0; Connection con = null; con = getCon(); try { // SQL文 SqlBuffer sql = new SqlBuffer(); sql.addSql(" update"); sql.addSql(" BMK_BOOKMARK"); sql.addSql(" set "); sql.addSql(" BMK_TITLE=?,"); sql.addSql(" BMK_CMT=?,"); sql.addSql(" BMK_SCORE=?,"); sql.addSql(" BMK_PUBLIC=?,"); sql.addSql(" BMK_MAIN=?,"); sql.addSql(" BMK_EUID=?,"); sql.addSql(" BMK_EDATE=?"); sql.addSql(" where "); sql.addSql(" BMK_SID=?"); pstmt = con.prepareStatement(sql.toSqlString()); sql.addStrValue(bean.getBmkTitle()); sql.addStrValue(bean.getBmkCmt()); sql.addIntValue(bean.getBmkScore()); sql.addIntValue(bean.getBmkPublic()); sql.addIntValue(bean.getBmkMain()); sql.addIntValue(bean.getBmkEuid()); sql.addDateValue(bean.getBmkEdate()); // where sql.addIntValue(bean.getBmkSid()); log__.info(sql.toLogString()); sql.setParameter(pstmt); count = pstmt.executeUpdate(); } catch (SQLException e) { throw e; } finally { JDBCUtil.closeStatement(pstmt); } return count; }
/** * Insert BMK_BOOKMARK Data Bindding JavaBean * * @param bean BMK_BOOKMARK Data Bindding JavaBean * @throws SQLException SQL実行例外 */ public void insert(BmkBookmarkModel bean) throws SQLException { PreparedStatement pstmt = null; Connection con = null; con = getCon(); try { // SQL文 SqlBuffer sql = new SqlBuffer(); sql.addSql(" insert "); sql.addSql(" into "); sql.addSql(" BMK_BOOKMARK("); sql.addSql(" BMK_SID,"); sql.addSql(" BMK_KBN,"); sql.addSql(" USR_SID,"); sql.addSql(" GRP_SID,"); sql.addSql(" BMU_SID,"); sql.addSql(" BMK_TITLE,"); sql.addSql(" BMK_CMT,"); sql.addSql(" BMK_SCORE,"); sql.addSql(" BMK_PUBLIC,"); sql.addSql(" BMK_MAIN,"); sql.addSql(" BMK_SORT,"); sql.addSql(" BMK_AUID,"); sql.addSql(" BMK_ADATE,"); sql.addSql(" BMK_EUID,"); sql.addSql(" BMK_EDATE"); sql.addSql(" )"); sql.addSql(" values"); sql.addSql(" ("); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?"); sql.addSql(" )"); pstmt = con.prepareStatement(sql.toSqlString()); sql.addIntValue(bean.getBmkSid()); sql.addIntValue(bean.getBmkKbn()); sql.addIntValue(bean.getUsrSid()); sql.addIntValue(bean.getGrpSid()); sql.addIntValue(bean.getBmuSid()); sql.addStrValue(bean.getBmkTitle()); sql.addStrValue(bean.getBmkCmt()); sql.addIntValue(bean.getBmkScore()); sql.addIntValue(bean.getBmkPublic()); sql.addIntValue(bean.getBmkMain()); sql.addIntValue(bean.getBmkSort()); sql.addIntValue(bean.getBmkAuid()); sql.addDateValue(bean.getBmkAdate()); sql.addIntValue(bean.getBmkEuid()); sql.addDateValue(bean.getBmkEdate()); log__.info(sql.toLogString()); sql.setParameter(pstmt); pstmt.executeUpdate(); } catch (SQLException e) { throw e; } finally { JDBCUtil.closeStatement(pstmt); } }