开发者

Check to see if SQLite database connection is still open

开发者 https://www.devze.com 2023-03-17 12:51 出处:网络
how can you check to see if a database is still open? I am using this to open it: if (sqlite3_open([dbPath UTF8String], &database1) == SQLITE_OK) {

how can you check to see if a database is still open?

I am using this to open it:

   if (sqlite3_open([dbPath UTF8String], &database1) == SQLITE_OK) {
}

I assume it would be something like the following, but when I think the database is open it shows as closed: (Am I on the right track or completely wrong here?) :

if(sqlite3_open([dbPath UTF8String], &database1)){

    NSLog(@"DATABASE OPEN?");

}else{

    NSLog(@"DATABASE开发者_StackOverflow社区 CLOSED?");


}


      if(sqlite3_open([temppath UTF8String], &database) == SQLITE_OK)
      {
      NSLog(@"DATABASE OPEN?");
      sqlite3_close(database);
      }
      else
      {
         NSLog(@"DATABASE CLOSED?");
      }
0

精彩评论

暂无评论...
验证码 换一张
取 消