mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Refactor database_cursor_open
This commit is contained in:
parent
2f0b2460e7
commit
3037dd8685
@ -214,11 +214,14 @@ int database_cursor_iterate(libretrodb_cursor_t *cur,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int database_cursor_open(libretrodb_t *db,
|
int database_cursor_open(libretrodb_t *db,
|
||||||
libretrodb_cursor_t *cur, const char *query)
|
libretrodb_cursor_t *cur, const char *path, const char *query)
|
||||||
{
|
{
|
||||||
const char *error = NULL;
|
const char *error = NULL;
|
||||||
libretrodb_query_t *q = NULL;
|
libretrodb_query_t *q = NULL;
|
||||||
|
|
||||||
|
if ((libretrodb_open(path, db)) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (query)
|
if (query)
|
||||||
q = (libretrodb_query_t*)libretrodb_query_compile(db, query,
|
q = (libretrodb_query_t*)libretrodb_query_compile(db, query,
|
||||||
strlen(query), &error);
|
strlen(query), &error);
|
||||||
@ -283,9 +286,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
|||||||
database_info_t *database_info = NULL;
|
database_info_t *database_info = NULL;
|
||||||
database_info_list_t *database_info_list = NULL;
|
database_info_list_t *database_info_list = NULL;
|
||||||
|
|
||||||
if ((libretrodb_open(rdb_path, &db)) != 0)
|
if ((database_cursor_open(&db, &cur, rdb_path, query) != 0))
|
||||||
return NULL;
|
|
||||||
if ((database_cursor_open(&db, &cur, query) != 0))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
database_info_list = (database_info_list_t*)calloc(1, sizeof(*database_info_list));
|
database_info_list = (database_info_list_t*)calloc(1, sizeof(*database_info_list));
|
||||||
|
@ -94,7 +94,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path,
|
|||||||
void database_info_list_free(database_info_list_t *list);
|
void database_info_list_free(database_info_list_t *list);
|
||||||
|
|
||||||
int database_cursor_open(libretrodb_t *db,
|
int database_cursor_open(libretrodb_t *db,
|
||||||
libretrodb_cursor_t *cur, const char *query);
|
libretrodb_cursor_t *cur, const char *path, const char *query);
|
||||||
|
|
||||||
int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur);
|
int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur);
|
||||||
|
|
||||||
|
@ -1161,9 +1161,7 @@ static int menu_database_parse_query(file_list_t *list, const char *path,
|
|||||||
libretrodb_t db;
|
libretrodb_t db;
|
||||||
libretrodb_cursor_t cur;
|
libretrodb_cursor_t cur;
|
||||||
|
|
||||||
if ((libretrodb_open(path, &db)) != 0)
|
if ((database_cursor_open(&db, &cur, path, query) != 0))
|
||||||
return -1;
|
|
||||||
if ((database_cursor_open(&db, &cur, query) != 0))
|
|
||||||
return -1;
|
return -1;
|
||||||
while (ret != -1)
|
while (ret != -1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user