ios - Deleting Table from sqlite database -


i unable delete tables sqlite database using drop table query. have tried possible solutions such [database opencloseresultset], [resultset close] , on. adding these lines results in out of memory error , if dont write these lines program stops @ drop table statement. there no warning or error given too.even if put code in debug, debug point goes away once line executed.i using fmdatabase library while working process related sqlite.i unable find out cause of issue.

have tried these links not working in case.
1)fmdb executeupdate drop command halt app 2)how remove data table using fmdb

here code issue prevails.

+ (nsstring *) deletetable:(nsinteger) index{  nsstring *returnflag = @"success"; fmdatabase *database = nil; @try {      nsstring *query = @"select name sqlite_master type = 'table'";      database = [fmdatabase databasewithpath:[dboperator getdatabasepath:databasename]];    if(database != nil && [database open])   {     fmresultset *resultset = [database executequery:query];      while ([resultset next]) {          nsstring *temp = [resultset stringforcolumnindex: 0];          if (index == delete_type_one &&             ([temp equalsignorecase: tbupw] ||              [temp equalsignorecase: tbcvr] ||              [temp equalsignorecase: tbcntrlno])) {                  [database executeupdate:[nsstring stringwithformat:@"drop table %@", temp]];          }else if(index == delete_type_two && [temp hasprefix:@"txn"]){            [database executeupdate:[nsstring stringwithformat:@"drop table %@", temp]];          }else if(index == delete_type_three &&                  ([temp hasprefix:@"t"] ||                   [temp hasprefix:@"t"] ||                  [temp hasprefix:@"ob"] ||                  [temp hasprefix:@"fb"] ||                  [temp hasprefix:@"cp"])){                   nslog("this printed in console");     [database executeupdate:[nsstring stringwithformat:@"drop table %@", temp]];       nslog("this not printed in console");         }else if(index == delete_type_four && [temp equalsignorecase:@"tbplan"]){             [database executeupdate:[nsstring stringwithformat:@"drop table %@", temp]];         }     }   } } @catch (nsexception *exception) {     returnflag = @"error"; } @finally {     [database close]; }  return returnflag; } 

you can use query.

drop table your_table_name; 

or can use

delete your_table_name; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -