/* binding values */
if (sqlite3_bind_int(stmt, 1, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getDownloadType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 3, item->getContentType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 4, item->getState()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 5, item->getContentName().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 6, item->getUrl().c_str(), -1, NULL) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 7, item->getFileName().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 8, item->getReqHeaderField().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 9, item->getReqHeaderValue().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 10, item->getInstallDir().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_double(stmt, 11, time(NULL)) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_double:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
/* binding values */
if (sqlite3_bind_int(stmt, 1, item->getDownloadType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getContentType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 3, item->getState()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 4, item->getErrorCode()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 5, item->getTitle().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 6, item->getRegisteredFilePath().c_str(),
-1, NULL) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 7, item->getUrl().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 8, item->getFileName().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 9, item->getReqHeaderField().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 10, item->getReqHeaderValue().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 11, item->getInstallDir().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_double(stmt, 12, item->getFinishedTime()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_double:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 13, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
/* binding values */
if (sqlite3_bind_int(stmt, 1, item->getState()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getErrorCode()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_double(stmt, 3, item->getFinishedTime()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_double:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 4, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
if (sqlite3_bind_text(stmt, 1, item->installNotifyUrl().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
/* binding values */
if (sqlite3_bind_int(stmt, 1, item->getDownloadType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getContentType()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 3, item->getState()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 4, item->getTitle().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 5, item->getEtag().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_text(stmt, 6, item->getTempPath().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
#ifdef _ENABLE_OMA_DOWNLOAD
if (sqlite3_bind_text(stmt, 7, item->installNotifyUrl().c_str(), -1, NULL) !=
SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_double(stmt, 8, time(NULL)) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_double:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int64(stmt, 9, (sqlite_int64)item->getFileSize()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int64:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 10, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
#else
if (sqlite3_bind_double(stmt, 7, time(NULL)) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_double:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int64(stmt, 8, (sqlite_int64)item->getFileSize()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int64:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 9, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
#endif
ret = sqlite3_step(stmt);
/* binding values */
if (sqlite3_bind_int(stmt, 1, item->getState()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
if (sqlite3_bind_int(stmt, 2, item->getHistoryId()) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
if (sqlite3_bind_int(stmt, 1, historyId) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_OK && ret != SQLITE_DONE)
if (sqlite3_bind_int(stmt, 1, historyId) != SQLITE_OK) {
DM_LOGE("Fail to call sqlite3_bind_int:%s",
sqlite3_errmsg(historyDb));
- return false;
+ FINALIZE_ON_ERROR(stmt);
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_OK && ret != SQLITE_DONE)