diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-05-24 15:09:24 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-05-24 15:09:24 +0200 |
commit | a8ad2278025467f7cc9c9974d7e82be5752fb697 (patch) | |
tree | 49186e5989be68e9139c9a951356d1ad93e68ac0 /src/modules | |
parent | 8501b9171c4064a2b383945693bb027eefffc2ab (diff) | |
download | mad-a8ad2278025467f7cc9c9974d7e82be5752fb697.tar mad-a8ad2278025467f7cc9c9974d7e82be5752fb697.zip |
Interface des UserManager ?berarbeitet
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/UserBackendMysql/UserBackendMysql.cpp | 20 | ||||
-rw-r--r-- | src/modules/UserBackendMysql/UserBackendMysql.h | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/modules/UserBackendMysql/UserBackendMysql.cpp b/src/modules/UserBackendMysql/UserBackendMysql.cpp index 139a416..9b960fd 100644 --- a/src/modules/UserBackendMysql/UserBackendMysql.cpp +++ b/src/modules/UserBackendMysql/UserBackendMysql.cpp @@ -132,7 +132,7 @@ void UserBackendMysql::configFinished() { } -boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql::getUserList() { +boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql::getUserList() throw(Net::Exception) { Net::ThreadManager::get()->detach(); mysql_ping(mysql); @@ -140,8 +140,8 @@ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql:: mysql_real_query(mysql, queryListUsers.c_str(), queryListUsers.length()); MYSQL_RES *result = mysql_use_result(mysql); - if(mysql_num_fields(result) < 4) - return boost::shared_ptr<std::map<unsigned long, Common::UserInfo> >(); // TODO Error + if(!result || mysql_num_fields(result) < 4) + throw Net::Exception(Net::Exception::NOT_AVAILABLE); boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > users(new std::map<unsigned long, Common::UserInfo>()); @@ -157,7 +157,7 @@ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql:: return users; } -boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long uid) { +boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long uid) throw(Net::Exception) { Net::ThreadManager::get()->detach(); mysql_ping(mysql); @@ -174,8 +174,8 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long mysql_real_query(mysql, query.c_str(), query.length()); MYSQL_RES *result = mysql_use_result(mysql); - if(mysql_num_fields(result) < 4) - return boost::shared_ptr<Common::UserInfo>(); // TODO Error + if(!result || mysql_num_fields(result) < 4) + throw Net::Exception(Net::Exception::NOT_AVAILABLE); MYSQL_ROW row = mysql_fetch_row(result); @@ -190,10 +190,10 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long return user; } - return boost::shared_ptr<Common::UserInfo>(); + throw Net::Exception(Net::Exception::NOT_AVAILABLE); } -boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql::getGroupList() { +boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql::getGroupList() throw(Net::Exception) { Net::ThreadManager::get()->detach(); mysql_ping(mysql); @@ -201,8 +201,8 @@ boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql: mysql_real_query(mysql, queryListGroups.c_str(), queryListGroups.length()); MYSQL_RES *result = mysql_use_result(mysql); - if(mysql_num_fields(result) < 2) - return boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> >(); // TODO Error + if(!result || mysql_num_fields(result) < 2) + throw Net::Exception(Net::Exception::NOT_AVAILABLE); boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > groups(new std::map<unsigned long, Common::GroupInfo>()); diff --git a/src/modules/UserBackendMysql/UserBackendMysql.h b/src/modules/UserBackendMysql/UserBackendMysql.h index 8a75a6b..1bf0f2b 100644 --- a/src/modules/UserBackendMysql/UserBackendMysql.h +++ b/src/modules/UserBackendMysql/UserBackendMysql.h @@ -50,10 +50,10 @@ class UserBackendMysql : public Server::UserBackend, private Common::Configurabl virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool); virtual void configFinished(); - virtual boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList(); - virtual boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid); + virtual boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList() throw(Net::Exception); + virtual boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid) throw(Net::Exception); - virtual boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList(); + virtual boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList() throw(Net::Exception); public: virtual ~UserBackendMysql() { |