#ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H #define BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H /*================================================================= Copyright (C) 2013-2016 BizStation Corp All rights reserved. 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; either version 2 of the License, or (at your option) any later version. 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. =================================================================*/ #include "nsTable.h" #include #include #include #pragma warning(disable : 4251) namespace bzs { namespace db { namespace protocol { namespace tdap { namespace client { class database; class connMgr; typedef boost::shared_ptr connMgr_ptr; class DLLLIB connMgr : private nstable // no copyable { public: typedef bzs::db::transactd::connection::record record; typedef std::vector records; private: std::vector m_records; __int64 m_params[2]; database* m_db; std::_tstring m_uri; btrVersion m_pluginVer; void allocBuffer(); void writeRecordData(){}; void onReadAfter(){}; const records& getRecords(bool isInUseTable = false); void convertFromOldFormat(bool isInUseTable); ~connMgr(); explicit connMgr(const connMgr& r); //no copyable connMgr& operator=(const connMgr& r); //no copyable const connMgr::records& doDefinedTables(const _TCHAR* dbname, int type); explicit connMgr(database* db); public: bool connect(const _TCHAR* uri); void disconnect(); const records& databases(); const records& tables(const _TCHAR* dbname); const records& views(const _TCHAR* dbname); const records& schemaTables(const _TCHAR* dbname); const records& slaveStatus(); const records& sysvars(); const records& connections(); const records& inUseDatabases(__int64 connid); const records& inUseTables(__int64 connid, int dbid); void postDisconnectOne(__int64 connid); void postDisconnectAll(); short_td stat(); database* db() const; using nstable::tdapErr; using nstable::release; static void removeSystemDb(records& recs); static const _TCHAR* sysvarName(uint_td index); static const _TCHAR* slaveStatusName(uint_td index); static connMgr* create(database* db); }; /** Releaser for boost shared_ptr. ex : boost::shared_ptr mgr(connMgr::create(), releaseConnMgr); */ inline void releaseConnMgr(connMgr* p) { if (p) p->release(); } inline connMgr_ptr createConnMgr(database* db) { return connMgr_ptr(connMgr::create(db), releaseConnMgr); } } // namespace client } // namespace tdap } // namespace protocol } // namespace db } // namespace bzs #pragma warning(default : 4251) #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H