1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
private boolean isRetard( String cne ) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
Connection connexion = null;
int compare = 0;
boolean isr=false;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/myfirstprogram","root","");
Statement stmt=connexion.createStatement();
String req = "SELECT dateemprunt,dateretour FROM emprunte WHERE cne='"+cne+"';";
ResultSet rs = stmt.executeQuery(req);
while(rs.next()){
int t[]=Parser.parserDate(rs.getString(1));
int t1[]=Parser.parserDate(rs.getString(2));
compare=(t1[2]-t[2])*12*30+(t1[1]-t[1])*30+(t1[0]-t[0]);
if (compare>30)
isr=true;
else
isr= false;
}
return isr;
} |
Partager