⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbioservice.hpp.svn-base

📁 自己写的
💻 SVN-BASE
字号:
/*  Copy Left/Right : OTHER ,Amfproject                                     * *                                                                          * *     This program is free software; you can redistribute it and/or modify * *  it under the terms of the GNU General Public License as published by    * *  the Free Software Foundation; version 2 of the License.                 * *                                                                          * *  This program is distributed in the hope that it will be useful,         * *  but WITHOUT ANY WARRANTY; without even the implied warranty of          * *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           * *  GNU General Public License for more details.                            * *                                                                          * *  You should have received a copy of the GNU General Public License       * *  along with this program; if not, write to the Free Software             * *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA* **************************************************************************** * Project:    LibKDD0 * Programmer: lucy * Created On: Jan 16, 2009 ****************************************************************************/#ifndef DBIOSERVICE_HPP_#define DBIOSERVICE_HPP_/*-- Compiler Controls -----------------------------------------------------*//*-- Includes --------------------------------------------------------------*/#define MYSQLPP_MYSQL_HEADERS_BURIED#include <mysql++/mysql++.h>#include <string>#include <vector>#include <boost/noncopyable.hpp>#include <boost/thread/mutex.hpp>#include <boost/thread/condition.hpp>#include <stdexcept>/*-- Namespace Controller --------------------------------------------------*/namespace kdd{/*-- Extern Types ----------------------------------------------------------*//*--------------------------------------------------------------------------*/class dbioservice : private boost::noncopyable{public:	class no_free_connection : public std::runtime_error	{	public:		no_free_connection() :			std::runtime_error("no free connection")		{		}		~no_free_connection() throw()		{		}	};	dbioservice(std::string const &server, std::string const& db, std::string const& user, std::string const& pass) :		_server(server), _db(db), _user(user), _pass(pass), next_free_connection(0)	{	}	void run();	~dbioservice();private:	friend class db_queryer;	class dbConnection	{	public:		dbConnection(std::string const& db,std::string const &server, std::string const& user, std::string const& pass)		:conn(db.c_str(),server.c_str(),user.c_str(),pass.c_str()),Sfree(true)		{  }		mysqlpp::Connection& getConnection()		{			return conn;		}		bool isFree() const		{			return Sfree;		}		void free()		{			 Sfree=true;		}		void occupy()		{			 Sfree=false;		}	protected:		mysqlpp::Connection conn;		bool Sfree;	};	std::string _server;	std::string _db;	std::string _user;	std::string _pass;	size_t next_free_connection;	std::vector< boost::shared_ptr<dbConnection> > connStack;	dbConnection& freeConnection() throw (dbioservice::no_free_connection);};/*-- Namespace Ender -------------------------------------------------------*/}/*--------------------------------------------------------------------------*/#endif /* DBIOSERVICE_HPP_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -