mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-19 02:15:18 -04:00
[db] Remove poorly performing and now unused _bymatch() functions
This commit is contained in:
parent
322abb8274
commit
bf8fa1c3f0
46
src/db.c
46
src/db.c
@ -1854,28 +1854,6 @@ db_files_get_album_count(void)
|
|||||||
return db_get_one_int("SELECT COUNT(DISTINCT songalbumid) FROM files f WHERE f.disabled = 0;");
|
return db_get_one_int("SELECT COUNT(DISTINCT songalbumid) FROM files f WHERE f.disabled = 0;");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
db_files_get_count_bymatch(const char *path)
|
|
||||||
{
|
|
||||||
#define Q_TMPL "SELECT COUNT(*) FROM files f WHERE f.path LIKE '%%%q';"
|
|
||||||
char *query;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
query = sqlite3_mprintf(Q_TMPL, path);
|
|
||||||
if (!query)
|
|
||||||
{
|
|
||||||
DPRINTF(E_LOG, L_DB, "Out of memory making count query string.\n");
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = db_get_one_int(query);
|
|
||||||
sqlite3_free(query);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
#undef Q_TMPL
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
db_file_inc_playcount(int id)
|
db_file_inc_playcount(int id)
|
||||||
{
|
{
|
||||||
@ -2063,30 +2041,6 @@ db_file_id_bypath(const char *path)
|
|||||||
#undef Q_TMPL
|
#undef Q_TMPL
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
db_file_id_bymatch(const char *path)
|
|
||||||
{
|
|
||||||
#define Q_TMPL "SELECT f.id FROM files f WHERE f.path LIKE '%%%q';"
|
|
||||||
char *query;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
query = sqlite3_mprintf(Q_TMPL, path);
|
|
||||||
if (!query)
|
|
||||||
{
|
|
||||||
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = db_file_id_byquery(query);
|
|
||||||
|
|
||||||
sqlite3_free(query);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
#undef Q_TMPL
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
db_file_id_byfile(const char *filename)
|
db_file_id_byfile(const char *filename)
|
||||||
{
|
{
|
||||||
|
6
src/db.h
6
src/db.h
@ -503,9 +503,6 @@ db_files_get_artist_count(void);
|
|||||||
int
|
int
|
||||||
db_files_get_album_count(void);
|
db_files_get_album_count(void);
|
||||||
|
|
||||||
int
|
|
||||||
db_files_get_count_bymatch(const char *path);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
db_file_inc_playcount(int id);
|
db_file_inc_playcount(int id);
|
||||||
|
|
||||||
@ -524,9 +521,6 @@ db_file_path_byid(int id);
|
|||||||
int
|
int
|
||||||
db_file_id_bypath(const char *path);
|
db_file_id_bypath(const char *path);
|
||||||
|
|
||||||
int
|
|
||||||
db_file_id_bymatch(const char *path);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
db_file_id_byfile(const char *filename);
|
db_file_id_byfile(const char *filename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user