1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
21 #include <bzs/db/protocol/tdap/tdapcapi.h>
22 #include <bzs/env/tstring.h>
23 #include <bzs/db/protocol/tdap/tdapSchema.h>
24 #include <bzs/rtl/exception.h>
42 #define BULKBUFSIZE USHRT_MAX - 1000
62 static const bool inkey =
true;
65 struct nstimpl* m_impl;
70 ushort_td doInsert(
bool ncc);
71 static _TCHAR* getErrorMessage(
int errorCode, _TCHAR* buf,
size_t size);
90 uchar_td m_insart : 1;
91 uchar_td m_delete : 1;
92 uchar_td m_reserverd : 4;
98 const _TCHAR* uri()
const;
99 const uchar_td* posblk()
const;
100 void setIsOpen(
bool v);
102 bulkInsert* bulkIns()
const;
107 virtual void writeRecordData() = 0;
113 virtual void onInsertAfter(
int beforeResult);
122 virtual void doDel(
bool inkey);
124 virtual void onReadAfter() = 0;
126 virtual void doOpen(
const _TCHAR* name, char_td mode,
127 const _TCHAR* ownername);
128 virtual void doClose();
129 virtual void doCreateIndex(
bool specifyKeyNum);
130 virtual uint_td doRecordCount(
bool estimate,
bool fromCurrent);
131 virtual short_td doBtrvErr(HWND hWnd, _TCHAR* retbuf);
132 virtual ushort_td doCommitBulkInsert(
bool autoCommit);
133 virtual void doAbortBulkInsert();
134 inline void open(
const _TCHAR* uri, char_td mode = 0,
135 const _TCHAR* ownerName = NULL)
137 doOpen(uri, mode, ownerName);
146 void seekByBookmark(bookmark_td* bm, ushort_td lockBias = LOCK_BIAS_DEFAULT);
151 int refCount()
const;
153 short tableid()
const;
154 void setTableid(
short v);
156 bool isUseTransactd()
const;
158 inline const void*
data()
const {
return m_pdata; }
160 inline uint_td
buflen()
const {
return m_buflen; }
162 inline uint_td
datalen()
const {
return m_datalen; }
163 inline short_td
stat()
const {
return m_stat; }
164 inline void setStat(short_td v) { m_stat = v; }
165 inline char_td
keyNum()
const {
return m_keynum; }
167 inline bool canRead()
const {
return (
bool)m_read; }
168 inline bool canWrite()
const {
return (
bool)m_write; }
169 inline bool canInsert()
const {
return (
bool)m_insart; }
170 inline bool canDelete()
const {
return (
bool)m_delete; }
174 inline void del(
bool in_key =
false) { doDel(in_key); }
175 inline ushort_td
insert(
bool ncc =
false) {
return doInsert(ncc); };
178 doCreateIndex(specifyKeyNum);
180 void dropIndex(
bool norenumber =
false);
181 inline uint_td
recordCount(
bool estimate =
true,
bool fromCurrent =
false)
183 return doRecordCount(estimate, fromCurrent);
185 inline short_td
tdapErr(HWND hWnd, _TCHAR* retbuf = NULL)
187 return doBtrvErr(hWnd, retbuf);
191 doBtrvErr(0, retbuf);
195 void beginBulkInsert(
int maxBuflen);
199 return doCommitBulkInsert(autoCommit);
201 void tdap(ushort_td op);
202 void seekFirst(ushort_td lockBias = LOCK_BIAS_DEFAULT);
203 void seekLast(ushort_td lockBias = LOCK_BIAS_DEFAULT);
204 void seekPrev(ushort_td lockBias = LOCK_BIAS_DEFAULT);
205 void seekNext(ushort_td lockBias = LOCK_BIAS_DEFAULT);
206 void seek(ushort_td lockBias = LOCK_BIAS_DEFAULT);
207 void seekGreater(
bool orEqual, ushort_td lockBias = LOCK_BIAS_DEFAULT);
208 void seekLessThan(
bool orEqual, ushort_td lockBias = LOCK_BIAS_DEFAULT);
209 void stepFirst(ushort_td lockBias = LOCK_BIAS_DEFAULT);
210 void stepLast(ushort_td lockBias = LOCK_BIAS_DEFAULT);
211 void stepPrev(ushort_td lockBias = LOCK_BIAS_DEFAULT);
212 void stepNext(ushort_td lockBias = LOCK_BIAS_DEFAULT);
213 ushort_td bookmarkLen()
const ;
214 bookmark_td bookmark();
215 void seekByBookmark(bookmark_td& bm, ushort_td lockBias = LOCK_BIAS_DEFAULT);
216 void seekByBookmark();
217 percentage_td getPercentage();
218 percentage_td getPercentage(bookmark_td& bm);
219 void seekByPercentage();
220 void seekByPercentage(percentage_td pc);
221 void setOwnerName(
const _TCHAR* name, char_td enctype = 0);
222 void clearOwnerName();
223 ushort_td recordLength();
224 void stats(
void* databuffer, uint_td buflen,
bool estimate =
true);
225 void unlock(bookmark_td& bm);
227 char_td mode()
const;
228 static _TCHAR* getFileName(
const _TCHAR* uri, _TCHAR* retbuf);
229 static short_td tdapErr(HWND hWnd, short_td status,
230 const _TCHAR* tableName = NULL,
231 _TCHAR* retbuf = NULL);
232 static void throwError(
const _TCHAR* caption,
short statusCode);
233 static void throwError(
const _TCHAR* caption,
nstable* tb);
234 static _TCHAR* getDirURI(
const _TCHAR* uri, _TCHAR* retbuf);
235 static bool existsFile(
const _TCHAR* filename);
247 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
void * m_keybuf
Definition: nsTable.h:77
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
void setBuflen(uint_td v)
Definition: nsTable.h:161
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: nsTable.h:185
void del(bool in_key=false)
Definition: nsTable.h:174
bool canWrite() const
Definition: nsTable.h:168
void abortBulkInsert()
Definition: nsTable.h:196
const void * data() const
Definition: nsTable.h:158
char_td m_keynum
Definition: nsTable.h:82
uint_td m_datalen
Definition: nsTable.h:76
virtual int onInsertBefore()
Definition: nsTable.h:108
keylen_td m_keylen
Definition: nsTable.h:80
ushort_td commitBulkInsert(bool autoCommit=false)
Definition: nsTable.h:197
bool canRead() const
Definition: nsTable.h:167
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:55
void setKeyNum(char_td v)
Definition: nsTable.h:166
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: nsTable.h:189
virtual bool isUniqeKey(char_td keynum)
Definition: nsTable.h:103
eFindType
findオペレーションで検索の方向を示すタイプ
Definition: nsTable.h:56
void setStat(short_td v)
Definition: nsTable.h:164
uint_td m_buflen
Definition: nsTable.h:75
bool canDelete() const
Definition: nsTable.h:170
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:44
short_td m_stat
Definition: nsTable.h:81
short_td stat() const
Definition: nsTable.h:163
uint_td recordCount(bool estimate=true, bool fromCurrent=false)
Definition: nsTable.h:181
virtual bool onDeleteCheck(bool in_key)
Definition: nsTable.h:121
uint_td getWriteImageLen()
Definition: nsTable.h:171
virtual keylen_td writeKeyData()
Definition: nsTable.h:123
keylen_td m_keybuflen
Definition: nsTable.h:79
virtual void onUpdateAfter(int beforeResult)
Definition: nsTable.h:120
uint_td buflen() const
Definition: nsTable.h:160
uchar_td m_curd
Definition: nsTable.h:94
ushort_td insert(bool ncc=false)
Definition: nsTable.h:175
void createIndex(bool specifyKeyNum=false)
Definition: nsTable.h:176
uint_td datalen() const
Definition: nsTable.h:162
void open(const _TCHAR *uri, char_td mode=0, const _TCHAR *ownerName=NULL)
Definition: nsTable.h:134
void close()
Definition: nsTable.h:172
ushort_td m_op
Definition: nsTable.h:78
void * m_pdata
Definition: nsTable.h:74
bool canInsert() const
Definition: nsTable.h:169
eUpdateType
更新オペレーションの対象とカレント移動のタイプ
Definition: nsTable.h:50
void update(eUpdateType type=changeCurrentCc)
Definition: nsTable.h:173
char_td keyNum() const
Definition: nsTable.h:165
virtual bool onUpdateCheck(eUpdateType type)
Definition: nsTable.h:114
void setAccessRights(unsigned char curd)
Definition: nsTable.h:157
virtual int onUpdateBefore()
Definition: nsTable.h:115
virtual uint_td doGetWriteImageLen()
Definition: nsTable.h:125
void setData(void *v)
Definition: nsTable.h:159