Package beans

Examples of beans.TableInfo


     
      DatabaseMetaData dmd = con.getMetaData();
      ResultSet tables = dmd.getTables(con.getCatalog(),null,"%",null);//r�cup�ration des informations
      ArrayList<TableInfo> listTables = new ArrayList<TableInfo>();
      while(tables.next()){//affichage des informations
        TableInfo table = new TableInfo();
       
        for(int i=0; i<tables.getMetaData().getColumnCount();i++){
          String nomColonne = tables.getMetaData().getColumnName(i+1);
          if(nomColonne.equals("TABLE_NAME")){
            Object valeurColonne = tables.getObject(i+1);
            table.setNom(valeurColonne.toString());
            //System.out.println(nomColonne+" = "+valeurColonne);
            //r�cup�ration des informations
           
            String nomDeLaTable = valeurColonne.toString();
            ResultSet resultat = dmd.getColumns(con.getCatalog(),null,nomDeLaTable, "%");
            ArrayList<String> colonnes = new ArrayList<String>();
           
            //affichage des informations
            ResultSetMetaData rsmd = resultat.getMetaData();
            while(resultat.next()){
              for(int j=0; j<rsmd.getColumnCount(); j++){
                String col = rsmd.getColumnName(j+1);
              //  System.out.println("col : " + col + " val : " + resultat.getObject(j+1));
                if(col.equals("COLUMN_NAME")){
                  Object val = resultat.getObject(j+1);
                  colonnes.add(val.toString());
                  //System.out.println(col+" = "+val);
               
              }
            }
            table.setNomColonnes(colonnes);
          }
        }
        listTables.add(table);
        
      }
View Full Code Here

TOP

Related Classes of beans.TableInfo

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.