全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
nsDatabase.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_NSDATABASE_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_NSDATABASE_H
3 /* =================================================================
4  Copyright (C) 2000-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 
22 #include <bzs/db/protocol/tdap/tdapSchema.h>
23 #include "export.h"
24 #ifdef _WIN32
25 #include <windows.h>
26 #endif
27 
28 #if (__BCPLUSPLUS__ || _MSC_VER)
29 #ifdef TRDCL_AUTOLINK
30 #include "trdclcppautolink.h"
31 #endif
32 #endif
33 
34 namespace bzs
35 {
36 namespace db
37 {
38 namespace protocol
39 {
40 namespace tdap
41 {
42 namespace client
43 {
44 extern DLLLIB bool g_enableAutoReconnect;
45 
46 class dbdef;
47 class nstable;
48 
49 /** @cond INTERNAL */
50 DLLLIB void setBtrvEntryPoint(BTRCALLID_PTR p);
51 DLLLIB BTRCALLID_PTR getBtrvEntryPoint();
52 DLLLIB void setTrnsctdEntryPoint(BTRCALLID_PTR p);
53 DLLLIB BTRCALLID_PTR getTrnsctdEntryPoint();
54 /** @endcond */
55 
56 
57 #pragma pack(push, 1)
59 #define BINLOGNAME_SIZE 119
60 #define GTID_SIZE 64
61 #define BINLOGPOS_SIZE 192
62 struct DLLLIB binlogPos
63 {
64  friend class nsdatabase;
65  unsigned long long pos;
66  char type;
67  char filename[BINLOGNAME_SIZE];
68 private:
69  char gtid_buf[GTID_SIZE];
70  struct bpimple* m_impl;
71 public:
72  void setGtid(const char* p);
73  const char* gtid;
74  binlogPos();
75  binlogPos(const binlogPos& r);
76  ~binlogPos();
77  binlogPos& operator=(const binlogPos& r);
78 
79 };
80 
81 
82 #pragma pack(pop)
84 
85 class DLLLIB nsdatabase
86 {
87  friend class nstable;
88  friend class dbdef;
89 /** @cond INTERNAL */
90  friend bool reconnectSharedConnection(const void* ptr);
91 /** @endcond */
92  struct nsdbimpl* m_nsimpl;
93  nsdatabase(const nsdatabase&);
94  static unsigned int m_execCodepage;
95  bool doReopenTables();
96 protected:
97  BTRCALLID_PTR m_btrcallid;
98  short m_stat;
99  static const char* toServerUri(char* buf, int buflen, const _TCHAR* src,
100  bool trd);
101  short tdapEx(ushort_td op, void* posb, void* data, uint_td* datalen,
102  void* keybuf, keylen_td keylen, char_td keyNum);
103 
104  inline short tdap(ushort_td op, void* posb, void* data, uint_td* datalen,
105  void* keybuf, keylen_td keylen, char_td keyNum)
106  {
107  return m_btrcallid(op, posb, data, datalen, keybuf, keylen, keyNum,
108  clientID());
109  }
110 
111  virtual bool setUri(const _TCHAR* uri);
112  void reset();
113  void resetSnapshot();
114  nstable** tables();
115  nsdatabase* clone() const;
116  nsdatabase& operator=(const nsdatabase&);
117  virtual ~nsdatabase();
118  void unregisterTable(nstable* tb);
119  void registerTable(nstable* tb);
120  bool findTable(nstable* tb);
121  void addref();
123  void doReconnect(nstable* tb);
124  void setAssociate();
125  bool checkAssociate();
126  virtual bool doReopenDatabaseSchema(){ return true; }
127  virtual void* getExtendBufferForOpen(uint_td& size){ return NULL; };
128 public:
129  nsdatabase();
130  virtual void release();
131  int refCount() const;
132 
133  inline BTRCALLID_PTR btrvFunc() { return m_btrcallid; }
134  int enableTrn() const;
135  short stat() const;
136  uchar_td* clientID() const;
137  short openTableCount() const;
138  _TCHAR* uri() const;
139  bool uriMode() const;
140  short lockWaitCount() const;
141  short lockWaitTime() const;
142  bool localSharing() const;
143 
144  void setLockWaitCount(short v);
145  void setLockWaitTime(short v);
146  void setLocalSharing(bool v);
147 
148  void createTable(fileSpec* pfs, uint_td len, const _TCHAR* uri,
149  short_td mode = -1);
150  virtual void dropTable(const _TCHAR* uri);
151  void rename(const _TCHAR* oldUri, const _TCHAR* newUri);
152  void swapTablename(const _TCHAR* uri1, const _TCHAR* uri2);
153  void beginTrn(short bias = SINGLELOCK_NOGAP +
154  NOWAIT_WRITE); // NoWit SingleLock
155  void endTrn();
156  void abortTrn();
157  void beginSnapshot(short bias = CONSISTENT_READ, binlogPos* bpos=NULL);
158  void endSnapshot();
159  ushort_td trxIsolationServer() const ;
160  ushort_td trxLockWaitTimeoutServer() const ;
161  short_td tdapErr(HWND hWnd, _TCHAR* retbuf = NULL);
162  inline _TCHAR* statMsg(_TCHAR* retbuf)
163  {
164  tdapErr(0, retbuf);
165  return retbuf;
166  }
167  bool useLongFilename();
168  void setUseLongFilename(bool value);
169  void getBtrVersion(btrVersions* versions, uchar_td* posblk);
170  bool setUseTransactd();
171  bool isTransactdUri(const _TCHAR* uri);
172  bool isUseTransactd() const;
173  void readDatabaseDirectory(_TCHAR* retbuf, uchar_td len);
174  bool connect(const _TCHAR* uri, bool newConnection = false);
175  bool disconnect(const _TCHAR* uri = _T(""));
176  bool disconnectForReconnectTest(); //for connection brokn emulate
177  bool reconnect();
178  bool isReconnected() const;
179  bool isAssociate() const;
180  virtual bool isOpened() const { return false;}
181  char* getCreateViewSql(const _TCHAR* name, char* retbuf, uint_td* size);
182 
183  static const int maxtables = 150;
184  static bool trnsactionFlushWaitStatus();
185  static void setExecCodePage(unsigned int codepage);
186  static unsigned int execCodePage();
187  static inline bool enableAutoReconnect(){ return g_enableAutoReconnect;}
188  static inline void setEnableAutoReconnect(bool v){ g_enableAutoReconnect = v;}
189  static bool registerHaNameResolver(HANAME_RESOLVER_PTR func);
190  /** @cond INTERNAL */
191  void setTestPtrIgnore(bool v);
192  bool isTestPtrIgnore() const;
193  static WIN_TPOOL_SHUTDOWN_PTR getWinTPoolShutdownFunc();
194  static bool testTablePtr(nstable* ptr);
195  static void setCheckTablePtr(bool v);
196  /** @endcond */
197 };
198 
199 } // namespace client
200 } // namespace tdap
201 } // namespace protocol
202 } // namespace db
203 } // namespace bzs
204 
205 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_NSDATABASE_H
pragma_pop
Definition: btrDate.h:107
unsigned long long pos
Definition: nsDatabase.h:65
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: nsDatabase.h:162
static void setEnableAutoReconnect(bool v)
Definition: nsDatabase.h:188
short tdap(ushort_td op, void *posb, void *data, uint_td *datalen, void *keybuf, keylen_td keylen, char_td keyNum)
Definition: nsDatabase.h:104
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:85
void internalRelease()
Definition: nsDatabase.h:122
BTRCALLID_PTR m_btrcallid
Definition: nsDatabase.h:97
static bool enableAutoReconnect()
Definition: nsDatabase.h:187
バージョン配列構造体
Definition: tdapSchema.h:1324
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
void connect(Database_Ptr db, const ConnectParam_type &connPrams, bool newConnection)
Definition: trdboostapi.h:859
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:45
BTRCALLID_PTR btrvFunc()
Definition: nsDatabase.h:133
void dropTable(Database_Ptr db, const _TCHAR *name)
Definition: trdboostapi.h:952
バイナリーログの情報
Definition: nsDatabase.h:62
void disconnect(Database_Ptr db, const connectParams &connPrams)
Definition: trdboostapi.h:834
pragma_pack1
Definition: btrDate.h:36
virtual bool doReopenDatabaseSchema()
Definition: nsDatabase.h:126
virtual void * getExtendBufferForOpen(uint_td &size)
Definition: nsDatabase.h:127
short m_stat
Definition: nsDatabase.h:98
virtual bool isOpened() const
Definition: nsDatabase.h:180
const char * gtid
Definition: nsDatabase.h:73
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:142
char type
Definition: nsDatabase.h:66

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