Exemplo n.º 1
0
 @Override
 public boolean addCategory(String category) {
   try {
     cTable.insert(category);
   } catch (SQLException e) {
     Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
     return false;
   }
   return true;
 }
Exemplo n.º 2
0
  @Override
  public List<String> getCategories() {

    try {
      return cTable.select();
    } catch (SQLException e) {
      Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }

    return Collections.emptyList();
  }
Exemplo n.º 3
0
  @Override
  public boolean clear() {

    try {
      boolean bDelete = bTable.delete();
      boolean uDelete = uTable.delete();
      boolean cDelete = cTable.delete();
      return bDelete && uDelete && cDelete;
    } catch (SQLException e) {
      Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }

    return false;
  }