Author: wyoung
Date: Wed Nov 28 02:56:47 2007
New Revision: 1888

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1888&view=rev
Log:
- Removed ResUse::raw_result().  Not used within MySQL++ any more (see
  next item) and should be of no use by outsiders.
- Added ResUse::fetch_raw_row(): Query used to call mysql_fetch_row(
  ResUse::raw_result()) to get a raw MYSQL_ROW object, but this is all
  the power it really needs.
- Replaced calls in Query to mysql_fetch_lengths(ResUse::raw_result())
  to use already existing ResUse::fetch_lengths(), which does the same
  thing.
- Replaced a few calls of the raw C API functions within ResUse itself
  with calls to fetch_raw_row() and fetch_lengths().

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

Modified: trunk/lib/query.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1888&r1=1887&r2=1888&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Wed Nov 28 02:56:47 2007
@@ -964,11 +964,10 @@
 {
        ResUse result = use(s);
        while (1) {
-               MYSQL_ROW d = mysql_fetch_row(result.raw_result());
+               MYSQL_ROW d = result.fetch_raw_row();
                if (!d)
                        break;
-               Row row(d, &result, mysql_fetch_lengths(result.raw_result()),
-                               true);
+               Row row(d, &result, result.fetch_lengths(), true);
                if (!row)
                        break;
                con.push_back(typename Sequence::value_type(row));
@@ -981,11 +980,10 @@
 {
        ResUse result = use(s);
        while (1) {
-               MYSQL_ROW d = mysql_fetch_row(result.raw_result());
+               MYSQL_ROW d = result.fetch_raw_row();
                if (!d)
                        return;
-               Row row(d, &result, mysql_fetch_lengths(result.raw_result()),
-                               true);
+               Row row(d, &result, result.fetch_lengths(), true);
                if (!row)
                        break;
                con.insert(typename Set::value_type(row));

Modified: trunk/lib/result.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/result.h?rev=1888&r1=1887&r2=1888&view=diff
==============================================================================
--- trunk/lib/result.h (original)
+++ trunk/lib/result.h Wed Nov 28 02:56:47 2007
@@ -82,16 +82,16 @@
        /// \brief Copy another ResUse object's data into this object
        ResUse& operator =(const ResUse& other);
 
-       /// \brief Return raw MySQL C API result set
-       MYSQL_RES* raw_result()
-       {
-               return result_;
-       }
-
-       /// \brief Wraps mysql_fetch_row() in MySQL C API.
-       ///
-       /// This is not a thin wrapper. It does a lot of error checking before
-       /// returning the mysqlpp::Row object containing the row data.
+       /// \brief Returns the next row in a "use" query's result set
+       ///
+       /// <b>Design weakness warning:</b> Although Result (returned from
+       /// "store" queries) contains this method, it is of no use with such
+       /// result sets.
+       ///
+       /// This is a thick wrapper around mysql_fetch_row() in the MySQL
+       /// C API.  It does a lot of error checking before returning the Row
+       /// object containing the row data.  If you need the underlying C
+       /// API row data, call fetch_raw_row() instead.
        Row fetch_row() const
        {
                if (!result_) {
@@ -102,8 +102,8 @@
                                return Row();
                        }
                }
-               MYSQL_ROW row = mysql_fetch_row(result_);
-               unsigned long* length = mysql_fetch_lengths(result_);
+               MYSQL_ROW row = fetch_raw_row();
+               unsigned long* length = fetch_lengths();
                if (!row || !length) {
                        if (throw_exceptions()) {
                                throw EndOfResults();
@@ -114,6 +114,14 @@
                }
                return Row(row, this, length, throw_exceptions());
        }
+
+       /// \brief Wraps mysql_fetch_row() in MySQL C API.
+       ///
+       /// \internal You almost certainly want to call fetch_row() instead.
+       /// It is anticipated that this is only useful within the library,
+       /// to implement higher-level query types on top of raw "use"
+       /// queries. Query::storein() uses it, for example.
+       MYSQL_ROW fetch_raw_row() const { return mysql_fetch_row(result_); }
 
        /// \brief Wraps mysql_fetch_lengths() in MySQL C API.
        unsigned long *fetch_lengths() const


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

Reply via email to