Exemplo n.º 1
0
 @Override
 public boolean save(RamMemory obj) {
   try {
     addRamStatement.setString(1, obj.getNazwa_firmy());
     addRamStatement.setInt(2, obj.getIlosc());
     addRamStatement.setInt(3, obj.getPojemnosc());
     addRamStatement.setInt(4, obj.getCena());
     return addRamStatement.execute();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return false;
 }
Exemplo n.º 2
0
  @Override
  public boolean delete(RamMemory obj) {
    try {
      deleteRamStatement.setString(1, obj.getNazwa_karty());
      deleteRamStatement.executeUpdate();
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return false;
  }
Exemplo n.º 3
0
  @Override
  public List<RamMemory> getAll() {
    List<RamMemory> result = new ArrayList<RamMemory>();

    try {
      ResultSet rs = getAllRamStatement.executeQuery();
      while (rs.next()) {
        RamMemory p = new RamMemory(createTable, 0, 0, 0);
        p.setNazwa_firmy(rs.getString("nazwa_firmy"));
        p.setIlosc(rs.getInt("ilosc"));
        p.setPojemnosc(rs.getInt("pojemnosc"));
        p.setCena(rs.getInt("cena"));
        p.setId(rs.getInt("id_pamieci"));
        result.add(p);
      }
    } catch (SQLException e) {

      e.printStackTrace();
    }

    return result;
  }