Author: jih
Date: 2008-07-12 09:35:34 +0200 (Sat, 12 Jul 2008)
New Revision: 1036

Modified:
   branches/1.0.0/apps/conference/Conference.cpp
   branches/1.0.0/apps/conference/Makefile
   branches/1.0.0/apps/early_announce/EarlyAnnounce.cpp
   branches/1.0.0/apps/early_announce/Makefile
   trunk/apps/conference/Conference.cpp
   trunk/apps/conference/Makefile
   trunk/apps/early_announce/EarlyAnnounce.cpp
   trunk/apps/early_announce/Makefile
Log:
* Now MySQL parts of early_announce and conference code work also with
  latest MySQL++ lib version 3.0.0.


Modified: branches/1.0.0/apps/conference/Conference.cpp
===================================================================
--- branches/1.0.0/apps/conference/Conference.cpp       2008-07-09 20:17:06 UTC 
(rev 1035)
+++ branches/1.0.0/apps/conference/Conference.cpp       2008-07-12 07:35:34 UTC 
(rev 1036)
@@ -107,16 +107,26 @@
     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;
+       file = fopen((*audio_file).c_str(), "wb");
+#ifdef VERSION2
        unsigned long length = row.raw_string(0).size();
-       file = fopen((*audio_file).c_str(), "wb");
        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 @@
 
   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) {

Modified: branches/1.0.0/apps/conference/Makefile
===================================================================
--- branches/1.0.0/apps/conference/Makefile     2008-07-09 20:17:06 UTC (rev 
1035)
+++ branches/1.0.0/apps/conference/Makefile     2008-07-12 07:35:34 UTC (rev 
1036)
@@ -22,6 +22,9 @@
 #
 # 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
 

Modified: branches/1.0.0/apps/early_announce/EarlyAnnounce.cpp
===================================================================
--- branches/1.0.0/apps/early_announce/EarlyAnnounce.cpp        2008-07-09 
20:17:06 UTC (rev 1035)
+++ branches/1.0.0/apps/early_announce/EarlyAnnounce.cpp        2008-07-12 
07:35:34 UTC (rev 1036)
@@ -99,16 +99,26 @@
        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;
+               file = fopen((*audio_file).c_str(), "wb");
+#ifdef VERSION2
                unsigned long length = row.raw_string(0).size();
-               file = fopen((*audio_file).c_str(), "wb");
                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 @@
 
   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) {

Modified: branches/1.0.0/apps/early_announce/Makefile
===================================================================
--- branches/1.0.0/apps/early_announce/Makefile 2008-07-09 20:17:06 UTC (rev 
1035)
+++ branches/1.0.0/apps/early_announce/Makefile 2008-07-12 07:35:34 UTC (rev 
1036)
@@ -5,9 +5,10 @@
 
 # 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
 #      {
 #              return data_[i];
@@ -15,6 +16,9 @@
 #
 # 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
 

Modified: trunk/apps/conference/Conference.cpp
===================================================================
--- trunk/apps/conference/Conference.cpp        2008-07-09 20:17:06 UTC (rev 
1035)
+++ trunk/apps/conference/Conference.cpp        2008-07-12 07:35:34 UTC (rev 
1036)
@@ -107,16 +107,26 @@
     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;
+       file = fopen((*audio_file).c_str(), "wb");
+#ifdef VERSION2
        unsigned long length = row.raw_string(0).size();
-       file = fopen((*audio_file).c_str(), "wb");
        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 @@
 
   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) {

Modified: trunk/apps/conference/Makefile
===================================================================
--- trunk/apps/conference/Makefile      2008-07-09 20:17:06 UTC (rev 1035)
+++ trunk/apps/conference/Makefile      2008-07-12 07:35:34 UTC (rev 1036)
@@ -22,6 +22,9 @@
 #
 # 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
 

Modified: trunk/apps/early_announce/EarlyAnnounce.cpp
===================================================================
--- trunk/apps/early_announce/EarlyAnnounce.cpp 2008-07-09 20:17:06 UTC (rev 
1035)
+++ trunk/apps/early_announce/EarlyAnnounce.cpp 2008-07-12 07:35:34 UTC (rev 
1036)
@@ -99,16 +99,26 @@
        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;
+               file = fopen((*audio_file).c_str(), "wb");
+#ifdef VERSION2
                unsigned long length = row.raw_string(0).size();
-               file = fopen((*audio_file).c_str(), "wb");
                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 @@
 
   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) {

Modified: trunk/apps/early_announce/Makefile
===================================================================
--- trunk/apps/early_announce/Makefile  2008-07-09 20:17:06 UTC (rev 1035)
+++ trunk/apps/early_announce/Makefile  2008-07-12 07:35:34 UTC (rev 1036)
@@ -5,9 +5,10 @@
 
 # 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
 #      {
 #              return data_[i];
@@ -15,6 +16,9 @@
 #
 # 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
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to