mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-22 19:14:50 +00:00
Create menu_database_build_query
This commit is contained in:
parent
37fbbd3eb1
commit
8abb8d3c8f
@ -19,6 +19,78 @@
|
||||
#include "../playlist.h"
|
||||
#include <string.h>
|
||||
|
||||
int menu_database_build_query(
|
||||
char *query, size_t len, const char *label, const char *path)
|
||||
{
|
||||
bool add_quotes = true;
|
||||
|
||||
strlcpy(query, "{'", len);
|
||||
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_publisher"))
|
||||
strlcat(query, "publisher", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_developer"))
|
||||
strlcat(query, "developer", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_origin"))
|
||||
strlcat(query, "origin", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_franchise"))
|
||||
strlcat(query, "franchise", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_esrb_rating"))
|
||||
strlcat(query, "esrb_rating", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_bbfc_rating"))
|
||||
strlcat(query, "bbfc_rating", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_elspa_rating"))
|
||||
strlcat(query, "elspa_rating", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_pegi_rating"))
|
||||
strlcat(query, "pegi_rating", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_enhancement_hw"))
|
||||
strlcat(query, "enhancement_hw", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_cero_rating"))
|
||||
strlcat(query, "cero_rating", len);
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_rating"))
|
||||
{
|
||||
strlcat(query, "edge_rating", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_issue"))
|
||||
{
|
||||
strlcat(query, "edge_issue", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_famitsu_magazine_rating"))
|
||||
{
|
||||
strlcat(query, "famitsu_rating", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releasemonth"))
|
||||
{
|
||||
strlcat(query, "releasemonth", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear"))
|
||||
{
|
||||
strlcat(query, "releaseyear", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_max_users"))
|
||||
{
|
||||
strlcat(query, "users", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
|
||||
strlcat(query, "':", len);
|
||||
if (add_quotes)
|
||||
strlcat(query, "\"", len);
|
||||
strlcat(query, path, len);
|
||||
if (add_quotes)
|
||||
strlcat(query, "\"", len);
|
||||
strlcat(query, "}", len);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("query: %s\n", query);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
static int menu_database_push_query(libretrodb_t *db,
|
||||
libretrodb_cursor_t *cur, file_list_t *list)
|
||||
|
@ -31,6 +31,9 @@ extern "C" {
|
||||
int menu_database_populate_query(file_list_t *list, const char *path,
|
||||
const char *query);
|
||||
|
||||
int menu_database_build_query(
|
||||
char *query, size_t len, const char *label, const char *path);
|
||||
|
||||
void menu_database_free(void *data);
|
||||
|
||||
bool menu_database_realloc(const char *path,
|
||||
|
@ -918,89 +918,9 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch(
|
||||
int ret;
|
||||
menu_displaylist_info_t info = {0};
|
||||
char query[PATH_MAX_LENGTH];
|
||||
struct string_list *str_list = NULL;
|
||||
bool add_quotes = true;
|
||||
file_list_t *list = NULL;
|
||||
file_list_t *menu_list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
struct string_list *str_list = string_split(path, "|");
|
||||
|
||||
str_list = string_split(path, "|");
|
||||
|
||||
list = (file_list_t*)data;
|
||||
menu_list = (file_list_t*)userdata;
|
||||
|
||||
if (!list || !menu_list)
|
||||
{
|
||||
string_list_free(str_list);
|
||||
return -1;
|
||||
}
|
||||
|
||||
strlcpy(query, "{'", sizeof(query));
|
||||
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_publisher"))
|
||||
strlcat(query, "publisher", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_developer"))
|
||||
strlcat(query, "developer", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_origin"))
|
||||
strlcat(query, "origin", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_franchise"))
|
||||
strlcat(query, "franchise", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_esrb_rating"))
|
||||
strlcat(query, "esrb_rating", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_bbfc_rating"))
|
||||
strlcat(query, "bbfc_rating", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_elspa_rating"))
|
||||
strlcat(query, "elspa_rating", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_pegi_rating"))
|
||||
strlcat(query, "pegi_rating", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_enhancement_hw"))
|
||||
strlcat(query, "enhancement_hw", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_cero_rating"))
|
||||
strlcat(query, "cero_rating", sizeof(query));
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_rating"))
|
||||
{
|
||||
strlcat(query, "edge_rating", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_issue"))
|
||||
{
|
||||
strlcat(query, "edge_issue", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_famitsu_magazine_rating"))
|
||||
{
|
||||
strlcat(query, "famitsu_rating", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releasemonth"))
|
||||
{
|
||||
strlcat(query, "releasemonth", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear"))
|
||||
{
|
||||
strlcat(query, "releaseyear", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_max_users"))
|
||||
{
|
||||
strlcat(query, "users", sizeof(query));
|
||||
add_quotes = false;
|
||||
}
|
||||
|
||||
strlcat(query, "':", sizeof(query));
|
||||
if (add_quotes)
|
||||
strlcat(query, "\"", sizeof(query));
|
||||
strlcat(query, str_list->elems[0].data, sizeof(query));
|
||||
if (add_quotes)
|
||||
strlcat(query, "\"", sizeof(query));
|
||||
strlcat(query, "}", sizeof(query));
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("query: %s\n", query);
|
||||
#endif
|
||||
menu_database_build_query(query, sizeof(query), label, str_list->elems[0].data);
|
||||
|
||||
if (query[0] == '\0')
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user