public static void MAJCoordonnees() throws IOException { compteur = 0; DatabaseConnect BDD = new DatabaseConnect(); BDD.Connexion(); BDD.ViderTable("tb_stopscoordon"); fis = new FileInputStream("res/coordonnees.csv"); br = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8"))); System.out.println( "Mise a jour de la table <tb_stopscoordon> en cours...\nVeuillez patienter..."); while ((line = br.readLine()) != null) { String array[] = pattern.split(line, 0); if (array.length == 3) { try { BDD.Ajouter( "INSERT INTO tb_stopscoordon VALUES (" + array[0] + "," + array[1] + "," + array[2] + ")"); compteur++; } catch (Exception err) { } } } System.out.println("Mise a jour terminee.\n" + compteur + " lignes ont ete ajoutees."); BDD.Deconnexion(); }
public static void readStops(String requete) throws IOException, SQLException { DatabaseConnect connexion = new DatabaseConnect(); connexion.Connexion(); Arret arr; arrs.clear(); ResultSet test = connexion.Rechercher(requete); while (test.next()) { arr = new Arret( test.getString("stop_id"), test.getString("stop_name"), test.getString("stop_type")); arrs.put(Integer.valueOf(test.getString("stop_id")), arr); } connexion.Deconnexion(); }
public static void readStations(String requete) throws IOException, SQLException { DatabaseConnect connexion = new DatabaseConnect(); connexion.Connexion(); Station sta; stat.clear(); ResultSet test = connexion.Rechercher(requete); while (test.next()) { sta = new Station( test.getString("parent_id"), test.getString("stop_type"), test.getString("stop_name")); stat.put(Integer.valueOf(test.getString("parent_id")), sta); } connexion.Deconnexion(); }