mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 12:53:00 -05:00
[db] Remove poorly performing and now unused _bymatch() functions
This commit is contained in:
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;");
|
||||
}
|
||||
|
||||
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
|
||||
db_file_inc_playcount(int id)
|
||||
{
|
||||
@@ -2063,30 +2041,6 @@ db_file_id_bypath(const char *path)
|
||||
#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
|
||||
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
|
||||
db_files_get_album_count(void);
|
||||
|
||||
int
|
||||
db_files_get_count_bymatch(const char *path);
|
||||
|
||||
void
|
||||
db_file_inc_playcount(int id);
|
||||
|
||||
@@ -524,9 +521,6 @@ db_file_path_byid(int id);
|
||||
int
|
||||
db_file_id_bypath(const char *path);
|
||||
|
||||
int
|
||||
db_file_id_bymatch(const char *path);
|
||||
|
||||
int
|
||||
db_file_id_byfile(const char *filename);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user