Author: wyoung
Date: Thu Nov 29 11:17:35 2007
New Revision: 1925
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1925&view=rev
Log:
Removed Row::size_ data member: Row already keeps a vector for the field
data, and its size should always be the same as what we kept in size_.
If we find that there's a difference, it indicates a bug, not that it's
a mistake to do this.
Modified:
trunk/Wishlist
trunk/lib/row.cpp
trunk/lib/row.h
Modified: trunk/Wishlist
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1925&r1=1924&r2=1925&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Thu Nov 29 11:17:35 2007
@@ -107,8 +107,6 @@
o Add operator<< for Query, syntactic sugar for str(ostream&).
- o Is Row::size_ not redundant w.r.t. Row::data_.size()?
-
v3.0 "Maybe" Stuff
------------------
Modified: trunk/lib/row.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/row.cpp?rev=1925&r1=1924&r2=1925&view=diff
==============================================================================
--- trunk/lib/row.cpp (original)
+++ trunk/lib/row.cpp Thu Nov 29 11:17:35 2007
@@ -33,15 +33,12 @@
Row::Row(MYSQL_ROW d, const ResUse* r, const unsigned long* lengths,
bool throw_exceptions) :
OptionalExceptions(throw_exceptions),
-initialized_(false),
-size_(0)
+initialized_(false)
{
if (d && r) {
- size_ = r->num_fields();
- field_names_ = r->field_names();
-
- data_.reserve(size_);
- for (size_type i = 0; i < size_; ++i) {
+ size_type size = r->num_fields();
+ data_.reserve(size);
+ for (size_type i = 0; i < size; ++i) {
bool is_null = d[i] == 0;
data_.push_back(value_type(
is_null ? "NULL" : d[i],
@@ -50,6 +47,7 @@
is_null));
}
+ field_names_ = r->field_names();
initialized_ = true;
}
else if (throw_exceptions) {
Modified: trunk/lib/row.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/row.h?rev=1925&r1=1924&r2=1925&view=diff
==============================================================================
--- trunk/lib/row.h (original)
+++ trunk/lib/row.h Thu Nov 29 11:17:35 2007
@@ -101,8 +101,7 @@
/// \brief Default constructor
Row() :
- initialized_(false),
- size_(0)
+ initialized_(false)
{
}
@@ -110,8 +109,7 @@
Row(const Row& r) :
data_(r.data_.begin(), r.data_.end()),
field_names_(r.field_names_),
- initialized_(r.initialized_),
- size_(r.size_)
+ initialized_(r.initialized_)
{
}
@@ -128,7 +126,7 @@
~Row() { }
/// \brief Get the number of fields in the row.
- size_type size() const { return size_; }
+ size_type size() const { return data_.size(); }
/// \brief Assignment operator
Row& operator=(const Row& rhs)
@@ -136,7 +134,6 @@
data_.assign(rhs.data_.begin(), rhs.data_.end());
field_names_.assign(rhs.field_names_);
initialized_ = rhs.initialized_;
- size_ = rhs.size_;
return *this;
}
@@ -473,7 +470,6 @@
std::vector<value_type> data_;
RefCountedPointer<FieldNames> field_names_;
bool initialized_;
- size_type size_;
};
} // end namespace mysqlpp
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits