Author: wyoung
Date: Wed Nov 28 10:08:59 2007
New Revision: 1915

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1915&view=rev
Log:
Alphabetized functions in Connection class declaration to make it easier
to find things.

Modified:
    trunk/lib/connection.h

Modified: trunk/lib/connection.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.h?rev=1915&r1=1914&r2=1915&view=diff
==============================================================================
--- trunk/lib/connection.h (original)
+++ trunk/lib/connection.h Wed Nov 28 10:08:59 2007
@@ -159,6 +159,37 @@
        /// \brief Destroy object
        virtual ~Connection();
 
+       /// \brief Return the number of rows affected by the last query
+       ///
+       /// Simply wraps \c mysql_affected_rows() in the C API.
+       my_ulonglong affected_rows()
+       {
+               return mysql_affected_rows(&mysql_);
+       }
+
+       /// \brief Insert C API version we're linked against into C++ stream
+       ///
+       /// Version will be of the form X.Y.Z, where X is the major version
+       /// number, Y the minor version, and Z the bug fix number.
+       std::ostream& api_version(std::ostream& os);
+
+       /// \brief Get MySQL client library version
+       ///
+       /// Simply wraps \c mysql_get_client_info() in the C API.
+       std::string client_info()
+       {
+               return std::string(mysql_get_client_info());
+       }
+
+       /// \brief Close connection to MySQL server.
+       ///
+       /// Closes the connection to the MySQL server.
+       void close()
+       {
+               mysql_close(&mysql_);
+               is_connected_ = false;
+       }
+       
        /// \brief Establish a new connection using the same parameters as
        /// an existing C API connection.
        ///
@@ -177,41 +208,103 @@
                        cchar* user = 0, cchar* password = 0,
                        unsigned int port = 0);
 
-       /// \brief Close connection to MySQL server.
-       ///
-       /// Closes the connection to the MySQL server.
-       void close()
-       {
-               mysql_close(&mysql_);
-               is_connected_ = false;
-       }
-       
+       /// \brief return true if connection was established successfully
+       ///
+       /// \return true if connection was established successfully
+       bool connected() const
+       {
+               return is_connected_;
+       }
+
+       /// \brief Create a database
+       ///
+       /// \param db name of database to create
+       ///
+       /// \return true if database was created successfully
+       bool create_db(const std::string& db);
+
+       /// \brief Drop a database
+       ///
+       /// \param db name of database to destroy
+       ///
+       /// \return true if database was created successfully
+       bool drop_db(const std::string& db);
+
+       /// \brief Enable SSL-encrypted connection.
+       ///
+       /// \param key the pathname to the key file
+       /// \param cert the pathname to the certificate file
+       /// \param ca the pathname to the certificate authority file
+       /// \param capath directory that contains trusted SSL CA
+       ///        certificates in pem format.
+    /// \param cipher list of allowable ciphers to use
+       ///
+       /// Must be called before connection is established.
+       ///
+       /// Wraps \c mysql_ssl_set() in MySQL C API.
+       void enable_ssl(const char* key = 0,
+                       const char* cert = 0, const char* ca = 0,
+                       const char* capath = 0, const char* cipher = 0);
+
+       /// \brief Return error message for last MySQL error associated with
+       /// this connection.
+       ///
+       /// Can return a MySQL++ Connection-specific error message if there
+       /// is one.  If not, it simply wraps \c mysql_error() in the C API.
+       const char* error()
+       {
+               return error_message_.empty() ?
+                               mysql_error(&mysql_) :
+                               error_message_.c_str();
+       }
+
+       /// \brief Return last MySQL error number associated with this
+       /// connection
+       ///
+       /// Simply wraps \c mysql_errno() in the C API.
+       int errnum() { return mysql_errno(&mysql_); }
+
+       /// \brief Return the connection options object
+       st_mysql_options get_options() const
+       {
+               return mysql_.options;
+       }
+
+       /// \brief Get information about the network connection
+       ///
+       /// String contains info about type of connection and the server
+       /// hostname.
+       ///
+       /// Simply wraps \c mysql_get_host_info() in the C API.
+       std::string host_info()
+       {
+               return std::string(mysql_get_host_info(&mysql_));
+       }
+
        /// \brief Calls MySQL C API function \c mysql_info() and returns
        /// result as a C++ string.
        std::string info();
 
