]>
Commit | Line | Data |
---|---|---|
24f452e8 | 1 | #ifndef __GS__MYSQLITEMDAO_H__\r |
2 | #define __GS__MYSQLITEMDAO_H__\r | |
3 | \r | |
4 | #include <GameServ/GameLayer/GameObjects/ItemGO.h>\r | |
5 | using GameServ::GameLayer::GameObjects::ItemGO;\r | |
6 | #include <GameServ/DataLayer/IItemDAO.h>\r | |
7 | using GameServ::DataLayer::DataAccessObjects::IItemDAO;\r | |
8 | \r | |
9 | #include <boost/shared_ptr.hpp>\r | |
10 | using boost::shared_ptr;\r | |
11 | \r | |
12 | #include <string>\r | |
13 | using std::string;\r | |
14 | \r | |
15 | #include <mysql++.h>\r | |
16 | #include <ssqls.h>\r | |
17 | \r | |
18 | namespace GameServ { namespace DataLayer { namespace MySQL\r | |
19 | {\r | |
20 | //! MySQL implementation of IItemDAO interface\r | |
21 | /*!\r | |
22 | If you're using an MySQL datasource, you will be using this\r | |
23 | DAO to access Items.\r | |
24 | */\r | |
cdc7e562 | 25 | sql_create_22(item, 1, 0,\r |
26 | mysqlpp::sql_int_unsigned, id,\r | |
24f452e8 | 27 | mysqlpp::sql_varchar, name,\r |
28 | mysqlpp::sql_int, strengthhigh,\r | |
29 | mysqlpp::sql_int, strengthlow,\r | |
30 | mysqlpp::sql_int, defensehigh,\r | |
31 | mysqlpp::sql_int, defenselow,\r | |
32 | mysqlpp::sql_int, healthhigh,\r | |
33 | mysqlpp::sql_int, healthlow,\r | |
34 | mysqlpp::sql_int, goldhigh,\r | |
35 | mysqlpp::sql_int, goldlow,\r | |
36 | mysqlpp::sql_int, experiencehigh,\r | |
37 | mysqlpp::sql_int, experiencelow,\r | |
38 | mysqlpp::sql_int, startinguses,\r | |
39 | mysqlpp::sql_varchar, type,\r | |
40 | mysqlpp::sql_int, bankhigh,\r | |
41 | mysqlpp::sql_int, banklow,\r | |
42 | mysqlpp::sql_int, forestfightshigh,\r | |
43 | mysqlpp::sql_int, forestfightslow,\r | |
44 | mysqlpp::sql_int, playerfightshigh,\r | |
45 | mysqlpp::sql_int, playerfightslow,\r | |
46 | mysqlpp::sql_int, maxhealthhigh,\r | |
47 | mysqlpp::sql_int, maxhealthlow);\r | |
48 | \r | |
49 | class MySQLItemDAO : public IItemDAO\r | |
50 | {\r | |
51 | public:\r | |
52 | // Ctors, Dtors ///////////////////////////////////////////////////////\r | |
53 | MySQLItemDAO(void);\r | |
54 | virtual ~MySQLItemDAO();\r | |
55 | \r | |
56 | // Methods ////////////////////////////////////////////////////////////\r | |
57 | virtual shared_ptr<ItemGO> GetById(const string &Id) const;\r | |
58 | \r | |
59 | virtual bool IdExists(const string &Id) const;\r | |
cdc7e562 | 60 | \r |
61 | virtual void Insert(shared_ptr<ItemGO> spItem);\r | |
62 | virtual void Update(shared_ptr<ItemGO> spItem);\r | |
24f452e8 | 63 | \r |
64 | private:\r | |
65 | //! Data mysql\r | |
66 | string mTableName;\r | |
67 | \r | |
68 | // Helper Methods /////////////////////////////////////////////////////\r | |
69 | \r | |
70 | //! Creates the ItemGO found at iterator position\r | |
71 | shared_ptr<ItemGO> CreateItemFromItemSSQLS(const item &i) const;\r | |
cdc7e562 | 72 | item CreateItemSSQLSFromItem(shared_ptr<ItemGO> spItem) const;\r |
24f452e8 | 73 | \r |
74 | //! Get the Item database mysql path\r | |
75 | string GetItemTableName(void) const;\r | |
76 | \r | |
77 | void Initialize(const string &tablename);\r | |
78 | };\r | |
79 | } } } // GameServ.DataLayer.DataAccessObjects.MySQL\r | |
80 | \r | |
81 | #endif // __GS__MYSQLITEMDAO_H__ |