Problem with inserting data into a table

前端 未结 2 1330
迷失自我
迷失自我 2021-01-20 04:28

sqlite3 *database; sqlite3_stmt *statement; NSString *dPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@\"UserData.sqlite\"]; const c

2条回答
  •  礼貌的吻别
    2021-01-20 05:01

    try executing commit, so setting the db to autocommit

    // COMMIT
      const char *sql2 = "COMMIT TRANSACTION";
      sqlite3_stmt *commit_statement;
      if (sqlite3_prepare_v2(database, sql2, -1, &commit_statement, NULL) != SQLITE_OK) {
        NSAssert1(0, @"Error Message: '%s'.", sqlite3_errmsg(database));
      }
      success = sqlite3_step(commit_statement);
      if (success != SQLITE_DONE) {
        NSAssert1(0, @"Error Message: '%s'.", sqlite3_errmsg(database));
      }
    }
    

提交回复
热议问题