Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / server_share / mongo_wrapper.h
blob93463afee658b36b90595a55d435449fd18b127a
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef MONGODB_WRAPPER_H
18 #define MONGODB_WRAPPER_H
20 #ifdef HAVE_MONGO
22 #include <mongo/client/dbclient.h>
23 #include <mongo/bson/bsonmisc.h>
25 using namespace mongo;
26 using namespace bson;
28 class CMongo {
29 public:
30 static void init();
31 static void insert(const std::string &collection, const std::string &json);
32 static CUniquePtr<DBClientCursor> query(const std::string &collection, const std::string &json);
33 static void update(const std::string &collection, const std::string &jsonQuery, const std::string &jsonObj, bool upsert=false, bool multi=false);
34 static void remove(const std::string &collection, const std::string &jsonQuer, bool justOne = false);
35 static std::string quote(const std::string &s);
36 static std::string id();
38 private:
39 static DBClientConnection conn;
40 static std::string dbname;
43 #endif
45 #endif // MONGODB_WRAPPER_H