int rc;
sqlite3 *db=NULL;
rc = sqlite3_open_v2(“D:\cookies.sqlite”, &db,SQLITE_OPEN_READWRITE,NULL);
if( rc!=SQLITE_OK){
CString strError=””;
strError.Format(_T(“打开Cookie失败: %s\n”), sqlite3_errmsg(db));
sqlite3_close(db);
AfxMessageBox(strError);
return;
}
CString sqlstr=_T(“SELECT value FROM moz_cookies where name=”ToMap” and baseDomain = “88.34.55.250”;”);
//CString sqlstr=_T(“select * from moz_formhistory where fieldname = “name””);//测试
char *errMsg = NULL;
rc = sqlite3_exec(db,”SELECT value FROM moz_cookies where name=”gims_userNum” and baseDomain = “88.34.55.250””, NULL, NULL, &errMsg);//查询步骤,
if (rc)
{
CString strError=””;
strError.Format(_T(“查询Cookie失败: %s\n”), errMsg);
AfxMessageBox(strError);
}
sqlite3_close(db);
delete []errMsg;
上面是本人用于读取sqlite文件的代码 为了测试方便 本人把火狐下的cookies.sqlite拷贝到了D盘,同时取消了sqlite3_exec的回调函数,作为比较,火狐下的formhistory.sqlite也拷贝到了D盘,结果是查看formhistory.sqlite没问题,查看cookies.sqlite时,在查询步骤处返回rc=26,跟踪errMsg,值是file is encrypted or is not a database,求高手指点,本人创建的db,sqlite文件用这函数读取也都没问题,找了两天了 ,没找到方法
sqlite3 *db=NULL;
rc = sqlite3_open_v2(“D:\cookies.sqlite”, &db,SQLITE_OPEN_READWRITE,NULL);
if( rc!=SQLITE_OK){
CString strError=””;
strError.Format(_T(“打开Cookie失败: %s\n”), sqlite3_errmsg(db));
sqlite3_close(db);
AfxMessageBox(strError);
return;
}
CString sqlstr=_T(“SELECT value FROM moz_cookies where name=”ToMap” and baseDomain = “88.34.55.250”;”);
//CString sqlstr=_T(“select * from moz_formhistory where fieldname = “name””);//测试
char *errMsg = NULL;
rc = sqlite3_exec(db,”SELECT value FROM moz_cookies where name=”gims_userNum” and baseDomain = “88.34.55.250””, NULL, NULL, &errMsg);//查询步骤,
if (rc)
{
CString strError=””;
strError.Format(_T(“查询Cookie失败: %s\n”), errMsg);
AfxMessageBox(strError);
}
sqlite3_close(db);
delete []errMsg;
上面是本人用于读取sqlite文件的代码 为了测试方便 本人把火狐下的cookies.sqlite拷贝到了D盘,同时取消了sqlite3_exec的回调函数,作为比较,火狐下的formhistory.sqlite也拷贝到了D盘,结果是查看formhistory.sqlite没问题,查看cookies.sqlite时,在查询步骤处返回rc=26,跟踪errMsg,值是file is encrypted or is not a database,求高手指点,本人创建的db,sqlite文件用这函数读取也都没问题,找了两天了 ,没找到方法
解决方案
40
file is encrypted or is not a database