int media_svc_get_file_info(MediaSvcHandle *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size);
int media_svc_send_dir_update_noti(MediaSvcHandle *handle, const char *storage_id, const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
int media_svc_check_db_upgrade(MediaSvcHandle *handle, int user_version, uid_t uid);
-int media_svc_check_db_corrupt(MediaSvcHandle *handle);
int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid);
int media_svc_publish_noti(media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
int media_svc_get_pinyin(const char *src_str, char **pinyin_str);
return MEDIA_SVC_PLUGIN_ERROR_NONE;
}
-int check_db_corrupt(void *handle, char **err_msg)
-{
- int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
-
- /*check db version*/
- ret = media_svc_check_db_corrupt(handle);
- if (ret < 0) {
- __set_error_message(ret, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- return MEDIA_SVC_PLUGIN_ERROR_NONE;
-}
-
int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid, char **err_msg)
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
}
}
-int _media_db_check_corrupt(sqlite3 *db_handle)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *sql = sqlite3_mprintf("PRAGMA quick_check(1)");
- sqlite3_stmt *sql_stmt = NULL;
- char *result = NULL;
-
- ret = _media_svc_sql_prepare_to_step(db_handle, sql, &sql_stmt);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("error when check db. err = [%d]", ret);
- return ret;
- }
-
- result = (char *)sqlite3_column_text(sql_stmt, 0);
- SQLITE3_FINALIZE(sql_stmt);
-
- if (result != NULL) {
- media_svc_debug("result %s", result);
- if (strcasecmp(result, "OK"))
- ret = MS_MEDIA_ERR_DB_CORRUPT;
- } else {
- media_svc_error("result is NULL");
- ret = MS_MEDIA_ERR_DB_INTERNAL;
- }
-
- return ret;
-}
-
-
int _media_svc_create_media_table_with_id(const char *table_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return _media_svc_check_db_upgrade(db_handle, user_version, uid);
}
-int media_svc_check_db_corrupt(MediaSvcHandle *handle)
-{
- sqlite3 *db_handle = (sqlite3 *)handle;
-
- media_svc_debug_fenter();
-
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
- return _media_db_check_corrupt(db_handle);
-}
-
int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
void _media_svc_sql_query_add(GList **query_list, char **query);
void _media_svc_sql_query_release(GList **query_list);
int _media_svc_check_db_upgrade(sqlite3 *db_handle, int user_version, uid_t uid);
-int _media_db_check_corrupt(sqlite3 *db_handle);
#endif /*_MEDIA_SVC_DB_UTILS_H_*/