コード例 #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;
 }
コード例 #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();
  }
コード例 #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;
  }