Package main

Source Code of main.RemoveItem

package main;

import java.util.ArrayList;

import dbdao.DBaseManager;

public class RemoveItem
{
  private String table;
  private int index;
 
  public RemoveItem( String tabla , int indice )
  {
    table = tabla;
    index = indice;
    remove();
  }
 
  private void remove()
  {
    DBaseManager dbm = new DBaseManager();
    int fin = dbm.getLastIndex(table);
    ArrayList<String> lSQL = new ArrayList<String>();
    lSQL.add("DELETE FROM " + table + " WHERE ID=" + index);
    for( int i=index ; i<fin ; i++ )
      lSQL.add("UPDATE " + table + " SET ID=" + i + " WHERE ID=" + (int)(i+1) );
    for( int i=0 ; i<lSQL.size() ; i++ )
      System.out.println(lSQL.get(i));
    dbm.updateElements(lSQL);
  }
}
TOP

Related Classes of main.RemoveItem

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.