updateUserSetting
This commit is contained in:
parent
c0a01941fc
commit
7cad738038
2 changed files with 12 additions and 0 deletions
|
@ -85,6 +85,7 @@ class SQLite3Backend : public StorageBackend
|
|||
void removeBuddy(long id) {}
|
||||
|
||||
void getUserSetting(long userId, const std::string &variable, int &type, std::string &value);
|
||||
void updateUserSetting(long userId, const std::string &variable, const std::string &value);
|
||||
|
||||
void beginTransaction();
|
||||
void commitTransaction();
|
||||
|
@ -101,6 +102,7 @@ class SQLite3Backend : public StorageBackend
|
|||
sqlite3_stmt *m_getUser;
|
||||
sqlite3_stmt *m_getUserSetting;
|
||||
sqlite3_stmt *m_setUserSetting;
|
||||
sqlite3_stmt *m_updateUserSetting;
|
||||
sqlite3_stmt *m_removeUser;
|
||||
sqlite3_stmt *m_removeUserBuddies;
|
||||
sqlite3_stmt *m_removeUserSettings;
|
||||
|
|
|
@ -87,6 +87,7 @@ SQLite3Backend::~SQLite3Backend(){
|
|||
FINALIZE_STMT(m_getBuddiesSettings);
|
||||
FINALIZE_STMT(m_getUserSetting);
|
||||
FINALIZE_STMT(m_setUserSetting);
|
||||
FINALIZE_STMT(m_updateUserSetting);
|
||||
sqlite3_close(m_db);
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +115,7 @@ bool SQLite3Backend::connect() {
|
|||
PREP_STMT(m_getBuddiesSettings, "SELECT buddy_id, type, var, value FROM " + m_prefix + "buddies_settings WHERE user_id=? ORDER BY buddy_id ASC");
|
||||
PREP_STMT(m_getUserSetting, "SELECT type, value FROM " + m_prefix + "users_settings WHERE user_id=? AND var=?");
|
||||
PREP_STMT(m_setUserSetting, "INSERT INTO " + m_prefix + "users_settings (user_id, var, type, value) VALUES (?,?,?,?)");
|
||||
PREP_STMT(m_updateUserSetting, "UPDATE " + m_prefix + "users_settings SET value=? WHERE user_id=? AND var=?");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -377,6 +379,14 @@ void SQLite3Backend::getUserSetting(long id, const std::string &variable, int &t
|
|||
}
|
||||
}
|
||||
|
||||
void SQLite3Backend::updateUserSetting(long id, const std::string &variable, const std::string &value) {
|
||||
BEGIN(m_updateUserSetting);
|
||||
BIND_STR(m_updateUserSetting, value);
|
||||
BIND_INT(m_updateUserSetting, id);
|
||||
BIND_STR(m_updateUserSetting, variable);
|
||||
EXECUTE_STATEMENT(m_updateUserSetting, "m_updateUserSetting");
|
||||
}
|
||||
|
||||
void SQLite3Backend::beginTransaction() {
|
||||
exec("BEGIN TRANSACTION;");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue