]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/MySQL/MySQLItemDAO.h
1 #ifndef __GS__MYSQLITEMDAO_H__
2 #define __GS__MYSQLITEMDAO_H__
4 #include <GameServ/GameLayer/GameObjects/ItemGO.h>
5 using GameServ::GameLayer::GameObjects::ItemGO
;
6 #include <GameServ/DataLayer/IItemDAO.h>
7 using GameServ::DataLayer::DataAccessObjects::IItemDAO
;
9 #include <boost/shared_ptr.hpp>
10 using boost::shared_ptr
;
18 namespace GameServ
{ namespace DataLayer
{ namespace MySQL
20 //! MySQL implementation of IItemDAO interface
22 If you're using an MySQL datasource, you will be using this
25 sql_create_22(item
, 1, 0,
26 mysqlpp::sql_varchar
, id
,
27 mysqlpp::sql_varchar
, name
,
28 mysqlpp::sql_int
, strengthhigh
,
29 mysqlpp::sql_int
, strengthlow
,
30 mysqlpp::sql_int
, defensehigh
,
31 mysqlpp::sql_int
, defenselow
,
32 mysqlpp::sql_int
, healthhigh
,
33 mysqlpp::sql_int
, healthlow
,
34 mysqlpp::sql_int
, goldhigh
,
35 mysqlpp::sql_int
, goldlow
,
36 mysqlpp::sql_int
, experiencehigh
,
37 mysqlpp::sql_int
, experiencelow
,
38 mysqlpp::sql_int
, startinguses
,
39 mysqlpp::sql_varchar
, type
,
40 mysqlpp::sql_int
, bankhigh
,
41 mysqlpp::sql_int
, banklow
,
42 mysqlpp::sql_int
, forestfightshigh
,
43 mysqlpp::sql_int
, forestfightslow
,
44 mysqlpp::sql_int
, playerfightshigh
,
45 mysqlpp::sql_int
, playerfightslow
,
46 mysqlpp::sql_int
, maxhealthhigh
,
47 mysqlpp::sql_int
, maxhealthlow
);
49 class MySQLItemDAO
: public IItemDAO
52 // Ctors, Dtors ///////////////////////////////////////////////////////
54 virtual ~MySQLItemDAO();
56 // Methods ////////////////////////////////////////////////////////////
57 virtual shared_ptr
<ItemGO
> GetById(const string
&Id
) const;
59 virtual bool IdExists(const string
&Id
) const;
65 // Helper Methods /////////////////////////////////////////////////////
67 //! Creates the ItemGO found at iterator position
68 shared_ptr
<ItemGO
> CreateItemFromItemSSQLS(const item
&i
) const;
70 //! Get the Item database mysql path
71 string
GetItemTableName(void) const;
73 void Initialize(const string
&tablename
);
75 } } } // GameServ.DataLayer.DataAccessObjects.MySQL
77 #endif // __GS__MYSQLITEMDAO_H__