-       /// \brief return true if connection was established successfully
-       ///
-       /// \return true if connection was established successfully
-       bool connected() const
-       {
-               return is_connected_;
-       }
-
-       /// \brief Alias for close()
-       void purge() { close(); }
-
-       /// \brief Return a new query object.
-       ///
-       /// The returned query object is tied to this MySQL connection,
-       /// so when you call a method like
-       /// \link mysqlpp::Query::execute() execute() \endlink
-       /// on that object, the query is sent to the server this object
-       /// is connected to.
-       ///
-       /// \param qstr an optional query string for populating the
-       /// new Query object
-       Query query(const char* qstr = 0);
+       /// \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.
+       my_ulonglong insert_id()
+       {
+               return mysql_insert_id(&mysql_);
+       }
+
+       /// \brief Kill a MySQL server thread
+       ///
+       /// \param pid ID of thread to kill
+       ///
+       /// Simply wraps \c mysql_kill() in the C API.
+       int kill(unsigned long pid)
+       {
+               return mysql_kill(&mysql_, pid);
+       }
 
        /// \brief Test whether the connection has experienced an error
        /// condition.
@@ -239,36 +332,8 @@
        /// object.
        Connection& operator=(const Connection& rhs);
 
-       /// \brief Return error message for last MySQL error associated with
-       /// this connection.
-       ///
-       /// Can return a MySQL++ Connection-specific error message if there
-       /// is one.  If not, it simply wraps \c mysql_error() in the C API.
-       const char* error()
-       {
-               return error_message_.empty() ?
-                               mysql_error(&mysql_) :
-                               error_message_.c_str();
-       }
-
-       /// \brief Return last MySQL error number associated with this
-       /// connection
-       ///
-       /// Simply wraps \c mysql_errno() in the C API.
-       int errnum() { return mysql_errno(&mysql_); }
-
-       /// \brief Wraps MySQL C API function \c mysql_refresh()
-       ///
-       /// The corresponding C API function is undocumented.  All I know
-       /// is that it's used by \c mysqldump and \c mysqladmin, according
-       /// to MySQL bug database entry http://bugs.mysql.com/bug.php?id=9816
-       /// If that entry changes to say that the function is now documented,
-       /// reevaluate whether we need to wrap it.  It may be that it's not
-       /// supposed to be used by regular end-user programs.
-       int refresh(unsigned int refresh_options)
-       {
-               return mysql_refresh(&mysql_, refresh_options);
-       }
+       /// \brief Returns true if the given option has been set already
+       bool option_set(Option option);
 
        /// \brief "Pings" the MySQL database
        ///
@@ -282,35 +347,6 @@
        /// the ping and we could not re-establish the connection.
        bool ping();
 
-       /// \brief Kill a MySQL server thread
-       ///
-       /// \param pid ID of thread to kill
-       ///
-       /// Simply wraps \c mysql_kill() in the C API.
-       int kill(unsigned long pid)
-       {
-               return mysql_kill(&mysql_, pid);
-       }
-
-       /// \brief Get MySQL client library version
-       ///
-       /// Simply wraps \c mysql_get_client_info() in the C API.
-       std::string client_info()
-       {
-               return std::string(mysql_get_client_info());
-       }
-
-       /// \brief Get information about the network connection
-       ///
-       /// String contains info about type of connection and the server
-       /// hostname.
-       ///
-       /// Simply wraps \c mysql_get_host_info() in the C API.
-       std::string host_info()
-       {
-               return std::string(mysql_get_host_info(&mysql_));
-       }
-
        /// \brief Returns version number of MySQL protocol this connection
        /// is using
        ///
