Example #1
0
  private static void initChannelRemappingIndex(int startIndex, int endIndex, int programNum)
      throws DaoException {

    Statement statement = null;
    Connection conn = DaoSupport.getJDBCConnection();

    // 取得相关节目频点信息
    // insert into channelscanlist(Freq, QAM, SymbolRate, Program, ServiceID, VideoPID, AudioPID,
    // EncryptFlg, HDTV, ScanTime, LastTime, LastFlag)

    // SELECT max(channelindex) FROM channelremapping c;

    int channelNum = getMaxChannelIndex() + 1;

    if (startIndex == 2 && channelNum == 1) {
      channelNum = 2;
    }

    StringBuffer strBuff = null;
    try {
      for (int i = startIndex; i < endIndex; i++) {

        for (int j = 0; j < programNum; j++) {

          strBuff = new StringBuffer();
          strBuff.append("insert into transmit.channelremapping(DevIndex, channelindex) values (");
          strBuff.append(i + ", " + (channelNum) + ")");

          log.info("indexNum: " + (channelNum) + "\t devNum: " + (i));

          try {
            statement = conn.createStatement();
            statement.execute(strBuff.toString());
          } catch (Exception ex) {
            log.error("自动录像 更新通道映射表错误: " + ex.getMessage());
            log.error("错误SQL: " + strBuff.toString());
          }
          channelNum++;
          strBuff = null;
        }
      }
    } catch (Exception e) {
      log.error("自动录像 更新通道映射表错误: " + e.getMessage());
      log.error("错误SQL: " + strBuff.toString());
      strBuff = null;
    } finally {
      DaoSupport.close(statement);
      DaoSupport.close(conn);
    }
  }
Example #2
0
  private static boolean delChannelIndex(int devIndex) throws DaoException {

    Statement statement = null;
    Connection conn = DaoSupport.getJDBCConnection();
    boolean ret = false;
    StringBuffer strBuff = new StringBuffer();
    // 取得相关节目频点信息
    strBuff.append("delete from channelremapping where DevIndex= " + devIndex);

    try {
      statement = conn.createStatement();
      ret = statement.execute(strBuff.toString());
    } catch (Exception e) {
      log.error("取得节目号错误: " + e.getMessage());
    } finally {
      DaoSupport.close(statement);
      DaoSupport.close(conn);
    }
    strBuff = null;
    return ret;
  }
Example #3
0
  private static int getMaxChannelIndex() throws DaoException {
    int maxChannel = 0;

    Statement statement = null;
    Connection conn = DaoSupport.getJDBCConnection();

    ResultSet rs = null;

    StringBuffer strBuff = new StringBuffer();
    // 取得相关节目频点信息
    strBuff.append("SELECT max(channelindex) FROM channelremapping c");

    try {
      statement = conn.createStatement();

      rs = statement.executeQuery(strBuff.toString());

      while (rs.next()) {
        try {
          maxChannel = Integer.parseInt(rs.getString("max(channelindex)"));
        } catch (Exception ex) {
        }
      }

    } catch (Exception e) {
      log.error("取得节目号错误: " + e.getMessage());
    } finally {
      DaoSupport.close(rs);
      DaoSupport.close(statement);
    }
    strBuff = null;

    DaoSupport.close(conn);

    return maxChannel;
  }