⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbcss.java

📁 BBS-CS(天乙社区) v5.2.2源码版
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      return Sys.RESULT_OBJECTEXCEPTION;
    }
    finally {
      if (aTranContext == null && myDBTrans != null) {
        myDBTrans.freeCon();
      }
    }
  }

  public int getCSS(TranContext aTranContext, String key, boolean isLoad) {
    TranContext myDBTrans = null;
    if (aTranContext == null) {
      myDBTrans = new TranContext();
    }
    else {
      myDBTrans = aTranContext;
    }
    try {
      this.loadDB(myDBTrans, key, isLoad);
      return Sys.RESULT_RIGHT;
    }
    catch (ObjectException e) {
      logger.error(e);
      return Sys.RESULT_OBJECTEXCEPTION;
    }
    catch (ObjectNoExistException e) {
      return Sys.RESULT_OBJECTNOEXISTEXCEPTION;
    }
    finally {
      if (aTranContext == null && myDBTrans != null) {
        myDBTrans.freeCon();
      }
    }
  }

  public void loadDB(TranContext myDB, String key, boolean isLoad) throws
      ObjectException, ObjectNoExistException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(LOAD_CSS_BYID);
        myDB.setLong(1, this.myCSSInfo.getID());
      }
      rs = myDB.executeQuery();
      if (rs.next()) {
        this.myCSSInfo.setID(rs.getLong("ID"));
        this.myCSSInfo.setLeftbgcolor(rs.getString("leftbgcolor"));
        this.myCSSInfo.setLetftextcolor(rs.getString("letftextcolor"));
        this.myCSSInfo.setRightbgcolor(rs.getString("rightbgcolor"));
        this.myCSSInfo.setRighttextcolor(rs.getString("righttextcolor"));
        this.myCSSInfo.setTablemaincolor(rs.getString("tablemaincolor"));
        this.myCSSInfo.setTabletintcolor(rs.getString("tabletintcolor"));
        this.myCSSInfo.setTabledarkcolor(rs.getString("tabledarkcolor"));
        this.myCSSInfo.setLeft_a(rs.getString("left_a"));
        this.myCSSInfo.setLeft_alink(rs.getString("left_alink"));
        this.myCSSInfo.setLeft_avisited(rs.getString("left_avisited"));
        this.myCSSInfo.setLeft_ahover(rs.getString("left_ahover"));
        this.myCSSInfo.setLeft_aactive(rs.getString("left_aactive"));
        this.myCSSInfo.setRight_a(rs.getString("right_a"));
        this.myCSSInfo.setRight_alink(rs.getString("right_alink"));
        this.myCSSInfo.setRight_avisited(rs.getString("right_avisited"));
        this.myCSSInfo.setRight_ahover(rs.getString("right_ahover"));
        this.myCSSInfo.setRight_aactive(rs.getString("right_aactive"));
      }
      else {
        throw new ObjectNoExistException();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public List loadDBs(TranContext myDB, String key) throws ObjectException {
    List alist = ListFactory.getInstance(2);
    CSSInfo aCSSInfo = null;
    try {
      if (key.equals("All")) {
        myDB.prepareStatement(LOAD_CSSS);
      }
      rs = myDB.executeQuery();
      while (rs.next()) {
        aCSSInfo = new CSSInfo();
        aCSSInfo.setID(rs.getLong("ID"));
        aCSSInfo.setLeftbgcolor(rs.getString("leftbgcolor"));
        aCSSInfo.setLetftextcolor(rs.getString("letftextcolor"));
        aCSSInfo.setRightbgcolor(rs.getString("rightbgcolor"));
        aCSSInfo.setRighttextcolor(rs.getString("righttextcolor"));
        aCSSInfo.setTablemaincolor(rs.getString("tablemaincolor"));
        aCSSInfo.setTabletintcolor(rs.getString("tabletintcolor"));
        aCSSInfo.setTabledarkcolor(rs.getString("tabledarkcolor"));
        aCSSInfo.setLeft_a(rs.getString("left_a"));
        aCSSInfo.setLeft_alink(rs.getString("left_alink"));
        aCSSInfo.setLeft_avisited(rs.getString("left_avisited"));
        aCSSInfo.setLeft_ahover(rs.getString("left_ahover"));
        aCSSInfo.setLeft_aactive(rs.getString("left_aactive"));
        aCSSInfo.setRight_a(rs.getString("right_a"));
        aCSSInfo.setRight_alink(rs.getString("right_alink"));
        aCSSInfo.setRight_avisited(rs.getString("right_avisited"));
        aCSSInfo.setRight_ahover(rs.getString("right_ahover"));
        aCSSInfo.setRight_aactive(rs.getString("right_aactive"));
        alist.add(aCSSInfo);
        aCSSInfo = null;
      }
      return alist;
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void insertDB(TranContext myDB) throws ObjectException {
    try {
      myDB.prepareStatement(INSERT_CSS);
      myDB.setLong(1, this.myCSSInfo.getID());
      myDB.setString(2, this.myCSSInfo.getLeftbgcolor());
      myDB.setString(3, this.myCSSInfo.getLetftextcolor());
      myDB.setString(4, this.myCSSInfo.getRightbgcolor());
      myDB.setString(5, this.myCSSInfo.getRighttextcolor());
      myDB.setString(6, this.myCSSInfo.getTablemaincolor());
      myDB.setString(7, this.myCSSInfo.getTabletintcolor());
      myDB.setString(8, this.myCSSInfo.getTabledarkcolor());
      myDB.setString(9, this.myCSSInfo.getLeft_a());
      myDB.setString(10, this.myCSSInfo.getLeft_alink());
      myDB.setString(11, this.myCSSInfo.getLeft_avisited());
      myDB.setString(12, this.myCSSInfo.getLeft_ahover());
      myDB.setString(13, this.myCSSInfo.getLeft_aactive());
      myDB.setString(14, this.myCSSInfo.getRight_a());
      myDB.setString(15, this.myCSSInfo.getRight_alink());
      myDB.setString(16, this.myCSSInfo.getRight_avisited());
      myDB.setString(17, this.myCSSInfo.getRight_ahover());
      myDB.setString(18, this.myCSSInfo.getRight_aactive());
      myDB.executeUpdate();
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (rs != null) {
          rs.close();
          rs = null;
        }
      }
      catch (SQLException e) {
      }
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void updateDB(TranContext myDB, String key) throws ObjectException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(UPDATE_CSS);
        myDB.setString(1, this.myCSSInfo.getLeftbgcolor());
        myDB.setString(2, this.myCSSInfo.getLetftextcolor());
        myDB.setString(3, this.myCSSInfo.getRightbgcolor());
        myDB.setString(4, this.myCSSInfo.getRighttextcolor());
        myDB.setString(5, this.myCSSInfo.getTablemaincolor());
        myDB.setString(6, this.myCSSInfo.getTabletintcolor());
        myDB.setString(7, this.myCSSInfo.getTabledarkcolor());
        myDB.setString(8, this.myCSSInfo.getLeft_a());
        myDB.setString(9, this.myCSSInfo.getLeft_alink());
        myDB.setString(10, this.myCSSInfo.getLeft_avisited());
        myDB.setString(11, this.myCSSInfo.getLeft_ahover());
        myDB.setString(12, this.myCSSInfo.getLeft_aactive());
        myDB.setString(13, this.myCSSInfo.getRight_a());
        myDB.setString(14, this.myCSSInfo.getRight_alink());
        myDB.setString(15, this.myCSSInfo.getRight_avisited());
        myDB.setString(16, this.myCSSInfo.getRight_ahover());
        myDB.setString(17, this.myCSSInfo.getRight_aactive());
        myDB.setLong(18, this.myCSSInfo.getID());
        myDB.executeUpdate();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

  public void delDB(TranContext myDB, String key) throws ObjectException {
    try {
      if (key.equals("ID")) {
        myDB.prepareStatement(DEL_CSS);
        myDB.setLong(1, this.myCSSInfo.getID());
        myDB.executeUpdate();
      }
    }
    catch (SQLException e) {
      throw new ObjectException(e.toString());
    }
    finally {
      try {
        if (myDB != null) {
          myDB.close();
        }
      }
      catch (SQLException e) {
      }
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -