Advertisement
dwhitzzz

Method Result

Mar 10th, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.04 KB | None | 0 0
  1. public MethodResult getParametriReport(String abi, String filiale) throws DAOException{
  2.         MethodResult ret = null;
  3.         try{
  4.             String query = "SELECT NOME_FILIALE, INDIRIZZO_FILIALE ,CAP ,COMUNE "+
  5.                             " FROM filiali_report "+
  6.                             " WHERE  cod_abi = ? "+
  7.                             " AND cod_filiale = ?";
  8.            
  9.             List<SpParam> params = new ArrayList<SpParam>();
  10.             params.add(new SpParam("cod_abi", Types.VARCHAR, abi));
  11.             params.add(new SpParam("cod_filiale", Types.VARCHAR, filiale));
  12.             Object[] row = this.conn.selectSingleRecord(query, params);
  13.             if(row!=null){
  14.                 ret = new MethodResult();
  15.                 String[] tmp = new String[row.length];
  16.                 int i=0;
  17.                 for (Object obj : row)
  18.                     tmp[i++] = (String)obj;
  19.                 ret.setRetArrStr(tmp);
  20.             }
  21.         }
  22.         catch(Exception ex){
  23.             log.error("Errore in "+className+".getParametriReport: "+ex.getMessage(), ex);
  24.             throw new DAOException(ex);
  25.         }
  26.         finally{
  27.             if(this.mustCloseConn && this.conn!=null)
  28.                 this.conn.close();
  29.         }
  30.         return ret;
  31.     }
  32.  
  33.     ------------------------------------------
  34.  
  35.     esempio :
  36.    
  37.     public MethodResult getParametriReport(String abi, String filiale) throws DAOException{
  38.         MethodResult ret = null;
  39.         try{
  40.             String query = "SELECT NOME_FILIALE, INDIRIZZO_FILIALE ,CAP ,COMUNE "+
  41.                             " FROM filiali_report "+
  42.                             " WHERE  cod_abi = ? "+
  43.                             " AND cod_filiale = ?";
  44.            
  45.             List<SpParam> params = new ArrayList<SpParam>();
  46.             params.add(new SpParam("cod_abi", Types.VARCHAR, abi));
  47.             params.add(new SpParam("cod_filiale", Types.VARCHAR, filiale));
  48.             Object[] row = this.conn.selectSingleRecord(query, params);
  49.             if(row!=null){
  50.                 ret = new MethodResult();
  51.                 String[] tmp = new String[row.length];
  52.                 int i=0;
  53.                 for (Object obj : row)
  54.                     tmp[i++] = (String)obj;
  55.                 ret.setRetArrStr(tmp);
  56.             }
  57.         }
  58.         catch(Exception ex){
  59.             log.error("Errore in "+className+".getParametriReport: "+ex.getMessage(), ex);
  60.             throw new DAOException(ex);
  61.         }
  62.         finally{
  63.             if(this.mustCloseConn && this.conn!=null)
  64.                 this.conn.close();
  65.         }
  66.         return ret;
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement