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>
43 #define BULKBUFSIZE USHRT_MAX - 1000
63 static const bool inkey =
true;
66 struct nstimpl* m_impl;
71 ushort_td doInsert(
bool ncc);
72 static _TCHAR* getErrorMessage(
int errorCode, _TCHAR* buf,
size_t size);
91 uchar_td m_insart : 1;
92 uchar_td m_delete : 1;
93 uchar_td m_reserverd : 4;
99 const _TCHAR* uri()
const;
100 const uchar_td* posblk()
const;
101 void setIsOpen(
bool v);
102 void setMode(char_td v);
104 bulkInsert* bulkIns()
const;
109 virtual void writeRecordData() = 0;
115 virtual void onInsertAfter(
int beforeResult);
124 virtual void doDel(
bool inkey);
126 virtual void onReadAfter() = 0;
128 virtual void doOpen(
const _TCHAR* name, char_td mode,
129 const _TCHAR* ownername);
130 virtual void doClose();
131 virtual void doCreateIndex(
bool specifyKeyNum);
132 virtual uint_td doRecordCount(
bool estimate,
bool fromCurrent);
133 virtual short_td doBtrvErr(HWND hWnd, _TCHAR* retbuf);
134 virtual ushort_td doCommitBulkInsert(
bool autoCommit);
135 virtual void doAbortBulkInsert();
138 inline void open(
const _TCHAR* uri, char_td mode = 0,
139 const _TCHAR* ownerName = NULL)
141 doOpen(uri, mode, ownerName);
150 void seekByBookmark(
bookmark_td* bm, ushort_td lockBias = LOCK_BIAS_DEFAULT);
151 const bzs::db::blobHeader* getBlobHeader();
156 int refCount()
const;
158 short tableid()
const;
159 void setTableid(
short v);
161 bool isUseTransactd()
const;
163 inline const void*
data()
const {
return m_pdata; }
165 inline uint_td
buflen()
const {
return m_buflen; }
167 inline uint_td
datalen()
const {
return m_datalen; }
168 inline short_td
stat()
const {
return m_stat; }
169 inline void setStat(short_td v) { m_stat = v; }
170 inline char_td
keyNum()
const {
return m_keynum; }
172 inline bool canRead()
const {
return (
bool)m_read; }
173 inline bool canWrite()
const {
return (
bool)m_write; }
174 inline bool canInsert()
const {
return (
bool)m_insart; }
175 inline bool canDelete()
const {
return (
bool)m_delete; }
179 inline void del(
bool in_key =
false) { doDel(in_key); }
180 inline ushort_td
insert(
bool ncc =
false) {
return doInsert(ncc); };
183 doCreateIndex(specifyKeyNum);
185 void dropIndex(
bool norenumber =
false);
186 inline uint_td
recordCount(
bool estimate =
true,
bool fromCurrent =
false)
188 return doRecordCount(estimate, fromCurrent);
190 inline short_td
tdapErr(HWND hWnd, _TCHAR* retbuf = NULL)
192 return doBtrvErr(hWnd, retbuf);
196 doBtrvErr(0, retbuf);
200 void beginBulkInsert(
int maxBuflen=BULKBUFSIZE);
204 return doCommitBulkInsert(autoCommit);
206 void tdap(ushort_td op);
207 void seekFirst(ushort_td lockBias = LOCK_BIAS_DEFAULT);
208 void seekLast(ushort_td lockBias = LOCK_BIAS_DEFAULT);
209 void seekPrev(ushort_td lockBias = LOCK_BIAS_DEFAULT);
210 void seekNext(ushort_td lockBias = LOCK_BIAS_DEFAULT);
211 void seek(ushort_td lockBias = LOCK_BIAS_DEFAULT);
212 void seekGreater(
bool orEqual, ushort_td lockBias = LOCK_BIAS_DEFAULT);
213 void seekLessThan(
bool orEqual, ushort_td lockBias = LOCK_BIAS_DEFAULT);
214 void stepFirst(ushort_td lockBias = LOCK_BIAS_DEFAULT);
215 void stepLast(ushort_td lockBias = LOCK_BIAS_DEFAULT);
216 void stepPrev(ushort_td lockBias = LOCK_BIAS_DEFAULT);
217 void stepNext(ushort_td lockBias = LOCK_BIAS_DEFAULT);
218 ushort_td bookmarkLen()
const ;
220 void seekByBookmark(
bookmark_td& bm, ushort_td lockBias = LOCK_BIAS_DEFAULT);
221 void seekByBookmark();
222 percentage_td getPercentage();
224 void seekByPercentage();
225 void seekByPercentage(percentage_td pc);
226 void setOwnerName(
const _TCHAR* name, char_td enctype = 0);
227 void clearOwnerName();
228 ushort_td recordLength();
229 void stats(
void* databuffer, uint_td buflen,
bool estimate =
true);
230 char* getCreateSql(
char* retbuf, uint_td* size);
233 char_td mode()
const;
234 void setTimestampMode(
int mode);
235 bool setUpdateConflictCheck(
bool v);
236 bool updateConflictCheck()
const;
237 static _TCHAR* getFileName(
const _TCHAR* uri, _TCHAR* retbuf);
238 static short_td tdapErr(HWND hWnd, short_td status,
239 const _TCHAR* tableName = NULL,
240 _TCHAR* retbuf = NULL);
241 static void throwError(
const _TCHAR* caption,
short statusCode);
242 static void throwError(
const _TCHAR* caption,
nstable* tb);
243 static _TCHAR* getDirURI(
const _TCHAR* uri, _TCHAR* retbuf);
244 static bool existsFile(
const _TCHAR* filename);
247 void test_store(
const char* values);
257 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_NSTABLE_H
void * m_keybuf
Definition: nsTable.h:76
void setBuflen(uint_td v)
Definition: nsTable.h:166
short_td tdapErr(HWND hWnd, _TCHAR *retbuf=NULL)
Definition: nsTable.h:190
void del(bool in_key=false)
Definition: nsTable.h:179
bool canWrite() const
Definition: nsTable.h:173
void abortBulkInsert()
Definition: nsTable.h:201
const void * data() const
Definition: nsTable.h:163
char_td m_keynum
Definition: nsTable.h:83
uint_td m_datalen
Definition: nsTable.h:78
virtual int onInsertBefore()
Definition: nsTable.h:110
keylen_td m_keylen
Definition: nsTable.h:81
ushort_td commitBulkInsert(bool autoCommit=false)
Definition: nsTable.h:202
bool canRead() const
Definition: nsTable.h:172
virtual __int64 getUpdateStampValue() const
Definition: nsTable.h:136
BOOKMARK構造体
Definition: tdapcapi.h:37
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:85
void setKeyNum(char_td v)
Definition: nsTable.h:171
_TCHAR * statMsg(_TCHAR *retbuf)
Definition: nsTable.h:194
virtual bool isUniqeKey(char_td keynum)
Definition: nsTable.h:105
eFindType
findオペレーションで検索の方向を示すタイプ
Definition: nsTable.h:57
void setStat(short_td v)
Definition: nsTable.h:169
uint_td m_buflen
Definition: nsTable.h:77
bool canDelete() const
Definition: nsTable.h:175
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:45
short_td m_stat
Definition: nsTable.h:82
short_td stat() const
Definition: nsTable.h:168
uint_td recordCount(bool estimate=true, bool fromCurrent=false)
Definition: nsTable.h:186
virtual bool onDeleteCheck(bool in_key)
Definition: nsTable.h:123
uint_td getWriteImageLen()
Definition: nsTable.h:176
virtual keylen_td writeKeyData()
Definition: nsTable.h:125
virtual bool getUpdateStampEnable() const
Definition: nsTable.h:137
keylen_td m_keybuflen
Definition: nsTable.h:80
virtual void onUpdateAfter(int beforeResult)
Definition: nsTable.h:122
uint_td buflen() const
Definition: nsTable.h:165
uchar_td m_curd
Definition: nsTable.h:95
ushort_td insert(bool ncc=false)
Definition: nsTable.h:180
void createIndex(bool specifyKeyNum=false)
Definition: nsTable.h:181
uint_td datalen() const
Definition: nsTable.h:167
void open(const _TCHAR *uri, char_td mode=0, const _TCHAR *ownerName=NULL)
Definition: nsTable.h:138
void close()
Definition: nsTable.h:177
ushort_td m_op
Definition: nsTable.h:79
void * m_pdata
Definition: nsTable.h:75
bool canInsert() const
Definition: nsTable.h:174
eUpdateType
更新オペレーションの対象とカレント移動のタイプ
Definition: nsTable.h:51
void update(eUpdateType type=changeCurrentCc)
Definition: nsTable.h:178
char_td keyNum() const
Definition: nsTable.h:170
virtual bool onUpdateCheck(eUpdateType type)
Definition: nsTable.h:116
void setAccessRights(unsigned char curd)
Definition: nsTable.h:162
virtual int onUpdateBefore()
Definition: nsTable.h:117
virtual uint_td doGetWriteImageLen()
Definition: nsTable.h:127
void setData(void *v)
Definition: nsTable.h:164