Remove senior mode
[platform/core/api/media-content.git] / src / media_content.c
index bc96f35..8b2b3af 100644 (file)
@@ -41,7 +41,7 @@ int _content_query_prepare(const char *select_query, const char *condition_query
        int ret = MEDIA_CONTENT_ERROR_NONE;
        char *query = NULL;
 
-       content_retvm_if(!STRING_VALID(select_query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query");
+       content_retip_if_fail(select_query);
 
        /* If 'option_query' is NULL, 'condition_query' is also NULL. */
        if (option_query) {
@@ -64,8 +64,8 @@ int _content_get_result(char *query, sqlite3_stmt **stmt)
 {
        int err = MEDIA_CONTENT_ERROR_NONE;
 
-       content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
-       content_retvm_if(!STRING_VALID(query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid query");
+       content_retip_if_fail(_content_get_db_handle());
+       content_retip_if_fail(query);
 
        content_sec_debug("Query[%s]", query);
 
@@ -83,62 +83,6 @@ int _content_get_result(char *query, sqlite3_stmt **stmt)
        return MEDIA_CONTENT_ERROR_NONE;
 }
 
-#ifdef _USE_SENIOR_MODE
-int _content_query_prepare_by_union_select(sqlite3_stmt **stmt, char *select_query1, char *condition_query1, char *option_query1, char *select_query2, char *condition_query2, char *option_query2)
-{
-       int len = 0;
-       int err = MEDIA_CONTENT_ERROR_NONE;
-       char query[MAX_QUERY_SIZE] = {0, };
-
-       content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
-       content_retvm_if(!STRING_VALID(select_query1), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query1");
-       content_retvm_if(!STRING_VALID(select_query2), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query2");
-
-       if (!STRING_VALID(condition_query1))
-               condition_query1 = (char *)" ";
-
-       if (!STRING_VALID(option_query1))
-               option_query1 = (char *)" ";
-
-       if (!STRING_VALID(condition_query2))
-               condition_query2 = (char *)" ";
-
-       if (!STRING_VALID(option_query2))
-               option_query2 = (char *)" ";
-
-       len = snprintf(query, sizeof(query), "SELECT * FROM (%s %s %s) as table1 UNION ALL SELECT * FROM (%s %s %s) as table2",
-                       select_query1, condition_query1, option_query1, select_query2, condition_query2, option_query2);
-       if (len > 0 && len < sizeof(query)) {
-               query[len] = '\0';
-       } else if (len >= sizeof(query)) {
-               query[MAX_QUERY_SIZE -1] = '\0';
-       } else {
-               content_error("snprintf failed");
-               return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       content_sec_debug("Query : [%s]", query);
-
-       err = sqlite3_prepare_v2(_content_get_db_handle(), query, strlen(query), stmt, NULL);
-       if (err != SQLITE_OK) {
-               content_error("DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", MEDIA_CONTENT_ERROR_DB_FAILED, sqlite3_errmsg(_content_get_db_handle()));
-
-               if (err == SQLITE_BUSY) {
-                       content_error(" BUSY ERROR");
-                       return MEDIA_CONTENT_ERROR_DB_BUSY;
-               } else if (err == SQLITE_PERM) {
-                       content_error("PERMISSION EROR");
-                       return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
-               } else {
-                       content_error("OTHER ERROR");
-                       return MEDIA_CONTENT_ERROR_DB_FAILED;
-               }
-       }
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-#endif
-
 int _content_error_capi(int internal_error)
 {
        if (internal_error == MS_MEDIA_ERR_NONE)
@@ -253,7 +197,7 @@ int media_content_scan_file(const char *path)
        char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
        char repl_path[MAX_PATH_LEN] = {0,};
 
-       content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+       content_retip_if_fail(STRING_VALID(path));
 
        content_sec_debug("Path : %s", path);
 
@@ -488,7 +432,7 @@ int media_content_cancel_scan_folder(const char *path)
        int ret = MEDIA_CONTENT_ERROR_NONE;
        char repl_path[MAX_PATH_LEN] = {0, };
 
-       content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+       content_retip_if_fail(STRING_VALID(path));
 
        ret = _media_content_replace_path(path, repl_path);
        content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");