title: delete from tableview with sqlite3 statement
body: <p>I am trying to delete a row in a UITableView which is populated from a SQL database.</p>
  
  <p>The sql statement I am using is from a class called <code>databaseHanderClass</code>. The method takes an integer which is the id to delete a row in the database - the primary key.</p>
  
  <pre><code>-(BOOL) deleteFromDatabase: (NSInteger)delete_id
  {
     FMDatabase *dbHandler = [FMDatabase databaseWithPath: [Utility getDatabasePath]];
     BOOL success;
     @try 
     {
          [dbHandler open];        
          success = [dbHandler executeUpdate:@"DELETE FROM inputs WHERE id=%d", delete_id];
          [dbHandler close];
     }
     @catch (NSException *exception) 
     {
         NSLog(@"fejl...%@", exception);
     }
     @finally 
     {
         return success;
     }
  }
  </code></pre>
  
  <p>The method I am using for deletion in the UITableView is the following.</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView commitEditingStyle (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
  {
      if (editingStyle == UITableViewCellEditingStyleDelete) 
      {
          [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];            
  
      }   
      else if (editingStyle == UITableViewCellEditingStyleInsert) 
      {
           //statement
      }   
  }
  </code></pre>