[db] Remove db_admin_update and rename db_admin_add

This commit is contained in:
chme 2016-12-09 16:31:42 +01:00
parent e29539fa68
commit de61a3a851
3 changed files with 4 additions and 19 deletions

View File

@ -3947,7 +3947,7 @@ db_spotify_files_delete(void)
/* Admin */
int
db_admin_add(const char *key, const char *value)
db_admin_set(const char *key, const char *value)
{
#define Q_TMPL "INSERT OR REPLACE INTO admin (key, value) VALUES ('%q', '%q');"
char *query;
@ -4016,18 +4016,6 @@ db_admin_get(const char *key)
#undef Q_TMPL
}
int
db_admin_update(const char *key, const char *value)
{
#define Q_TMPL "UPDATE admin SET value='%q' WHERE key='%q';"
char *query;
query = sqlite3_mprintf(Q_TMPL, value, key);
return db_query_run(query, 1, 0);
#undef Q_TMPL
}
int
db_admin_delete(const char *key)
{
@ -4204,7 +4192,7 @@ queue_inc_version_and_notify()
return;
}
ret = db_admin_update("queue_version", version);
ret = db_admin_set("queue_version", version);
if (ret < 0)
{
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not update version in admin table: %d\n", queue_version);

View File

@ -670,14 +670,11 @@ db_spotify_files_delete(void);
/* Admin */
int
db_admin_add(const char *key, const char *value);
db_admin_set(const char *key, const char *value);
char *
db_admin_get(const char *key);
int
db_admin_update(const char *key, const char *value);
int
db_admin_delete(const char *key);

View File

@ -297,7 +297,7 @@ response_proces(struct http_client_ctx *ctx)
if (sk)
{
DPRINTF(E_LOG, L_LASTFM, "Got session key from LastFM: %s\n", sk);
db_admin_add("lastfm_sk", sk);
db_admin_set("lastfm_sk", sk);
if (lastfm_session_key)
free(lastfm_session_key);