return VC_DB_ERROR_OPERATION_FAILED;
}
+ if (*db_handle == NULL) {
+ SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open db, path = %s, ret(%d)", path, ret);
+ return VC_DB_ERROR_OPERATION_FAILED;
+ }
+
ret = sqlite3_exec(*db_handle, "PRAGMA integrity_check", 0, 0, 0);
if (SQLITE_OK != ret) {
SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open DB for daemon");
__vc_db_commit_transaction(*db_handle);
}
- if (*db_handle) {
- char* err_msg = NULL;
- static const char* sql = "PRAGMA journal_mode = WAL";
- int ret = sqlite3_exec(*db_handle, sql, NULL, NULL, &err_msg);
- if (ret != SQLITE_OK) {
- SLOG(LOG_ERROR, vc_db_tag(), "sqlite3_exec returned %d: %s", ret, err_msg);
- sqlite3_free(err_msg);
- err_msg = NULL;
- return VC_DB_ERROR_OPERATION_FAILED;
- }
+ char* err_msg = NULL;
+ static const char* sql = "PRAGMA journal_mode = WAL";
+ ret = sqlite3_exec(*db_handle, sql, NULL, NULL, &err_msg);
+ if (ret != SQLITE_OK) {
+ SLOG(LOG_ERROR, vc_db_tag(), "sqlite3_exec returned %d: %s", ret, err_msg);
+ sqlite3_free(err_msg);
+ err_msg = NULL;
+ return VC_DB_ERROR_OPERATION_FAILED;
}
+
return VC_DB_ERROR_NONE;
}