Author: mysqlpp
Date: Sun Dec  2 15:54:41 2007
New Revision: 1945

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1945&view=rev
Log:
Moved Connection::affected_rows(), info() and insert_id() methods to
class Query, as they relate to the most recently-executed query.  (Query
actually already had private versions of these that delegated to
Connection.  Now they just delegate to DBDriver, and are public.)

Modified:
    trunk/lib/connection.cpp
    trunk/lib/connection.h
    trunk/lib/query.cpp
    trunk/lib/query.h

Modified: trunk/lib/connection.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.cpp?rev=1945&r1=1944&r2=1945&view=diff
==============================================================================
--- trunk/lib/connection.cpp (original)
+++ trunk/lib/connection.cpp Sun Dec  2 15:54:41 2007
@@ -68,13 +68,6 @@
 }
 
 
-ulonglong
-Connection::affected_rows()
-{
-       return driver()->affected_rows();
-}
-
-
 void
 Connection::build_error_message(const char* core)
 {
@@ -177,20 +170,6 @@
 Connection::error() const
 {
        return error_message_.size() ? error_message_.c_str() : 
driver_->error();
-}
-
-
-std::string
-Connection::info()
-{
-       return driver()->query_info();
-}
-
-
-ulonglong
-Connection::insert_id()
-{
-       return driver()->insert_id();
 }
 
 

Modified: trunk/lib/connection.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.h?rev=1945&r1=1944&r2=1945&view=diff
==============================================================================
--- trunk/lib/connection.h (original)
+++ trunk/lib/connection.h Sun Dec  2 15:54:41 2007
@@ -116,9 +116,6 @@
        /// \brief Destroy object
        virtual ~Connection();
 
-       /// \brief Return the number of rows affected by the last query
-       ulonglong affected_rows();
-
        /// \brief Get version of library underpinning the current database
        /// driver.
        std::string client_info() const;
@@ -192,18 +189,6 @@
        /// Returns either a MySQL++-specific error message if one exists,
        /// or one from the current database driver otherwise.
        const char* error() const;
-
-       /// \brief Returns information about the most recently executed
-       /// query.
-       std::string info();
-
-       /// \brief Get ID generated for an AUTO_INCREMENT column in the
-       /// previous INSERT query.
-       ///
-       /// \retval 0 if the previous query did not generate an ID.  Use
-       /// the SQL function LAST_INSERT_ID() if you need the last ID
-       /// generated by any query, not just the previous one.
-       ulonglong insert_id();
 
        /// \brief Get information about the IPC connection to the
        /// database server

Modified: trunk/lib/query.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1945&r1=1944&r2=1945&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Sun Dec  2 15:54:41 2007
@@ -69,7 +69,7 @@
 ulonglong
 Query::affected_rows()
 {
-       return conn_->affected_rows();
+       return conn_->driver()->affected_rows();
 }
 
 
@@ -204,14 +204,14 @@
 std::string
 Query::info()
 {
-       return conn_->info();
+       return conn_->driver()->query_info();
 }
 
 
 ulonglong
 Query::insert_id()
 {
-       return conn_->insert_id();
+       return conn_->driver()->insert_id();
 }
 
 

Modified: trunk/lib/query.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1945&r1=1944&r2=1945&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Sun Dec  2 15:54:41 2007
@@ -147,6 +147,9 @@
        /// what values they have in the original.
        Query(const Query& q);
 
+       /// \brief Return the number of rows affected by the last query
+       ulonglong affected_rows();
+
        /// \brief Return a SQL-escaped version of a character buffer
        ///
        /// \param ps pointer to C++ string to hold escaped version; if
@@ -217,6 +220,18 @@
        /// 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;
+
+       /// \brief Returns information about the most recently executed
+       /// query.
+       std::string info();
+
+       /// \brief Get ID generated for an AUTO_INCREMENT column in the
+       /// previous INSERT query.
+       ///
+       /// \retval 0 if the previous query did not generate an ID.  Use
+       /// the SQL function LAST_INSERT_ID() if you need the last ID
+       /// generated by any query, not just the previous one.
+       ulonglong insert_id();
 
        /// \brief Assign another query's state to this object
        ///
@@ -960,9 +975,6 @@
        std::stringbuf sbuffer_;
 
        //// Internal support functions
-       ulonglong affected_rows();
-       ulonglong insert_id();
-       std::string info();
        char* preview_char();
 
        /// \brief Process a parameterized query list.


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

Reply via email to