1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
22 #include "fieldNameAlias.h"
41 class stringConverter;
45 class DLLLIB fieldShare
49 friend class recordCache;
52 struct Imple* m_imple;
55 unsigned char myDateTimeValueByBtrv : 1;
56 unsigned char logicalToString : 1;
58 fieldShare(
const fieldShare&);
59 fieldShare& operator=(
const fieldShare&);
64 virtual ~fieldShare();
65 stringConverter* cv()
const;
66 bzs::rtl::stringBuffer* strBufs()
const;
67 void blobPushBack(
char* p);
69 void blobResize(
size_t size);
77 friend class recordsetImple;
81 friend struct recordsetQueryImple;
86 struct infoImple* m_imple;
92 bool mysqlnullEnable()
const;
94 size_t totalFieldLen()
const;
95 void resetUpdateIndicator();
96 void setAliases(
const aliasMap_type* p);
98 void calcFieldPos(
int startIndex,
bool mysqlNull);
99 void remove(
int index);
100 void reserve(
size_t size);
104 void addAliasName(
int index,
const _TCHAR* name);
105 int indexByName(
const std::_tstring& name)
const;
106 const fielddef& operator[](
int index)
const;
107 const fielddef& operator[](
const _TCHAR* name)
const;
108 const fielddef& operator[](
const std::_tstring& name)
const;
109 bool checkIndex(
int index)
const;
111 void addAllFields(
const tabledef* def);
112 void addSelectedFields(
const class table* tb);
125 friend class recordsetImple;
128 friend int compBlob(
const field& l,
const field& r,
char logType);
131 unsigned char* m_ptr;
133 mutable unsigned char* m_cachedNullPtr;
134 mutable unsigned char m_nullbit;
135 unsigned char m_nullSign;
137 void nullPtrCache()
const;
138 int blobLenBytes()
const {
return m_fd->blobLenBytes(); }
139 __int64 readValue64()
const;
140 void storeValue64(__int64 value);
141 double readValueDbl()
const;
142 void storeValueDbl(
double value);
143 void storeValueStrA(
const char* data);
144 const char* readValueStrA()
const;
146 void storeValueStrW(
const WCHAR* data);
147 const WCHAR* readValueStrW()
const;
149 void storeValueNumeric(
double data);
150 double readValueNumeric()
const;
151 void storeValueDecimal(
double data);
152 double readValueDecimal()
const;
153 void* nullPtr()
const;
154 int nullComp(
const field& r,
char log)
const;
155 int nullComp(
char log)
const;
156 int nullCompMatch(
const field& r,
char log)
const;
157 bool isCompPartAndMakeValue();
158 void offsetBlobPtr(
size_t offset);
161 const char* getFVAstr()
const;
163 const wchar_t* getFVWstr()
const;
165 __int64 getFV64()
const;
166 double getFVdbl()
const;
167 void* getFVbin(uint_td& size)
const;
168 inline unsigned char getFVbyt()
const {
return (
unsigned char)getFV64();}
169 inline short getFVsht()
const {
return (
short)getFV64();}
170 inline int getFVint()
const {
return (
int)getFV64();}
171 inline int getFVlng()
const {
return (
int)getFV64();}
172 inline float getFVflt()
const {
return (
float)getFVdbl();}
175 void setFVW(
const wchar_t* data);
177 void setFV(
double data);
178 void setFV(__int64 data);
179 void setFVA(
const char* data);
180 void setFV(
const void* data, uint_td size);
182 inline const wchar_t* getFVstr()
const {
return getFVWstr(); };
183 inline void setFV(
const wchar_t* data) { setFVW(data); };
184 inline void setFV(
const std::wstring& p) { setFVW(p.c_str()); }
186 inline const char* getFVstr()
const {
return getFVAstr(); };
188 inline void setFV(
const char* data) { setFVA(data); };
189 inline void setFV(
float data){ setFV((
double)data); }
190 inline void setFV(
unsigned char data) { setFV((__int64)data); }
191 inline void setFV(
short data) { setFV((__int64)data); }
192 inline void setFV(
int data) { setFV((__int64)data); }
193 inline void setFV(
const std::string& p) { setFVA(p.c_str()); };
194 inline void setFV(
const bitset& v) { setFV(v.internalValue()); };
199 #if defined(SWIG) || \
200 defined(SWIG_BUILDING) // SWIG Wrapper need public constructor
203 inline field() : m_fd(NULL), m_ptr(NULL), m_fds(NULL){};
209 inline field(
unsigned char* ptr,
const fielddef& fd,
const fielddefs* fds,
210 bool nullField =
false)
211 : m_fd((fielddef*)&fd), m_ptr(ptr), m_fds(fds), m_cachedNullPtr(NULL), m_nullbit(0)
215 m_cachedNullPtr = (
unsigned char*)&m_nullSign;
223 inline field(
const field& r) : m_fd(r.m_fd), m_ptr(r.m_ptr), m_fds(r.m_fds),
224 m_cachedNullPtr(NULL),m_nullbit(r.m_nullbit), m_nullSign(r.m_nullSign)
226 if (r.m_cachedNullPtr == (
unsigned char*)&r.m_nullSign)
227 m_cachedNullPtr = (
unsigned char*)&m_nullSign;
235 m_nullSign = r.m_nullSign;
236 m_nullbit = r.m_nullbit;
237 if (r.m_cachedNullPtr == (
unsigned char*)&r.m_nullSign)
238 m_cachedNullPtr = (
unsigned char*)&m_nullSign;
240 m_cachedNullPtr = NULL;
248 inline unsigned char type()
const {
return m_fd->type; }
250 inline unsigned short len()
const {
return m_fd->len; }
252 inline const _TCHAR*
c_str()
const {
return getFVstr(); }
254 inline const char*
a_str()
const {
return getFVAstr(); }
256 inline int i()
const {
return getFVint(); }
258 inline int i8()
const {
return getFVbyt(); }
260 inline short i16()
const {
return getFVsht(); }
262 inline __int64
i64()
const {
return getFV64(); }
264 inline float f()
const {
return getFVflt(); }
266 inline double d()
const {
return getFVdbl(); }
270 void setNull(
bool v);
276 m_fd->enableFlags.bitE =
true;
280 inline bool operator!=(
const _TCHAR* p)
const {
return !operator==(p); }
284 return (isNull() ==
false) && (_tcscmp(p,
c_str()) == 0);
287 inline bool operator!=(
int v)
const {
return !operator==(v); }
288 inline bool operator==(
int v)
const {
return (isNull() ==
false) && (v == i()); }
290 inline bool operator!=(
short v)
const {
return !operator==(v); }
291 inline bool operator==(
short v)
const {
return (isNull() ==
false) && (v == i16()); }
293 inline bool operator!=(__int64 v)
const {
return !operator==(v); }
294 inline bool operator==(__int64 v)
const {
return (isNull() ==
false) && (v == i64()); }
296 inline bool operator!=(
float v)
const {
return !operator==(v); }
297 inline bool operator==(
float v)
const {
return (isNull() ==
false) && (v == f()); }
299 inline bool operator!=(
double v)
const {
return !operator==(v); }
300 inline bool operator==(
double v)
const {
return (isNull() ==
false) && (v == d()); }
302 inline void setBin(
const void* data, uint_td size)
305 m_fd->enableFlags.bitE =
true;
307 inline void*
getBin(uint_td& size)
const {
return getFVbin(size); };
311 int comp(
const field& r,
char logType = CMPLOGICAL_VAR_COMP_ALL)
const;
319 inline int getFieldType(
int)
324 inline int getFieldType(__int64)
329 inline int getFieldType(
short)
334 inline int getFieldType(
char)
339 inline int getFieldType(
double)
344 inline int getFieldType(
float)
349 inline __int64 fieldValue(
const field& fd, __int64)
354 inline int fieldValue(
const field& fd,
int)
359 inline short fieldValue(
const field& fd,
short)
361 return (
short)fd.i();
364 inline char fieldValue(
const field& fd,
char)
369 inline double fieldValue(
const field& fd,
double)
374 inline float fieldValue(
const field& fd,
float)
379 inline const _TCHAR* fieldValue(
const field& fd,
const _TCHAR*)
384 DLLLIB
const fielddef& dummyFd();
394 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
bool operator!=(double v) const
Definition: field.h:299
bool operator!=(__int64 v) const
Definition: field.h:293
field & operator=(const T c)
Definition: field.h:273
field(const field &r)
Definition: field.h:223
const _TCHAR * c_str() const
Definition: field.h:252
bool operator==(float v) const
Definition: field.h:297
bool operator==(int v) const
Definition: field.h:288
bool operator==(const _TCHAR *p) const
Definition: field.h:282
bool operator==(__int64 v) const
Definition: field.h:294
__int64 i64() const
Definition: field.h:262
フィールド定義構造体
Definition: tdapSchema.h:419
unsigned short len() const
Definition: field.h:250
フィールドコレクションクラス
Definition: fields.h:256
bool operator!=(int v) const
Definition: field.h:287
float f() const
Definition: field.h:264
const char * a_str() const
Definition: field.h:254
short i16() const
Definition: field.h:260
bool operator==(short v) const
Definition: field.h:291
void setBin(const void *data, uint_td size)
Definition: field.h:302
テーブルアクセスクラス (nocopyable)
Definition: table.h:91
int i8() const
Definition: field.h:258
bool operator!=(const _TCHAR *p) const
Definition: field.h:280
fielddef のコレクションクラス
Definition: field.h:74
int i() const
Definition: field.h:256
bitset getBits() const
Definition: field.h:309
recordset フィルタリングクエリー
Definition: groupQuery.h:107
フィールドコレクションのベースクラス
Definition: fields.h:123
const fielddef * def() const
Definition: field.h:246
bool operator!=(short v) const
Definition: field.h:290
bool operator!=(float v) const
Definition: field.h:296
unsigned char type() const
Definition: field.h:248
bool operator==(double v) const
Definition: field.h:300
書き込み可能な行のクラスです。
Definition: memRecord.h:170
ビット集合アクセスクラス
Definition: tdapSchema.h:294
double d() const
Definition: field.h:266
field & operator=(const field &r)
Definition: field.h:230
const _TCHAR * c_str(const btrDate &d)
Definition: btrDate.h:232
rowの実装クラス
Definition: memRecord.h:69
テーブル定義構造体
Definition: tdapSchema.h:1051
void * getBin(uint_td &size) const
Definition: field.h:307
フィールドアクセスクラス
Definition: field.h:118