Author: wyoung
Date: Fri Jul 13 02:30:50 2007
New Revision: 1685
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1685&view=rev
Log:
Changed return value of Query::error() to const char* from std::string.
There's no point in making a copy of the string here. Also, made the
method const, as it doesn't change Query, it just delegates to
Connection::error()
Modified:
trunk/Wishlist
trunk/lib/connection.h
trunk/lib/query.cpp
trunk/lib/query.h
Modified: trunk/Wishlist
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1685&r1=1684&r2=1685&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Fri Jul 13 02:30:50 2007
@@ -67,9 +67,6 @@
o Save error message built in Connection::bad_option() in an
instance variable, used by Connection::error() when set.
Useful when exceptions are disabled.
-
- o Connection::error() returns const char*, while Query::error()
- returns std::string. Pick one.
o Remove MutableColData. It's only used within myset.h, and that
usage is inefficient to the point of wanting replacement anyway.
Modified: trunk/lib/connection.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.h?rev=1685&r1=1684&r2=1685&view=diff
==============================================================================
--- trunk/lib/connection.h (original)
+++ trunk/lib/connection.h Fri Jul 13 02:30:50 2007
@@ -237,10 +237,7 @@
/// this connection.
///
/// Simply wraps \c mysql_error() in the C API.
- const char* error()
- {
- return mysql_error(&mysql_);
- }
+ const char* error() { return mysql_error(&mysql_); }
/// \brief Return last MySQL error number associated with this
/// connection
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1685&r1=1684&r2=1685&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Fri Jul 13 02:30:50 2007
@@ -81,13 +81,6 @@
Query::affected_rows() const
{
return conn_->affected_rows();
-}
-
-
-std::string
-Query::error()
-{
- return conn_->error();
}
Modified: trunk/lib/query.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1685&r1=1684&r2=1685&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Fri Jul 13 02:30:50 2007
@@ -175,10 +175,9 @@
/// \brief Get the last error message that was set.
///
- /// This class has an internal error message string, but if it
- /// isn't set, we return the last error message that happened
- /// on the connection we're bound to instead.
- std::string error();
+ /// This just delegates to Connection::error(). Query has nothing
+ /// extra to say, so use either, as makes sense in your program.
+ const char* error() const { return conn_->error(); }
/// \brief Treat the contents of the query string as a template
/// query.
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits