if (sqlite3_step(statement) != SQLITE_ROW) {
mc_error("end of row [%s]", sqlite3_errmsg(handle));
SQLITE3_FINALIZE(statement);
- return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
+ /* Error for server metadata. So, other functions need to change TIZEN_ERROR_NO_DATA to MEDIA_CONTROLLER_ERROR_INVALID_OPERATION. */
+ return TIZEN_ERROR_NO_DATA;
}
*stmt = statement;
MC_DB_TABLE_SERVER_INFO, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "__mc_db_get_record failed [%d]", ret);
_playback = (media_controller_playback_s *)calloc(1, sizeof(media_controller_playback_s));
if (!_playback) {
_metadata = (media_controller_metadata_s *)calloc(1, sizeof(media_controller_metadata_s));
mc_retvm_if(_metadata == NULL, MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- _metadata->title = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->artist = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->album = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->author = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->genre = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->duration = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->date = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->copyright = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->description = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->track_num = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->picture = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->season = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->episode = g_strdup((const char *)sqlite3_column_text(stmt, col++));
- _metadata->resolution = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ if (stmt != NULL) {
+ _metadata->title = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->artist = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->album = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->author = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->genre = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->duration = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->date = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->copyright = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->description = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->track_num = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->picture = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->season = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->episode = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ _metadata->resolution = g_strdup((const char *)sqlite3_column_text(stmt, col++));
+ }
*metadata = (mc_metadata_h)_metadata;
sql_str = sqlite3_mprintf("SELECT %s FROM %q WHERE name=%Q", META_LIST, MC_DB_TABLE_LATEST_META, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE && ret != TIZEN_ERROR_NO_DATA, ret, "__mc_db_get_record failed [%d]", ret);
ret = __mc_db_get_metadata(stmt, 0, metadata);
SQLITE3_FINALIZE(stmt);
sql_str = sqlite3_mprintf("SELECT shuffle_mode FROM %q WHERE name=%Q", MC_DB_TABLE_SERVER_INFO, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "__mc_db_get_record failed [%d]", ret);
*mode = sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
sql_str = sqlite3_mprintf("SELECT repeat_mode FROM %q WHERE name=%Q", MC_DB_TABLE_SERVER_INFO, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "__mc_db_get_record failed [%d]", ret);
*mode = sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
sql_str = sqlite3_mprintf("SELECT icon_uri FROM %q WHERE name=%Q", MC_DB_TABLE_SERVER_INFO, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "__mc_db_get_record failed [%d]", ret);
*uri = g_strdup((const char *)sqlite3_column_text(stmt, 0));
SQLITE3_FINALIZE(stmt);
sql_str = sqlite3_mprintf("SELECT ability_decided, ability_supported FROM %q WHERE name=%Q", MC_DB_TABLE_SERVER_INFO, server_name);
ret = __mc_db_get_record(handle, sql_str, &stmt);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "__mc_db_get_record failed [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "__mc_db_get_record failed [%d]", ret);
*decided = (unsigned long long)sqlite3_column_int64(stmt, 0);
*supported = (unsigned long long)sqlite3_column_int64(stmt, 1);