2011-12-08 20 views
1

我有下面的代碼段來更新Firefox擴展源碼數據庫無法更新火狐SQLite數據庫時Firefox是磨合的MacOS

NSString * profileFolderPath = [[ @"~" stringByExpandingTildeInPath] stringByAppendingPathComponent:@"/Library/Application Support/Firefox/Profiles"]; 
    NSString *sqlitePath = [pathToProfileFolder stringByAppendingPathComponent:@"extensions.sqlite"]; 

    int rc = sqlite3_open([sqlitePath UTF8String], &db); 
    if(rc) 
    { 
     NSLog(@"enable extension :%@\n",[NSString stringWithCString:sqlite3_errmsg(db)]); 
     sqlite3_close(db); 
     return NO; 
    } 
    else { 
     NSLog(@"opened entensions db successfully \n"); 
    } 
    // check the values for active and userDisabled fields 
    rc = sqlite3_exec(db,"SELECT active,userDisabled FROM addon where id='myId.com'",sqliteCallback,0,&zErrMsg); 
    if (rc!=SQLITE_OK) { 
     NSLog(@"error quering the entensions database :%@\n",[NSString stringWithCString:zErrMsg]); 
     if(zErrMsg) 
     sqlite3_free(zErrMsg); 
     sqlite3_close(db); 
     return NO; 
     // handle error 
    } 

當Firefox應用程序不在運行狀態,我可以讀出的值並且還更新數據庫,但是當firefox運行時,我無法從數據庫中讀取值,因爲sqlite3_exec語句返回值5,並且我可以在控制檯中看到錯誤:「error quering the extensions database:database is locked 」。

如何解決此問題。請幫助。

回答

1

你不能b/c firefox在運行時保持自己的配置文件(和擴展db文件是一個firefox自己的配置文件)打開。