Author: wyoung
Date: Fri Jul 13 07:01:11 2007
New Revision: 1693

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1693&view=rev
Log:
Changed Connection::ping() return value from int to bool, indicating
success in the MySQL++ way, instead of the C API way.

Modified:
    trunk/Wishlist
    trunk/lib/connection.cpp
    trunk/lib/connection.h

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1693&r1=1692&r2=1693&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Fri Jul 13 07:01:11 2007
@@ -102,10 +102,6 @@
           http://lists.mysql.com/plusplus/4952
           http://lists.mysql.com/plusplus/4960
     
-    o Several MySQL++ functions wrap the MySQL C API too literally:
-      they indicate success by returning 0 instead of true, as most
-      other wrapper functions do.
-
     o Apply Waba's patch allowing Null<T> fields in SSQLSes:
       
           http://lists.mysql.com/plusplus/5433

Modified: trunk/lib/connection.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.cpp?rev=1693&r1=1692&r2=1693&view=diff
==============================================================================
--- trunk/lib/connection.cpp (original)
+++ trunk/lib/connection.cpp Fri Jul 13 07:01:11 2007
@@ -749,18 +749,18 @@
 }
 
 
-int
+bool
 Connection::ping()
 {
        if (connected()) {
                error_message_.clear();
-               return mysql_ping(&mysql_);
+               return !mysql_ping(&mysql_);
        }
        else {
                // Not connected, and we've forgotten everything we need in
                // order to re-connect, if we once were connected.
                build_error_message("ping database server");
-               return 1;
+               return false;
        }
 }
 

Modified: trunk/lib/connection.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.h?rev=1693&r1=1692&r2=1693&view=diff
==============================================================================
--- trunk/lib/connection.h (original)
+++ trunk/lib/connection.h Fri Jul 13 07:01:11 2007
@@ -270,16 +270,15 @@
 
        /// \brief "Pings" the MySQL database
        ///
-       /// Wraps \c mysql_ping() in the C API.  As a result, this function
-       /// will try to reconnect to the server if the connection has been
-       /// dropped.
+       /// This function will try to reconnect to the server if the 
+       /// connection has been dropped.  Wraps \c mysql_ping() in the C API.
        /// 
-       /// \retval 0 if server is responding, regardless of whether we had
+       /// \retval true if server is responding, regardless of whether we had
        /// to reconnect or not
-       /// \retval nonzero if either we already know the connection is down
+       /// \retval false if either we already know the connection is down
        /// and cannot re-establish it, or if the server did not respond to
        /// the ping and we could not re-establish the connection.
-       int ping();
+       bool ping();
 
        /// \brief Kill a MySQL server thread
        ///


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to