开发者

sqlite iphone connectivity check

开发者 https://www.devze.com 2022-12-28 23:39 出处:网络
Is there any method available for checking the sqlite DB connectivity without calling sqlite3_open([writableDBPath UTF8String], &database) == SQLITE_OK

Is there any method available for checking the sqlite DB connectivity without calling

sqlite3_open([writableDBPath UTF8String], &database) == SQLITE_OK

everytime. We end up开发者_运维知识库 in database connection error after 120 continuous clicks.

Please help.


You should call sqlite3_open just once. Then, if open operation was successful, store the database handle somewhere globally (i.e., in a class variable) and then just use that handle everytime you need to make a call to the database.


First, every sqlite3_open must be matched with a sqlite3_close before open is called with a pointer to that handle again. Otherwise you will have resource leaks, which I think you're experiencing.

Second, why are you repeatedly opening it to begin with?

0

精彩评论

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