Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1021961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:23:26+00:00 2026-05-16T11:23:26+00:00

-(void) dropCategories{ if (deleteCategoryStmt == nil) { const char *deleteSql = delete from tb_category;

  • 0

-(void) dropCategories{

        if (deleteCategoryStmt == nil) {
            const char *deleteSql = "delete from tb_category";
            if (sqlite3_prepare_v2(database, deleteSql, -1, &deleteCategoryStmt, NULL) != SQLITE_OK) 
                    NSAssert1(0,@"Error in preparing drop category statement with '%s'", sqlite3_errmsg(database));
            else 
                    NSLog(@"NO error in creating drop categories statement");


        }

        if(SQLITE_DONE != sqlite3_step(deleteCategoryStmt))
            NSAssert1(0, @"Error while drop category data. '%s'", sqlite3_errmsg(database));

    sqlite3_reset(deleteCategoryStmt);  
    //sqlite3_finalize(deleteCategoryStmt);
    deleteCategoryStmt = nil;
}

Call to this function once works fine but whenever i calls it again it terminates giving the below exception.

Any suggestion Why is such happening?

 *** Assertion failure in -[Category dropCategories], /Users/rsplmac/Documents/LiteApp2/Classes/Category.m:171
2010-08-17 14:01:06.648 LiteApp2[4335:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while drop category data. 'database is locked''
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02429919 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x025775de objc_exception_throw + 47
    2   CoreFoundation                      0x023e2078 +[NSException raise:format:arguments:] + 136
    3   Foundation                          0x000ce8cf -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4   LiteApp2                            0x000043ce -[Category dropCategories] + 462
    5   LiteApp2                            0x00004ba3 -[RootViewController updateMe:] + 1297
    6   UIKit                               0x002d3e14 -[UIApplication sendAction:to:from:forEvent:] + 119
    7   UIKit                               0x004db14b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
    8   UIKit                               0x002d3e14 -[UIApplication sendAction:to:from:forEvent:] + 119
    9   UIKit                               0x0035d6c8 -[UIControl sendAction:to:forEvent:] + 67
    10  UIKit                               0x0035fb4a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    11  UIKit                               0x0035e6f7 -[UIControl touchesEnded:withEvent:] + 458
    12  UIKit                               0x002f72ff -[UIWindow _sendTouchesForEvent:] + 567
    13  UIKit                               0x002d91ec -[UIApplication sendEvent:] + 447
    14  UIKit                               0x002ddac4 _UIApplicationHandleEvent + 7495
    15  GraphicsServices                    0x02c15afa PurpleEventCallback + 1578
    16  CoreFoundation                      0x0240adc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    17  CoreFoundation                      0x0236b737 __CFRunLoopDoSource1 + 215
    18  CoreFoundation                      0x023689c3 __CFRunLoopRun + 979
    19  CoreFoundation                      0x02368280 CFRunLoopRunSpecific + 208
    20  CoreFoundation                      0x023681a1 CFRunLoopRunInMode + 97
    21  GraphicsServices                    0x02c142c8 GSEventRunModal + 217
    22  GraphicsServices                    0x02c1438d GSEventRun + 115
    23  UIKit                               0x002e1b58 UIApplicationMain + 1160
    24  LiteApp2                            0x00002808 main + 102
    25  LiteApp2                            0x00002799 start + 53
)
terminate called after throwing an instance of 'NSException'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:23:26+00:00Added an answer on May 16, 2026 at 11:23 am

    Your call to sqlite3_finalize appears to be commented. A complete call to sqlite3_prepare_v2 is usually followed by sqlite_step then sqlite3_finalize. Can you try that, without sqlite3_reset?

    EDIT: For posterity: asker found the real cause, the database was locked by another object. Above function was fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

void* myfunction() { char *p; *p = 0; return (void*) &p; } I know
void max_min(sqlite3 *db) { //call back********* int i, ncols; sqlite3_stmt *stmt; char *sql; const
void foo(const char* s) { } foo(bar); Where is the memory bar deallocated? What
void GameBoard::print(const GameBoard& computerBoard) { Grid[0][0] = '1'; Grid[0][1] = '2'; Grid[1][0] = '3';
void operator<< (const Integer& left, const Integer& right) { cout << \n: << right.i;
void test() { unsigned char c; c = (~0)>>1 ; printf(c is %u\n,c); }
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { self.listFeedConnection = nil; // release our connection [UIApplication sharedApplication].networkActivityIndicatorVisible =
void SaveFiles(out XElement Attachments) { Attachments = null; if (Uploader1.UploadedFiles.Count() > 0) { Attachments
void say(char msg[]) { // using pointer to print out the first char of
void someCode() { char memory[sizeof(Foo)]; void* place = memory; Foo* f = new(place) Foo();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.