Package items

Source Code of items.ValueCorrector

package items;

import java.util.ArrayList;

import dbdao.DBaseManager;

public class ValueCorrector
{
  private String table;
  private int index;
  private String col;
  private String sValue;
  private String cValue;
 
  public ValueCorrector( String tabla , String columna , int indice , String buscarValor , String corregirValor )
  {
    table = tabla;
    col = columna;
    index = indice;
    sValue = buscarValor;
    cValue = corregirValor;
   
    correctValue();
  }
 
  private void correctValue()
  {
    DBaseManager dbm = new DBaseManager();
    ArrayList<LString> lResp = dbm.getElements("SELECT * FROM " + table);
    ArrayList<String>lSQL = new ArrayList<String>();
   
    for( int i=0 ; i<lResp.size() ; i++ )
      if( lResp.get(i).get(index).indexOf(sValue)>-1 )
        lSQL.add("UPDATE " + table + " SET " + col + "='" + cValue + "' WHERE ID=" + i );
   
    for( int i=0 ; i<lSQL.size() ; i++ )
      System.out.println( lSQL.get(i) );
    //dbm.updateElements(lSQL);
  }
}
TOP

Related Classes of items.ValueCorrector

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.