全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド ページ
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-2013 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 
45 class dbdef;
46 class nstable;
47 
48 /** @cond INTERNAL */
49 DLLLIB void setBtrvEntryPoint(BTRCALLID_PTR p);
50 DLLLIB BTRCALLID_PTR getBtrvEntryPoint();
51 DLLLIB void setTrnsctdEntryPoint(BTRCALLID_PTR p);
52 DLLLIB BTRCALLID_PTR getTrnsctdEntryPoint();
53 /** @endcond */
54 
55 class DLLLIB nsdatabase
56 {
57  friend class nstable;
58  friend bool reconnectSharedConnection(const void* ptr);
59  struct nsdbimpl* m_nsimpl;
60  nsdatabase(const nsdatabase&);
61  static unsigned int m_execCodepage;
62  bool doReopenTables();
63 protected:
64  BTRCALLID_PTR m_btrcallid;
65  short m_stat;
66 
67  static const char* toServerUri(char* buf, int buflen, const _TCHAR* src,
68  bool trd);
69  virtual bool setUri(const _TCHAR* uri);
70  void reset();
71  nstable** tables();
72  nsdatabase* clone() const;
73  nsdatabase& operator=(const nsdatabase&);
74  virtual ~nsdatabase();
75  void unregisterTable(nstable* tb);
76  void registerTable(nstable* tb);
77  bool findTable(nstable* tb);
78  void addref();
80  void doReconnect(nstable* tb);
81  virtual bool doReopenDatabaseSchema(){ return true; }
82 
83 public:
84  nsdatabase();
85  virtual void release();
86  int refCount() const;
87 
88  inline BTRCALLID_PTR btrvFunc() { return m_btrcallid; }
89  int enableTrn() const;
90  short stat() const;
91  uchar_td* clientID() const;
92  short openTableCount() const;
93  _TCHAR* uri() const;
94  bool uriMode() const;
95  short lockWaitCount() const;
96  short lockWaitTime() const;
97  bool localSharing() const;
98 
99  void setLockWaitCount(short v);
100  void setLockWaitTime(short v);
101  void setLocalSharing(bool v);
102 
103  void createTable(fileSpec* pfs, uint_td len, const _TCHAR* uri,
104  short_td mode = -1);
105  virtual void dropTable(const _TCHAR* uri);
106  void rename(const _TCHAR* oldUri, const _TCHAR* newUri);
107  void swapTablename(const _TCHAR* uri1, const _TCHAR* uri2);
108  void beginTrn(short bias = SINGLELOCK_READ_COMMITED +
109  NOWAIT_WRITE); // NoWit SingleLock
110  void endTrn();
111  void abortTrn();
112  void beginSnapshot(short bias = CONSISTENT_READ);
113  void endSnapshot();
114  ushort_td trxIsolationServer() const ;
115  ushort_td trxLockWaitTimeoutServer() const ;
116  short_td tdapErr(HWND hWnd, _TCHAR* retbuf = NULL);
117  inline _TCHAR* statMsg(_TCHAR* retbuf)
118  {
119  tdapErr(0, retbuf);
120  return retbuf;
121  }
122  bool useLongFilename();
123  void setUseLongFilename(bool value);
124  void getBtrVersion(btrVersions* versions, uchar_td* posblk);
125  bool setUseTransactd();
126  bool isTransactdUri(const _TCHAR* uri);
127  bool isUseTransactd() const;
128  void readDatabaseDirectory(_TCHAR* retbuf, uchar_td len);
129  bool connect(const _TCHAR* uri, bool newConnection = false);
130  bool disconnect(const _TCHAR* uri = _T(""));
131  bool disconnectForReconnectTest(); //for connection brokn emulate
132  bool reconnect();
133  bool isReconnected() const;
134 
135  static const int maxtables = 50;
136  static bool trnsactionFlushWaitStatus();
137  static void setExecCodePage(unsigned int codepage);
138  static unsigned int execCodePage();
139  /** @cond INTERNAL */
140  void setTestPtrIgnore(bool v);
141  bool isTestPtrIgnore() const;
142  static WIN_TPOOL_SHUTDOWN_PTR getWinTPoolShutdownFunc();
143  static bool testTablePtr(nstable* ptr);
144  static void setCheckTablePtr(bool v);
145  /** @endcond */
146 };
147 
148 } // namespace client
149 } // namespace tdap
150 } // namespace protocol
151 } // namespace db
152 } // namespace bzs
153 
154 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_NSDATABASE_H
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: nsDatabase.h:117
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:55
void internalRelease()
Definition: nsDatabase.h:79
BTRCALLID_PTR m_btrcallid
Definition: nsDatabase.h:64
バージョン配列構造体
Definition: tdapSchema.h:806
void connect(Database_Ptr db, const ConnectParam_type &connPrams, bool newConnection)
Definition: trdboostapi.h:833
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:44
BTRCALLID_PTR btrvFunc()
Definition: nsDatabase.h:88
void dropTable(Database_Ptr db, const _TCHAR *name)
Definition: trdboostapi.h:926
void disconnect(Database_Ptr db, const connectParams &connPrams)
Definition: trdboostapi.h:808
virtual bool doReopenDatabaseSchema()
Definition: nsDatabase.h:81
short m_stat
Definition: nsDatabase.h:65
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:123

Transactd SDK 2015年09月08日(火) 19時13分35秒 doxygen