Käyttämättömän koodin siivous
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
This commit is contained in:
@@ -68,36 +68,6 @@ public class Kuljetus implements TietokantaOlio {
|
||||
this.ruokarajoite = ruokarajoite;
|
||||
}
|
||||
|
||||
public static ArrayList<Kuljetus> haeKaikki() {
|
||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||
Statement stmt = tietokanta.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM kuljetukset;");
|
||||
return parsiResultSet(rs);
|
||||
} catch (SQLException e) {
|
||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||
virhe.showAndWait();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hakee yhden päivän kuljetukset riippumatta kierroksesta
|
||||
* @param päivä haettava päivä
|
||||
* @return päivän kuljetukset
|
||||
*/
|
||||
public static ArrayList<Kuljetus> haePäivänKuljetukset(LocalDate päivä) {
|
||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusPäivämäärä = ?;");
|
||||
stmt.setDate(1, Date.valueOf(päivä));
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
return parsiResultSet(rs);
|
||||
} catch (SQLException e) {
|
||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||
virhe.showAndWait();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hakee tietyn kierroksen kuljetukset
|
||||
* @param päivä kierroksen päivä
|
||||
@@ -117,41 +87,6 @@ public class Kuljetus implements TietokantaOlio {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Hakee kuljetukset aikajakson perusteella
|
||||
*
|
||||
* @param alku jakson alku (sisältyen)
|
||||
* @param loppu jakson loppu (sisältyen)
|
||||
* @return Jakson kuljetukset
|
||||
*/
|
||||
public static ArrayList<Kuljetus> haeAikaJakso(LocalDate alku, LocalDate loppu) {
|
||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusPäivämäärä BETWEEN ? AND ?");
|
||||
stmt.setDate(1, Date.valueOf(alku));
|
||||
stmt.setDate(2, Date.valueOf(loppu));
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
return parsiResultSet(rs);
|
||||
} catch (SQLException e) {
|
||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||
virhe.showAndWait();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<Kuljetus> haeAikaJaksollaJaKierroksella(LocalDate alku, LocalDate loppu, int kuljetusKierros) {
|
||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusKierros = ? and kuljetusPäivämäärä BETWEEN ? AND ?");
|
||||
stmt.setInt(1, kuljetusKierros);
|
||||
stmt.setDate(2, Date.valueOf(alku));
|
||||
stmt.setDate(3, Date.valueOf(loppu));
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
return parsiResultSet(rs);
|
||||
} catch (SQLException e) {
|
||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||
virhe.showAndWait();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tallennaUusi() {
|
||||
|
||||
Reference in New Issue
Block a user