/**
   * 准备数据查询条件
   *
   * @param strSQL String
   * @return boolean
   */
  public boolean prepareData(String strSQL) {
    if (mResultSet != null) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = "数据集非空,程序在准备数据集之后,没有关闭!";
      this.mErrors.addOneError(tError);
      return false;
    }

    if (!mflag) {
      con = DBConnPool.getConnection();
    }
    try {
      mStatement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      mResultSet = mStatement.executeQuery(StrTool.GBKToUnicode(strSQL));
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);
      try {
        mResultSet.close();
      } catch (Exception ex2) {
      }
      try {
        mStatement.close();
      } catch (Exception ex3) {
      }
      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }
    return true;
  }
 /**
  * 获取定量数据
  *
  * @return LEDEPolicyMailInfoSet
  */
 public LEDEPolicyMailInfoSet getData() {
   int tCount = 0;
   LEDEPolicyMailInfoSet tLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();
   LEDEPolicyMailInfoSchema tLEDEPolicyMailInfoSchema = null;
   if (null == mResultSet) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "getData";
     tError.errorMessage = "数据集为空,请先准备数据集!";
     this.mErrors.addOneError(tError);
     return null;
   }
   try {
     tCount = 1;
     tLEDEPolicyMailInfoSchema = new LEDEPolicyMailInfoSchema();
     tLEDEPolicyMailInfoSchema.setSchema(mResultSet, 1);
     tLEDEPolicyMailInfoSet.add(tLEDEPolicyMailInfoSchema);
     // 注意mResultSet.next()的作用
     while (tCount++ < SysConst.FETCHCOUNT) {
       if (mResultSet.next()) {
         tLEDEPolicyMailInfoSchema = new LEDEPolicyMailInfoSchema();
         tLEDEPolicyMailInfoSchema.setSchema(mResultSet, 1);
         tLEDEPolicyMailInfoSet.add(tLEDEPolicyMailInfoSchema);
       }
     }
   } catch (Exception ex) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "getData";
     tError.errorMessage = ex.toString();
     this.mErrors.addOneError(tError);
     try {
       mResultSet.close();
       mResultSet = null;
     } catch (Exception ex2) {
     }
     try {
       mStatement.close();
       mStatement = null;
     } catch (Exception ex3) {
     }
     if (!mflag) {
       try {
         con.close();
       } catch (Exception et) {
       }
     }
     return null;
   }
   return tLEDEPolicyMailInfoSet;
 }
 /**
  * 关闭数据集
  *
  * @return boolean
  */
 public boolean closeData() {
   boolean flag = true;
   try {
     if (null == mResultSet) {
       CError tError = new CError();
       tError.moduleName = "LEDEPolicyMailInfoDB";
       tError.functionName = "closeData";
       tError.errorMessage = "数据集已经关闭了!";
       this.mErrors.addOneError(tError);
       flag = false;
     } else {
       mResultSet.close();
       mResultSet = null;
     }
   } catch (Exception ex2) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "closeData";
     tError.errorMessage = ex2.toString();
     this.mErrors.addOneError(tError);
     flag = false;
   }
   try {
     if (null == mStatement) {
       CError tError = new CError();
       tError.moduleName = "LEDEPolicyMailInfoDB";
       tError.functionName = "closeData";
       tError.errorMessage = "语句已经关闭了!";
       this.mErrors.addOneError(tError);
       flag = false;
     } else {
       mStatement.close();
       mStatement = null;
     }
   } catch (Exception ex3) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "closeData";
     tError.errorMessage = ex3.toString();
     this.mErrors.addOneError(tError);
     flag = false;
   }
   return flag;
 }
 /**
  * 获取数据集
  *
  * @return boolean
  */
 public boolean hasMoreData() {
   boolean flag = true;
   if (null == mResultSet) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "hasMoreData";
     tError.errorMessage = "数据集为空,请先准备数据集!";
     this.mErrors.addOneError(tError);
     return false;
   }
   try {
     flag = mResultSet.next();
   } catch (Exception ex) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "hasMoreData";
     tError.errorMessage = ex.toString();
     this.mErrors.addOneError(tError);
     try {
       mResultSet.close();
       mResultSet = null;
     } catch (Exception ex2) {
     }
     try {
       mStatement.close();
       mStatement = null;
     } catch (Exception ex3) {
     }
     if (!mflag) {
       try {
         con.close();
       } catch (Exception et) {
       }
     }
     return false;
   }
   return flag;
 }
  public boolean update(String strWherePart) {
    Statement stmt = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      SQLString sqlObj = new SQLString("LEDEPolicyMailInfo");
      LEDEPolicyMailInfoSchema aSchema = this.getSchema();
      sqlObj.setSQL(2, aSchema);
      String sql = "update LEDEPolicyMailInfo " + sqlObj.getUpdPart() + " where " + strWherePart;

      int operCount = stmt.executeUpdate(sql);
      if (operCount == 0) {
        // @@错误处理
        CError tError = new CError();
        tError.moduleName = "LEDEPolicyMailInfoDB";
        tError.functionName = "update";
        tError.errorMessage = "更新数据失败!";
        this.mErrors.addOneError(tError);

        if (!mflag) {
          try {
            con.close();
          } catch (Exception et) {
          }
        }
        return false;
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "update";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        stmt.close();
      } catch (Exception ex1) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }
    // 断开数据库连接
    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
  public LEDEPolicyMailInfoSet executeQuery(String sql, int nStart, int nCount) {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      rs = stmt.executeQuery(StrTool.GBKToUnicode(sql));
      int i = 0;
      while (rs.next()) {
        i++;

        if (i < nStart) {
          continue;
        }

        if (i >= nStart + nCount) {
          break;
        }

        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        if (!s1.setSchema(rs, i)) {
          // @@错误处理
          CError tError = new CError();
          tError.moduleName = "LEDEPolicyMailInfoDB";
          tError.functionName = "executeQuery";
          tError.errorMessage = "sql语句有误,请查看表名及字段名信息!";
          this.mErrors.addOneError(tError);
        }
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "executeQuery";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }
  public LEDEPolicyMailInfoSet query() {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      SQLString sqlObj = new SQLString("LEDEPolicyMailInfo");
      LEDEPolicyMailInfoSchema aSchema = this.getSchema();
      sqlObj.setSQL(5, aSchema);
      String sql = sqlObj.getSQL();

      rs = stmt.executeQuery(sql);
      int i = 0;
      while (rs.next()) {
        i++;
        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        s1.setSchema(rs, i);
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "query";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }