return content_g_uid;
}
-int _content_query_prepare(char *select_query, char *condition_query, char *option_query, sqlite3_stmt **stmt)
+int _content_query_prepare(const char *select_query, const char *condition_query, const char *option_query, sqlite3_stmt **stmt)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char *query = NULL;
media_content_retvm_if(!STRING_VALID(select_query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query");
- if (!STRING_VALID(condition_query))
- condition_query = (char *)" ";
-
- if (!STRING_VALID(option_query))
- option_query = (char *)" ";
+ if (STRING_VALID(condition_query)) {
+ if (STRING_VALID(option_query))
+ query = sqlite3_mprintf("%s AND %s %s", select_query, condition_query, option_query);
+ else
+ query = sqlite3_mprintf("%s AND %s", select_query, condition_query);
+ } else {
+ if (STRING_VALID(option_query))
+ query = sqlite3_mprintf("%s %s", select_query, option_query);
+ else
+ query = sqlite3_mprintf("%s", select_query);
+ }
- query = sqlite3_mprintf("%s %s %s", select_query, condition_query, option_query);
ret = _content_get_result(query, stmt);
SQLITE3_SAFE_FREE(query);
/* This means this path has to be inserted or refreshed */
folder_path = g_path_get_dirname(repl_path);
ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
- SAFE_FREE(folder_path);
+ g_free(folder_path);
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
/* check feature */