@@ -320,44 +356,30 @@
                return mysql_get_proto_info(&mysql_);
        }
 
-       /// \brief Get the MySQL server's version number
-       ///
-       /// Simply wraps \c mysql_get_server_info() in the C API.
-       std::string server_info()
-       {
-               return std::string(mysql_get_server_info(&mysql_));
-       }
-
-       /// \brief Returns information about MySQL server status
-       ///
-       /// String is similar to that returned by the \c mysqladmin
-       /// \c status command.  Among other things, it contains uptime 
-       /// in seconds, and the number of running threads, questions
-       /// and open tables.
-       const char* status() { return mysql_stat(&mysql_); }
-
-       /// \brief Create a database
-       ///
-       /// \param db name of database to create
-       ///
-       /// \return true if database was created successfully
-       bool create_db(const std::string& db);
-
-       /// \brief Drop a database
-       ///
-       /// \param db name of database to destroy
-       ///
-       /// \return true if database was created successfully
-       bool drop_db(const std::string& db);
-
-       /// \brief Change to a different database
-       bool select_db(const std::string& db)
-       {
-               return select_db(db.c_str());
-       }
-
-       /// \brief Change to a different database
-       bool select_db(const char* db);
+       /// \brief Return a new query object.
+       ///
+       /// The returned query object is tied to this MySQL connection,
+       /// so when you call a method like
+       /// \link mysqlpp::Query::execute() execute() \endlink
+       /// on that object, the query is sent to the server this object
+       /// is connected to.
+       ///
+       /// \param qstr an optional query string for populating the
+       /// new Query object
+       Query query(const char* qstr = 0);
+
+       /// \brief Wraps MySQL C API function \c mysql_refresh()
+       ///
+       /// The corresponding C API function is undocumented.  All I know
+       /// is that it's used by \c mysqldump and \c mysqladmin, according
+       /// to MySQL bug database entry http://bugs.mysql.com/bug.php?id=9816
+       /// If that entry changes to say that the function is now documented,
+       /// reevaluate whether we need to wrap it.  It may be that it's not
+       /// supposed to be used by regular end-user programs.
+       int refresh(unsigned int refresh_options)
+       {
+               return mysql_refresh(&mysql_, refresh_options);
+       }
 
        /// \brief Ask MySQL server to reload the grant tables
        /// 
@@ -368,17 +390,21 @@
        /// replacement is execute("FLUSH PRIVILEGES").
        bool reload();
        
