Beispiel #1
0
  /**
   * Update BMK_BOOKMARK Data Bindding JavaBean
   *
   * @param bean BMK_BOOKMARK Data Bindding JavaBean
   * @param usrSid USR_SID
   * @return 更新件数
   * @throws SQLException SQL実行例外
   */
  public int updateMainKbn(BmkBookmarkModel bean, int usrSid) 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_MAIN=?,");
      sql.addSql("   BMK_SORT=?,");
      sql.addSql("   BMK_EUID=?,");
      sql.addSql("   BMK_EDATE=?");
      sql.addSql(" where ");
      sql.addSql("   BMK_SID=?");
      sql.addSql("   and");
      sql.addSql("   USR_SID=?");
      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(bean.getBmkMain());
      sql.addIntValue(bean.getBmkSort());
      sql.addIntValue(bean.getBmkEuid());
      sql.addDateValue(bean.getBmkEdate());
      // where
      sql.addIntValue(bean.getBmkSid());
      sql.addIntValue(usrSid);

      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      count = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
    return count;
  }
Beispiel #2
0
 /**
  * Create BMK_BOOKMARK Data Bindding JavaBean From ResultSet
  *
  * @param rs ResultSet
  * @return created BmkBookmarkModel
  * @throws SQLException SQL実行例外
  */
 private BmkBookmarkModel __getBmkBookmarkFromRs(ResultSet rs) throws SQLException {
   BmkBookmarkModel bean = new BmkBookmarkModel();
   bean.setBmkSid(rs.getInt("BMK_SID"));
   bean.setBmkKbn(rs.getInt("BMK_KBN"));
   bean.setUsrSid(rs.getInt("USR_SID"));
   bean.setGrpSid(rs.getInt("GRP_SID"));
   bean.setBmuSid(rs.getInt("BMU_SID"));
   bean.setBmkTitle(rs.getString("BMK_TITLE"));
   bean.setBmkCmt(rs.getString("BMK_CMT"));
   bean.setBmkScore(rs.getInt("BMK_SCORE"));
   bean.setBmkPublic(rs.getInt("BMK_PUBLIC"));
   bean.setBmkMain(rs.getInt("BMK_MAIN"));
   bean.setBmkSort(rs.getInt("BMK_SORT"));
   bean.setBmkAuid(rs.getInt("BMK_AUID"));
   bean.setBmkAdate(UDate.getInstanceTimestamp(rs.getTimestamp("BMK_ADATE")));
   bean.setBmkEuid(rs.getInt("BMK_EUID"));
   bean.setBmkEdate(UDate.getInstanceTimestamp(rs.getTimestamp("BMK_EDATE")));
   return bean;
 }
Beispiel #3
0
  /**
   * 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);
    }
  }