Esempio n. 1
0
 /**
  * 保存自选股配置信息
  *
  * @param selfSelectedCodeInfo
  * @throws SQLException
  */
 public void saveSelfSelectedCode(SelfSelectedCodeInfo selfSelectedCodeInfo) throws SQLException {
   Connection conn = null;
   PreparedStatement psmt = null;
   try {
     conn = DbConnectionManager.getDbConneciton();
     if (selfSelectedCodeInfo.getCodekind().equalsIgnoreCase("selfselectedcode")) {
       psmt = conn.prepareStatement(SET_SELFSELECTED);
       psmt.setString(1, selfSelectedCodeInfo.getUserID());
       psmt.setString(2, selfSelectedCodeInfo.getCodeConfig());
       psmt.executeUpdate();
     }
   } catch (Exception e1) {
     e1.printStackTrace();
   } finally {
     conn.close();
     psmt.close();
   }
 }
Esempio n. 2
0
 /**
  * 获取自选股配置信息
  *
  * @param selfSelectedCodeInfo
  * @return
  * @throws SQLException
  */
 public String getSelfSelectedCode(SelfSelectedCodeInfo selfSelectedCodeInfo) throws SQLException {
   String result = "";
   Connection conn = null;
   PreparedStatement psmt = null;
   ResultSet resultSet = null;
   try {
     conn = DbConnectionManager.getDbConneciton();
     psmt = conn.prepareStatement(GET_SELFSELECTED);
     psmt.setString(1, selfSelectedCodeInfo.getUserID());
     resultSet = psmt.executeQuery();
     while (resultSet.next()) {
       result = resultSet.getString(2);
     }
   } catch (Exception e1) {
     e1.printStackTrace();
   } finally {
     conn.close();
     psmt.close();
     resultSet.close();
   }
   return result;
 }