-       /// \brief Ask MySQL server to shut down.
-       ///
-       /// User must have the "shutdown" privilege.
-       ///
-       /// Simply wraps \c mysql_shutdown() in the C API.
-       bool shutdown();
-
-       /// \brief Return the connection options object
-       st_mysql_options get_options() const
-       {
-               return mysql_.options;
+       /// \brief Change to a different database
+       bool select_db(const std::string& db)
+       {
+               return select_db(db.c_str());
+       }
+
+       /// \brief Change to a different database
+       bool select_db(const char* db);
+
+       /// \brief Get the MySQL server's version number
+       ///
+       /// Simply wraps \c mysql_get_server_info() in the C API.
+       std::string server_info()
+       {
+               return std::string(mysql_get_server_info(&mysql_));
        }
 
        /// \brief Sets a connection option, with no argument
@@ -434,49 +460,20 @@
        template <typename T>
        bool set_option_default(Option option, T arg);
 
-       /// \brief Returns true if the given option has been set already
-       bool option_set(Option option);
-
-       /// \brief Enable SSL-encrypted connection.
-       ///
-       /// \param key the pathname to the key file
-       /// \param cert the pathname to the certificate file
-       /// \param ca the pathname to the certificate authority file
-       /// \param capath directory that contains trusted SSL CA
-       ///        certificates in pem format.
-    /// \param cipher list of allowable ciphers to use
-       ///
-       /// Must be called before connection is established.
-       ///
-       /// Wraps \c mysql_ssl_set() in MySQL C API.
-       void enable_ssl(const char* key = 0,
-                       const char* cert = 0, const char* ca = 0,
-                       const char* capath = 0, const char* cipher = 0);
-
-       /// \brief Return the number of rows affected by the last query
-       ///
-       /// Simply wraps \c mysql_affected_rows() in the C API.
-       my_ulonglong affected_rows()
-       {
-               return mysql_affected_rows(&mysql_);
-       }
-
-       /// \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.
-       my_ulonglong insert_id()
-       {
-               return mysql_insert_id(&mysql_);
-       }
-
-       /// \brief Insert C API version we're linked against into C++ stream
-       ///
-       /// Version will be of the form X.Y.Z, where X is the major version
-       /// number, Y the minor version, and Z the bug fix number.
-       std::ostream& api_version(std::ostream& os);
+       /// \brief Ask MySQL server to shut down.
+       ///
+       /// User must have the "shutdown" privilege.
+       ///
+       /// Simply wraps \c mysql_shutdown() in the C API.
+       bool shutdown();
+
+       /// \brief Returns information about MySQL server status
+       ///
+       /// String is similar to that returned by the \c mysqladmin
+       /// \c status command.  Among other things, it contains uptime 
+       /// in seconds, and the number of running threads, questions
+       /// and open tables.
+       const char* status() { return mysql_stat(&mysql_); }
 
 protected:
        /// \brief Types of option setting errors we can diagnose
@@ -486,6 +483,19 @@
                opt_err_conn,   ///< option can't be set after connection is up
        };
        
+       /// \brief Error handling routine for set_option()
+       bool bad_option(Option option, OptionError error);
+
+       /// \brief Build an error message in a standard form.
+       ///
+       /// This is used when MySQL++ itself encounters an error.
+       void build_error_message(const char* core);
+
+       /// \brief Establish a new connection as a copy of an existing one
+       ///
+       /// \param other the connection to copy
+       void copy(const Connection& other);
+
        /// \brief Drop the connection to the database server
        ///
        /// This method is protected because it should only be used within
@@ -493,11 +503,14 @@
        /// object should always be connected.
        void disconnect();
 
-       /// \brief Error handling routine for set_option()
-       bool bad_option(Option option, OptionError error);
-
        /// \brief Given option value, return its proper argument type
        OptionArgType option_arg_type(Option option);
+
+       /// \brief Parse the server parameter to the connect-on-creation
+       /// ctor and connect() into values suitable for passing to the
+       /// MySQL C API's \c mysql_real_connect() function.
+       bool parse_ipc_method(const char* server, std::string& host,
+                       unsigned int& port, std::string& socket_name);
 
        /// \brief Set MySQL C API connection option
        ///
@@ -521,22 +534,6 @@
        /// flags to be treated the same way as any other connection option,
        /// even though the C API handles them differently.
        bool set_option_impl(int option, bool arg);
-
-       /// \brief Establish a new connection as a copy of an existing one
-       ///
-       /// \param other the connection to copy
-       void copy(const Connection& other);
-
-       /// \brief Parse the server parameter to the connect-on-creation
-       /// ctor and connect() into values suitable for passing to the
-       /// MySQL C API's \c mysql_real_connect() function.
-       bool parse_ipc_method(const char* server, std::string& host,
-                       unsigned int& port, std::string& socket_name);
-
-       /// \brief Build an error message in a standard form.
-       ///
-       /// This is used when MySQL++ itself encounters an error.
-       void build_error_message(const char* core);
 
        //// Subclass data
        std::string error_message_;             ///< MySQL++ specific error, if 
any


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

Reply via email to