예제 #1
0
 public NotesData getNotes(String id) {
   Cursor cursor =
       baseDataSource
           .getDatabase()
           .query("notes_data", null, "id = ?", new String[] {id}, null, null, null);
   cursor.moveToFirst();
   NotesData notesData = new NotesData();
   notesData.setId(cursor.getString(cursor.getColumnIndex("id")));
   notesData.setTitle(cursor.getString(cursor.getColumnIndex("title")));
   notesData.setNote(cursor.getString(cursor.getColumnIndex("note")));
   cursor.close();
   return notesData;
 }
예제 #2
0
 public List<NotesData> getNotesData() {
   List<NotesData> meta_data = new ArrayList<>();
   NotesData data;
   Cursor curData =
       baseDataSource
           .getDatabase()
           .query("notes_data", null, "soft_delete = ?", new String[] {"1"}, null, null, null);
   if (curData.moveToFirst()) {
     do {
       data = new NotesData();
       data.setId(curData.getString(curData.getColumnIndex("id")));
       data.setTitle(curData.getString(curData.getColumnIndex("title")));
       data.setLabel(curData.getString(curData.getColumnIndex("label")));
       data.setNote(curData.getString(curData.getColumnIndex("note")));
       data.setDate(curData.getString(curData.getColumnIndex("date")));
       meta_data.add(data);
     } while (curData.moveToNext());
   }
   curData.close();
   return meta_data;
 }