Package dbdao

Examples of dbdao.DBaseManager


  {
    table = tabla;
    index1 = indice1;
    index2 = indice2;
   
    DBaseManager dbm = new DBaseManager();
    lSQL = new ArrayList<String>();
   
    ArrayList<LString> lElem = dbm.getElements("SELECT * FROM " + tabla + " WHERE ID=" + index1 + " OR ID=" + index2);
    /*
    LString aux = lElem.get(0);
    for( int i=1 ; i<lElem.get(0).length ; i++ )
    {
      lElem.get(0).set(i,lElem.get(1).get(i));
      lElem.get(1).set(i,aux.get(i));
    }
    */
    if( table.equalsIgnoreCase("params") )
    {
      lSQL.add( "UPDATE params SET menuTable='" + lElem.get(0).get(1) + "',display='" + lElem.get(0).get(2) + "',colName='" + lElem.get(0).get(3) + "' WHERE ID=" + lElem.get(1).get(0) );
      lSQL.add( "UPDATE params SET menuTable='" + lElem.get(1).get(1) + "',display='" + lElem.get(1).get(2) + "',colName='" + lElem.get(1).get(3) + "' WHERE ID=" + lElem.get(0).get(0) );
    }
    else
    {
      System.out.println("Aun no esta implementada la parte de para cualquier tabla que no sea params. No seas vago y hazlo xD");
    }
   
    for( int i=0 ; i<lSQL.size() ; i++ )
      System.out.println( lSQL.get(i));
    dbm.updateElements(lSQL);
  }
View Full Code Here


    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);
  }
View Full Code Here

    index = indice;
   
    ArrayList<String> lSQL = new ArrayList<String>();
    ArrayList<LString> lElem = new ArrayList<LString>();
   
    DBaseManager dbm = new DBaseManager();
    int fin = dbm.getLastIndex("params");
    lElem = dbm.getElements("SELECT * FROM params");
   
    lSQL.add( "INSERT INTO params VALUES ("+ (int)(fin+1) + ",'" + lElem.get(fin-1).get(1) + "','" + lElem.get(fin-1).get(2) + "','" + lElem.get(fin-1).get(3) + "','1','0')" );
   
    for( int i=fin ; i>index ; i-- )
      lSQL.add( "UPDATE params SET menuTable='" + lElem.get(i-2).get(1) + "',display='" + lElem.get(i-2).get(2) + "',colName='" + lElem.get(i-2).get(3) + "' WHERE ID=" + i );
    lSQL.add("UPDATE params SET menuTable='" + menuTable + "',display='" + display + "',colName='" + colName + "' WHERE ID=" + index);
   
    for( int i=0 ; i<lSQL.size() ; i++ )
      System.out.println(lSQL.get(i));
    dbm.updateElements(lSQL);
  }
View Full Code Here

    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 );
View Full Code Here

  {
    if( !test //PRUEBA: mostrar las sentencias SQL
      for( int i=0 ; i<lSQL.size() ; i++ )
        System.out.println(lSQL.get(i));
    else
      new DBaseManager().updateElements(lSQL);
  }
View Full Code Here

TOP

Related Classes of dbdao.DBaseManager

Copyright © 2018 www.massapicom. 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.