全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
connMgr.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H
3 /*=================================================================
4  Copyright (C) 2013-2016 BizStation Corp All rights reserved.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  02111-1307, USA.
20 =================================================================*/
21 #include "nsTable.h"
22 #include <bzs/db/transactd/connectionRecord.h>
23 #include <boost/shared_ptr.hpp>
24 #include <vector>
25 #pragma warning(disable : 4251)
26 
27 namespace bzs
28 {
29 namespace db
30 {
31 namespace protocol
32 {
33 namespace tdap
34 {
35 namespace client
36 {
37 
38 class database;
39 class connMgr;
40 class stringBuffer;
41 typedef boost::shared_ptr<connMgr> connMgr_ptr;
42 
43 class DLLLIB connRecords
44 {
46  friend class connMgr;
47  std::vector<record> m_records;
48  boost::shared_ptr<stringBuffer> m_buf;
49  inline void resize(size_t size) { m_records.resize(size); }
50  inline void erase(size_t index) { m_records.erase(m_records.begin() + index); }
51 
52 public:
53  connRecords();
54  connRecords(const connRecords& r);
55  connRecords& operator=(const connRecords& r);
56  const record& operator[] (size_t index) const;
57  record& operator[] (size_t index);
58  size_t size() const;
59  void clear();
60  void release();
61  static connRecords* create();
62  static connRecords* create(const connRecords& r);
63 };
64 
65 typedef boost::shared_ptr<connRecords> connRecords_ptr;
66 
68 {
69  if (p) p->release();
70 }
71 
73 {
75 }
76 
78 {
80 }
81 
82 
83 class DLLLIB connMgr : private nstable // no copyable
84 {
85 
86 public:
89 private:
90  connMgr::records m_records;
91  __int64 m_params[2];
92  database* m_db;
93  std::_tstring m_uri;
94  btrVersion m_pluginVer;
95  btrVersion m_serverVer;
96  void allocBuffer();
97  void writeRecordData(){};
98  void onReadAfter(){};
99  const records& getRecords(bool isInUseTable = false);
100  void convertFromOldFormat(bool isInUseTable);
101  ~connMgr();
102  explicit connMgr(const connMgr& r); //no copyable
103  connMgr& operator=(const connMgr& r); //no copyable
104  const connMgr::records& doDefinedTables(const _TCHAR* dbname, int type);
105  void setBlobFieldPointer(const bzs::db::blobHeader* bd);
106  explicit connMgr(database* db);
107  const records& blobOperation(int op);
108 public:
109 
110  bool connect(const _TCHAR* uri);
111  void disconnect();
112  const records& databases();
113  const records& tables(const _TCHAR* dbname);
114  const records& views(const _TCHAR* dbname);
115  const records& schemaTables(const _TCHAR* dbname);
116  const records& slaveStatus(const char* channel=0);
117 #ifdef _UNICODE
118  const records& slaveStatus(const wchar_t* channel);
119 #endif
120  const records& channels(bool withLock = false);
121  const records& slaveHosts();
122  const records& sysvars();
123  const records& extendedvars();
124  const records& statusvars();
125  const records& connections();
126  const records& inUseDatabases(__int64 connid);
127  const records& inUseTables(__int64 connid, int dbid);
128  void postDisconnectOne(__int64 connid);
129  void postDisconnectAll();
130  bool haLock();
131  void haUnlock();
132  bool setRole(int v);
133  bool setTrxBlock(bool v);
134  bool setEnableFailover(bool v);
135  database* db() const;
136  const _TCHAR* slaveStatusName(uint_td id) const;
137  using nstable::stat;
138  using nstable::tdapErr;
139  using nstable::release;
140  using nstable::isOpen;
141  static void removeSystemDb(records& recs);
142  static const _TCHAR* sysvarName(uint_td id);
143  static const _TCHAR* statusvarName(uint_td id);
144  static const _TCHAR* extendedVarName(uint_td id);
145  static connMgr* create(database* db);
146 };
147 
148 /**
149  Releaser for boost shared_ptr.
150  ex : boost::shared_ptr<connMgr> mgr(connMgr::create(), releaseConnMgr);
151 */
152 inline void releaseConnMgr(connMgr* p)
153 {
154  if (p) p->release();
155 }
156 
158 {
160 }
161 
162 
163 } // namespace client
164 } // namespace tdap
165 } // namespace protocol
166 } // namespace db
167 } // namespace bzs
168 
169 #pragma warning(default : 4251)
170 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_CTDCONNMGR_H
サーバーおよびクライアントモジュールのバージョン構造体
Definition: tdapSchema.h:1287
record のコレクションクラス
Definition: connMgr.h:43
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: nsTable.h:190
boost::shared_ptr< connRecords > connRecords_ptr
Definition: connMgr.h:65
void releaseConnMgr(connMgr *p)
Definition: connMgr.h:152
void connect(Database_Ptr db, const ConnectParam_type &connPrams, bool newConnection)
Definition: trdboostapi.h:859
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:45
short_td stat() const
Definition: nsTable.h:168
bzs::db::transactd::connection::record record
Definition: connMgr.h:87
connMgr_ptr createConnMgr(database *db)
Definition: connMgr.h:157
connRecords_ptr createConnRecords(const connRecords &r)
Definition: connMgr.h:72
void releaseConnRecords(connRecords *p)
Definition: connMgr.h:67
接続管理マネージャ
Definition: connMgr.h:83
void disconnect(Database_Ptr db, const connectParams &connPrams)
Definition: trdboostapi.h:834
connRecords records
Definition: connMgr.h:88
boost::shared_ptr< connMgr > connMgr_ptr
Definition: connMgr.h:40
データベースアクセスクラス
Definition: database.h:59
static connMgr * create(database *db)
接続管理マネージャ結果レコード
Definition: connectionRecord.h:126

Transactd SDK 2018年07月31日(火) 19時40分20秒 doxygen