Author: wyoung
Date: Wed Nov  7 22:39:54 2007
New Revision: 1826

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1826&view=rev
Log:
Made ResUse::purge() a protected method.  There's been multiple code
snippets posted to the ML calling this lately, despite the fact that the
examples never do.

Modified:
    trunk/lib/result.cpp
    trunk/lib/result.h

Modified: trunk/lib/result.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/result.cpp?rev=1826&r1=1825&r2=1826&view=diff
==============================================================================
--- trunk/lib/result.cpp (original)
+++ trunk/lib/result.cpp Wed Nov  7 22:39:54 2007
@@ -200,6 +200,23 @@
 
 
 void
+ResUse::purge()
+{
+       if (result_) {
+               mysql_free_result(result_);
+               result_ = 0;
+       }
+
+       names_ = 0;
+
+       delete types_;
+       types_ = 0;
+
+       table_.erase();
+}
+
+
+void
 ResUse::reset_field_types()
 {
        delete types_;

Modified: trunk/lib/result.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/result.h?rev=1826&r1=1825&r2=1826&view=diff
==============================================================================
--- trunk/lib/result.h (original)
+++ trunk/lib/result.h Wed Nov  7 22:39:54 2007
@@ -144,26 +144,6 @@
                return mysql_num_fields(result_);
        }
        
-       /// \brief Free all resources held by the object.
-       ///
-       /// This class's destructor is little more than a call to purge(),
-       /// so you can think of this as a way to re-use a ResUse object,
-       /// to avoid having to completely re-create it.
-       void purge()
-       {
-               if (result_) {
-                       mysql_free_result(result_);
-                       result_ = 0;
-               }
-
-               names_ = 0;
-
-               delete types_;
-               types_ = 0;
-
-               table_.erase();
-       }
-
        /// \brief Return true if we have a valid result set
        ///
        /// This operator is primarily used to determine if a query was
@@ -313,6 +293,12 @@
        ///
        /// Self-copy is not allowed.
        void copy(const ResUse& other);
+
+       /// \brief Free all resources held by the object.
+       ///
+       /// This exists just to do things common to both copy() and the
+       /// dtor, both of which need to free allocated resources.
+       void purge();
 };
 
 


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

Reply via email to