diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-27 23:15:05 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-06-27 23:15:05 -0400 |
commit | 28e12bc24a9c85f4f0d1e37567618ec39cb501f6 (patch) | |
tree | cc70ebeef95a9d95174afe3ef038b0d673346f58 /src/modules/mysql/db_mysql.h | |
parent | 051ebe3eea0f8529b64c0e443c61103ba2f7dee8 (diff) |
The next of a few "CBX OCDing over code style" commits, maybe the last.
NOTES: I have been unable to compile the db_mysql_* functions on my system here, so those are untested. db-convert seems to be badly programmed and needs more work in my opinion.
Diffstat (limited to 'src/modules/mysql/db_mysql.h')
-rw-r--r-- | src/modules/mysql/db_mysql.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/modules/mysql/db_mysql.h b/src/modules/mysql/db_mysql.h index f2885408f..34ae50931 100644 --- a/src/modules/mysql/db_mysql.h +++ b/src/modules/mysql/db_mysql.h @@ -1,3 +1,6 @@ +#ifndef DB_MYSQL_H +#define DB_MYSQL_H + #include "module.h" struct NickAliasFlagInfo @@ -117,15 +120,15 @@ MemoFlagInfo MemoFlags[] = { #define MYSQLPP_MYSQL_HEADERS_BURIED #include <mysql++/mysql++.h> -inline std::string SQLAssign(const mysqlpp::String& s) { return s.c_str(); } +inline std::string SQLAssign(const mysqlpp::String &s) { return s.c_str(); } class DBMySQL; static DBMySQL *me; -bool ExecuteQuery(mysqlpp::Query& query) +bool ExecuteQuery(mysqlpp::Query &query) { Alog(LOG_DEBUG) << "MySQL: " << query.str(); - + if (!query.execute()) { Alog() << "MySQL: error executing query: " << query.error(); @@ -135,15 +138,13 @@ bool ExecuteQuery(mysqlpp::Query& query) return true; } -mysqlpp::StoreQueryResult StoreQuery(mysqlpp::Query& query) +mysqlpp::StoreQueryResult StoreQuery(mysqlpp::Query &query) { Alog(LOG_DEBUG) << "MySQL: " << query.str(); mysqlpp::StoreQueryResult result = query.store(); if (!result) - { Alog() << "MySQL: error executing query: " << query.error(); - } return result; } @@ -195,7 +196,7 @@ class DBMySQL : public Module delete Con; throw ModuleException(Error.c_str()); } - + mysqlpp::Query query(Con); query << "SET NAMES 'utf8'"; ExecuteQuery(query); @@ -208,3 +209,4 @@ class DBMySQL : public Module } }; +#endif // DB_MYSQL_H |