5758596061626364
note.setId(keys.getInt(1)); } keys.close(); } catch (SQLException e) { e.printStackTrace(); throw new ItemException(Type.INSERT_ERROR,e); } }
707172737475767778
updateStatement.setString(3, note.getKeywords()); updateStatement.setInt(4, note.getId()); updateStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); throw new ItemException(Type.UPDATE_ERROR,e); } }
90919293949596979899
if (note != null) { return note; } } catch (SQLException e) { throw new ItemException(Type.SELECT_ERROR, e); } throw new ItemException(Type.ITEM_MISSING); }
107108109110111112113114115
while (result.next()) { list.add(new Note(result.getInt("id"), this)); } result.close(); } catch (SQLException e) { throw new ItemException(Type.SELECT_ERROR, e); } return list; }
128129130131132133134135136137
140141142143144145146147
public void delete(Note note) throws ItemException { try { deleteNoteStatement.setInt(1, note.getId()); deleteNoteStatement.executeUpdate(); } catch (SQLException e) { throw new ItemException(Type.DELETE_ERROR,e); } }
150151152153154155156157
public Iterator<Note> Iterator() throws ItemException { try { ResultSet result = selectAllStatement.executeQuery(); return new NoteIterator(result,this); } catch (SQLException e) { throw new ItemException(Type.SELECT_ERROR, e); } }
525354555657585960
tag.setId(keys.getInt(1)); } keys.close(); } catch (SQLException e) { e.printStackTrace(); throw new ItemException(Type.INSERT_ERROR,e); } }
646566676869707172
updateStatement.setString(1, tag.getLabel()); updateStatement.setInt(2, tag.getId()); updateStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); throw new ItemException(Type.UPDATE_ERROR,e); } }
84858687888990919293
if (tag != null) { return tag; } } catch (SQLException e) { throw new ItemException(Type.SELECT_ERROR, e); } throw new ItemException(Type.ITEM_MISSING); }