1.返回数据库字段信息与要查询数据库的数据字段不一致:
如下例:返回的字段少个imgurL
String where = String::format("%s='%s'",AppBean::APPID().string(),appID.string());
DbResolver* p = DbResolver::getInstance();
if (p != NulL) {
StringArray pro(2);
pro.replaceAt(AppBean::PACKAGEname(),0);
pro.replaceAt(AppBean::APPname(),1);
autoCursor cursor = p->query(AppBean::DOWNLOAD_table_name(),pro,where,StringArray(0),"");
if (cursor->movetoFirst()) {
String pkg = cursor->getString(cursor->getColumnIndex(AppBean::PACKAGEname()));
String appname = cursor->getString(cursor->getColumnIndex(AppBean::APPname()));
String imageUrl = cursor->getString(cursor->getColumnIndex(AppBean::imgurL()));
Demand d = NotificationDelegate::createDemand(appname,pkg,imageUrl,"",NotificationDelegate::STATUS_WAITDOWNLOAD,NotificationDelegate::ParaM_CANCEL);
mpContext->invokeDelegate(&d);
}
}
正确方式应为:
String where = String::format("%s='%s'",appID.string());
DbResolver* p = DbResolver::getInstance();
if (p != NulL) {
StringArray pro(3);
pro.replaceAt(AppBean::PACKAGEname(),1);
pro.replaceAt(AppBean::imgurL(),2);
autoCursor cursor = p->query(AppBean::DOWNLOAD_table_name(),"");
if (cursor->movetoFirst()) {
String pkg = cursor->getString(cursor->getColumnIndex(AppBean::PACKAGEname()));
String appname = cursor->getString(cursor->getColumnIndex(AppBean::APPname()));
String imageUrl = cursor->getString(cursor->getColumnIndex(AppBean::imgurL()));
Demand d = NotificationDelegate::createDemand(appname,NotificationDelegate::ParaM_CANCEL);
mpContext->invokeDelegate(&d);
}
}
以上是内存溢出为你收集整理的sqlite数据查询速度慢的可能原因全部内容,希望文章能够帮你解决sqlite数据查询速度慢的可能原因所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)