title: Deleting Table from sqlite database
body: <p>I am unable to delete the tables from sqlite database using <code>DROP TABLE</code> query. Have tried all possible solutions such as <code>[database openCloseResultSet]</code>, <code>[resultSet close]</code> and so on. But adding these lines results in out of memory error and if i dont write these lines then my program just stops at the drop table statement. There is no warning or error given too.Even if i put the code in debug, my debug point just goes away once this line is executed.I am using FMDatabase library while working with process related to sqlite.I am unable to find out the cause of this issue.  </p>
  
  <p>Have tried these links too but they are not working in my case.<br>
  1)<a href="https://stackoverflow.com/questions/7331504/fmdb-executeupdate-drop-command-does-halt-the-app">FMDB executeUpdate DROP command does halt the app</a>
  2)<a href="https://stackoverflow.com/questions/15809520/how-to-remove-all-data-from-table-using-fmdb">How to remove all data from table using FMDB</a></p>
  
  <p>Here is my code where the issue prevails.</p>
  
  <pre><code>+ (NSString *) deleteTable:(NSInteger) index{
  
  NSString *returnFlag = @"success";
  FMDatabase *database = nil;
  @try {
  
      NSString *query = @"select name from sqlite_master where type = 'table'";
  
      database = [FMDatabase databaseWithPath:[DBOperator getDataBasePath:DATABASENAME]];
  
    if(database != nil &amp;&amp; [database open])
    {
      FMResultSet *resultSet = [database executeQuery:query];
  
      while ([resultSet next]) {
  
          NSString *temp = [resultSet stringForColumnIndex: 0];
  
          if (index == DELETE_TYPE_ONE &amp;&amp;
              ([temp equalsIgnoreCase: TBUPW] ||
               [temp equalsIgnoreCase: TBCVR] ||
               [temp equalsIgnoreCase: TBCNTRLNO])) {
  
                  [database executeUpdate:[NSString stringWithFormat:@"DROP TABLE %@", temp]];
  
          }else if(index == DELETE_TYPE_TWO &amp;&amp; [temp hasPrefix:@"txn"]){
  
            [database executeUpdate:[NSString stringWithFormat:@"DROP TABLE %@", temp]];
  
          }else if(index == DELETE_TYPE_THREE &amp;&amp;
                   ([temp hasPrefix:@"t"] ||
                    [temp hasPrefix:@"T"] ||
                   [temp hasPrefix:@"ob"] ||
                   [temp hasPrefix:@"fb"] ||
                   [temp hasPrefix:@"cp"])){
  
                   NSlog("This is printed in console");
  
     [database executeUpdate:[NSString stringWithFormat:@"DROP TABLE %@", temp]];
  
       NSLog("This is not printed in console");
  
         }else if(index == DELETE_TYPE_FOUR &amp;&amp; [temp equalsIgnoreCase:@"TBPLAN"]){
  
             [database executeUpdate:[NSString stringWithFormat:@"DROP TABLE %@", temp]];
          }
      }
    }
  }
  @catch (NSException *exception) {
      returnFlag = @"error";
  }
  @finally {
      [database close];
  }
  
  return returnFlag;
  }
  </code></pre>