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 query(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); 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++; if (i < nStart) { continue; } if (i >= nStart + nCount) { break; } 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; }