Author: wyoung
Date: Fri Dec 21 03:49:30 2007
New Revision: 2006

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2006&view=rev
Log:
Added optional parameter to DBDriver::fetch_field() allowing it to call
mysql_fetch_field_direct() if you tell it explicitly what field number
you're interested in.  If you don't, it reverts to the old behavior,
returning the "next" field.

Modified:
    trunk/lib/dbdriver.h

Modified: trunk/lib/dbdriver.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/dbdriver.h?rev=2006&r1=2005&r2=2006&view=diff
==============================================================================
--- trunk/lib/dbdriver.h (original)
+++ trunk/lib/dbdriver.h Fri Dec 21 03:49:30 2007
@@ -206,9 +206,21 @@
        /// \brief Returns information about a particular field in a result
        /// set
        ///
-       /// Wraps \c mysql_fetch_field() in MySQL C API.
-       MYSQL_FIELD* fetch_field(MYSQL_RES* res) const
-                       { return mysql_fetch_field(res); }
+       /// \param res result set to fetch field information for
+       /// \param i field number to fetch information for, if given
+       ///
+       /// If i parameter is given, this call is like a combination of
+       /// field_seek() followed by fetch_field() without the i parameter,
+       /// which otherwise just iterates through the set of fields in the
+       /// given result set.
+       ///
+       /// Wraps \c mysql_fetch_field() and mysql_fetch_field_direct() in
+       /// MySQL C API.  (Which one it uses depends on i parameter.)
+       MYSQL_FIELD* fetch_field(MYSQL_RES* res, size_t i = UINT_MAX) const
+       {
+               return i == UINT_MAX ? mysql_fetch_field(res) :
+                               mysql_fetch_field_direct(res, i);
+       }
 
        /// \brief Jumps to the given field within the result set
        ///


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

Reply via email to