Exemple #1
0
 /**
  * Getting the task from the database based on the id
  *
  * @id : the task id to search for
  *
  * return task if found and throw an Exception otherwise
  **/
 public override TaskNote findById(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findById), false, new Pair(nameof(id), id));
     //Finding the task
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, "*", id));
         //Reading the the Record from the database
         TaskNote task = find(reader);
         Logging.logInfo(false, nameof(findById), DatabaseConstants.FOUND(id), task.ToString());
         reader.Close();
         return(task);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findById), true, new Pair(nameof(id), id));
     //TaskNote not found in the database
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }