1 // NeLNS - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef NL_MYSQL_HELPER_H
21 #define NL_MYSQL_HELPER_H
28 // we have to include windows.h because mysql.h uses it but not include it
30 # ifndef NL_COMP_MINGW
33 # include <winsock2.h>
35 typedef unsigned long ulong
;
40 #include "nel/misc/types_nl.h"
47 extern MYSQL
*DatabaseConnection
;
57 CMysqlResult() : Result(0) { }
58 CMysqlResult(MYSQL_RES
*result
)
60 if(Result
) mysql_free_result(Result
);
66 if(Result
) mysql_free_result(Result
);
69 CMysqlResult
& operator=(MYSQL_RES
*result
)
71 if(Result
) mysql_free_result(Result
);
76 operator MYSQL_RES
*() { return Result
; }
79 //we don't want user to do a copy
80 CMysqlResult(const CMysqlResult
&mysqlResult
){}
90 std::string
sqlQuery(const std::string
&query
);
91 std::string
sqlQuery(const std::string
&query
, sint32
&nbRow
, MYSQL_ROW
&firstRow
, CMysqlResult
&result
);
93 #endif // NL_MYSQL_HELPER_H
95 /* End of mysql_helper.h */