1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
ResultSet res1, res2;
try {
res1 = stat.executeQuery("select numero, station, ligne1, ligne2, ligne3, ligne4, ligne5 from metroratp where station = '"+depart+"'");
res1.next();
res2 = stat.executeQuery("select numero, station, ligne1, ligne2, ligne3, ligne4, ligne5 from metroratp where station = '"+arrivee+"'");
res2.next();
for(int i = 1; i <= 5; i++) {
for(int j = 1; j <= 5; j++) {
if(res1.getInt("ligne"+i) != 0 && res2.getInt("ligne"+j) != 0 && res1.getInt("ligne"+i) == res2.getInt("ligne"+j)) {
listStation = listeStation(depart, res1.getInt("numero"), arrivee, res2.getInt("numero"), res1.getInt("ligne"+i));
}
else {
return null;
}
}
}
res1.close();
res2.close();
}
catch (SQLException SQLE) {
SQLE.printStackTrace();
} |
Partager