* Now MySQL parts of early_announce and conference code work also with

latest MySQL++ lib version 3.0.0.


git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1036 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Juha Heinanen 18 years ago
parent 96198e78e1
commit ffe996810a

@ -107,16 +107,26 @@ int get_audio_file(string message, string domain, string language,
DBG("Query string <%s>\n", query_string.c_str());
query << query_string;
#ifdef VERSION2
mysqlpp::Result res = query.store();
#else
mysqlpp::StoreQueryResult res = query.store();
#endif
mysqlpp::Row row;
if (res) {
if ((res.num_rows() > 0) && (row = res.at(0))) {
FILE *file;
unsigned long length = row.raw_string(0).size();
file = fopen((*audio_file).c_str(), "wb");
#ifdef VERSION2
unsigned long length = row.raw_string(0).size();
fwrite(row.at(0).data(), 1, length, file);
#else
mysqlpp::String s = row[0];
fwrite(s.data(), 1, s.length(), file);
#endif
fclose(file);
return 1;
} else {
@ -179,7 +189,11 @@ int ConferenceFactory::onLoad()
try {
#ifdef VERSION2
Connection.set_option(Connection.opt_reconnect, true);
#else
Connection.set_option(new mysqlpp::ReconnectOption(true));
#endif
Connection.connect(mysql_db.c_str(), mysql_server.c_str(),
mysql_user.c_str(), mysql_passwd.c_str());
if (!Connection) {

@ -22,6 +22,9 @@ module_cflags =
#
# in /usr/include/mysql++/row.h.
#
# If your MySQL++ version is less than 3.0.0, you must add -DVERSION2
# to module_flags below.
#
#module_ldflags = -lmysqlpp
#module_cflags = -DUSE_MYSQL -I/usr/include/mysql++ -I/usr/include/mysql

@ -99,16 +99,26 @@ int get_announce_msg(string application, string message, string user,
DBG("Query string <%s>\n", query_string.c_str());
query << query_string;
#ifdef VERSION2
mysqlpp::Result res = query.store();
#else
mysqlpp::StoreQueryResult res = query.store();
#endif
mysqlpp::Row row;
if (res) {
if ((res.num_rows() > 0) && (row = res.at(0))) {
FILE *file;
unsigned long length = row.raw_string(0).size();
file = fopen((*audio_file).c_str(), "wb");
#ifdef VERSION2
unsigned long length = row.raw_string(0).size();
fwrite(row.at(0).data(), 1, length, file);
#else
mysqlpp::String s = row[0];
fwrite(s.data(), 1, s.length(), file);
#endif
fclose(file);
return 1;
} else {
@ -200,7 +210,11 @@ int EarlyAnnounceFactory::onLoad()
try {
#ifdef VERSION2
Connection.set_option(Connection.opt_reconnect, true);
#else
Connection.set_option(new mysqlpp::ReconnectOption(true));
#endif
Connection.connect(mysql_db.c_str(), mysql_server.c_str(),
mysql_user.c_str(), mysql_passwd.c_str());
if (!Connection) {

@ -5,8 +5,9 @@ module_cflags =
# Uncomment last two lines if you want to keep audio in MySQL database.
# You must also install MySQL++ development files and libraries
# (http://www.tangentsoft.net/mysql++/). If your MySQL++ version is older
# than 2.2, you must insert
# (http://www.tangentsoft.net/mysql++/).
#
# If your MySQL++ version is older than 2.2, you must insert
#
# const std::string & raw_string(int i) const
# {
@ -15,6 +16,9 @@ module_cflags =
#
# in /usr/include/mysql++/row.h.
#
# If your MySQL++ version is less than 3.0.0, you must add -DVERSION2
# to module_flags below.
#
#module_ldflags = -lmysqlpp
#module_cflags = -DUSE_MYSQL -I/usr/include/mysql++ -I/usr/include/mysql

Loading…
Cancel
Save