全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
table.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_TABLE_H
2 #define BZS_DB_PROTOCOL_TDAP_CLIENT_TABLE_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 #include "nsTable.h"
22 #include <vector>
23 #include <stdio.h>
24 #include <boost/shared_ptr.hpp>
25 
26 namespace bzs
27 {
28 
29 namespace db
30 {
31 struct blobHeader;
32 struct blob;
33 namespace protocol
34 {
35 namespace tdap
36 {
37 namespace client
38 {
39 
40 /** @cond INTERNAL */
41 class database;
42 class queryBase;
43 class fields;
44 class table;
45 /** @endcond */
46 
47 #if (defined(__BORLANDC__) && !defined(__APPLE__) && !defined(__clang__))
48 typedef void __stdcall(* recordCountFn)(table* tb, int count, bool& complate);
49 #else
50 /** @cond INTERNAL */
51 /** Callback function on a record was record count. */
52 typedef void(__STDCALL* recordCountFn)(table* tb, int count, bool& complate);
53 #endif
54 
55 #define null_str _T("")
56 
57 #pragma warning(disable : 4251)
58 
59 static const int mra_nojoin = 0;
60 static const int mra_first = 0;
61 static const int mra_nextrows = 1;
62 static const int mra_innerjoin = 2;
63 static const int mra_outerjoin = 4;
64 static const int mra_current_block = -1;
65 
66 class multiRecordAlocator
67 {
68 
69 public:
70  virtual ~multiRecordAlocator() {}
71  virtual void init(size_t recordCount, size_t recordLen, int addType,
72  const class table* tb) = 0;
73  virtual unsigned char* allocBlobBlock(size_t size) = 0;
74  virtual unsigned char* ptr(size_t row, int stat) = 0;
75  virtual void setJoinType(int v) = 0;
76  virtual void setInvalidMemblock(size_t row, bool v) = 0;
77  virtual void setJoinRowMap(
78  const std::vector<std::vector<int> >* v /*, size_t size*/) = 0;
79  virtual const std::vector<std::vector<int> >* joinRowMap() const = 0;
80  virtual void duplicateRow(int row, int count) = 0;
81  virtual void removeLastMemBlock(int row) = 0;
82  virtual int joinType() const = 0;
83 };
84 
85 class filter;
86 typedef boost::shared_ptr<filter> pq_handle;
87 
88 /** @endcond */
89 
90 
91 class DLLLIB table : public nstable
92 {
93  static void* __STDCALL DDBA(client::table* tb, uint_td size);
94 
95  friend class recordCache;
96  friend class database;
97  friend class filter;
98  friend class fields;
99  friend class writableRecord;
100  friend struct logic;
101 
102  struct tbimpl* m_impl;
103  class fielddefs* m_fddefs;
104  tabledef** m_tableDef;
105 
106  uchar_td charset() const;
107  bool checkIndex(short index) const;
108  void getKeySpec(keySpec* ks, bool SpecifyKeyNum = false);
109  unsigned char* setBlobFieldPointer(char* ptr, const ::bzs::db::blobHeader* p,
110  unsigned char* to=NULL);
111  void addSendBlob(const bzs::db::blob* blob);
112  void addBlobEndRow();
113  void resetSendBlob();
114  void btrvGetExtend(ushort_td op);
115  void getRecords(ushort_td op);
116  uint_td doGetWriteImageLen(); // orverride
117  void doUpdate(bool ncc = false); // orverride
118  ushort_td doCommitBulkInsert(bool autoCommit = false); // orverride
119  void doAbortBulkInsert(); // orverride
120  void doCreateIndex(bool SpecifyKeyNum = false); // orverride
121  uint_td doRecordCount(bool estimate, bool fromCurrent); // orverride
122  short_td doBtrvErr(HWND hWnd, _TCHAR* retbuf = NULL); // orverride
123  void doFind(ushort_td op, bool notIncCurrent);
124  void* getExtendBufferForOpen(uint_td& size); // orverride
125  bool setSeekValueField(int row);
126  void btrvSeekMulti();
127  bool doSeekMultiAfter(int row);
128  void* doDdba(uint_td size);
129  bool isReadContinue(ushort_td& op);
130  void incTabledefRefCount(tabledef* td, bool mysqlMullmode);
131  __int64 getUpdateStampValue() const;// orverride
132  bool getUpdateStampEnable() const;// orverride
133 
134 protected:
135  explicit table(nsdatabase* pbe); // Inheritance is impossible
136  virtual ~table();
137  void* dataBak() const;
138  void* reallocDataBuffer(uint_td v);
139  int dataBufferLen() const;
140  uint_td unPack(char* ptr, size_t size);
141  uint_td pack(char* ptr, size_t size);
142 
143  keylen_td writeKeyData(); // orverride
144  keylen_td writeKeyDataTo(uchar_td* to, int keySize);
145 
146  void writeRecordData(){};
147 
148  void onReadAfter(); // orverride
149  bool onUpdateCheck(eUpdateType type); // orverride
150 
151  int onUpdateBefore() { return 0; }; // orverride
152 
153  void onUpdateAfter(int beforeResult); // orverride
154  bool onDeleteCheck(bool inkey); // orverride
155 
156  int onInsertBefore() { return 0; }; // orverride
157 
158  void onInsertAfter(int beforeResult); // orverride
159  bool isUniqeKey(char_td keynum); // orverride
160  void init(tabledef** def, short filenum, bool regularDir, bool mysqlnull);
161  void* attachBuffer(void* newPtr, bool unpack = false, size_t size = 0);
162  void dettachBuffer();
163  bool doPrepare();
164 
165  inline unsigned int nullBytes() const
166  {
167  return (m_tableDef && (*m_tableDef)->isMysqlNullMode()) ?
168  (*m_tableDef)->nullbytes() : 0;
169  }
170 
171  virtual void doInit(tabledef** def, short filenum, bool regularDir, bool mysqlnull);
172 
173  virtual void onRecordCounting(size_t count, bool& cancel);
174 
175  virtual void setNoUpdateTimeStamp(bool v){};
176 
177 public:
178  using nstable::eFindType;
179  enum eNullReset{clearNull, defaultNull};
180 
181  inline const tabledef* tableDef() const { return *m_tableDef; };
182  inline const tabledef** tableDefPtr() const
183  {
184  return const_cast<const tabledef**>(m_tableDef);
185  }
186 
187  inline bool valiableFormatType() const
188  {
189  return (*m_tableDef)->optionFlags.bitA || (*m_tableDef)->m_nullbytes;
190  }
191 
192  inline bool blobFieldUsed() const { return (*m_tableDef)->optionFlags.bitB; }
193 
194  bool logicalToString() const;
195  void setLogicalToString(bool v);
196  void* optionalData() const;
197  void setOptionalData(void* v);
198  bool myDateTimeValueByBtrv() const;
199  void insertBookmarks(unsigned int start, void* data, ushort_td count);
200  int bookmarksCount() const;
201  void moveBookmarks(unsigned int index);
202  bookmark_td bookmarks(unsigned int index) const;
203  void clearBuffer(eNullReset resetType = defaultNull);
204  unsigned int getRecordHash() const;
205  void smartUpdate();
206 
207  void setMra(multiRecordAlocator* p);
208  multiRecordAlocator* mra() const;
209 
210  void find(eFindType type = findForword);
211  void findFirst();
212  void findLast();
213  void findNext(bool notIncCurrent = true);
214  void findPrev(bool notIncCurrent = true);
215  short statReasonOfFind() const ;
216  eFindType lastFindDirection() const;
217  bookmark_td bookmarkFindCurrent() const;
218  pq_handle setQuery(const queryBase* query, bool serverPrepare=false);
219  pq_handle prepare(const queryBase* query, bool serverPrepare=false)
220  {
221  return setQuery(query, serverPrepare);
222  }
223  void setPrepare(const pq_handle stmt);
224 
225  void setFilter(const _TCHAR* str, ushort_td rejectCount,
226  ushort_td cacheCount, bool autoEscape = true);
227  short fieldNumByName(const _TCHAR* name) const ;
228  unsigned char getFVbyt(short index) const;
229  short getFVsht(short index) const;
230  int getFVint(short index) const;
231  int getFVlng(short index) const;
232  __int64 getFV64(short index) const;
233  float getFVflt(short index) const;
234  double getFVdbl(short index) const;
235  const char* getFVAstr(short index) const;
236  void* getFVbin(short index, uint_td& size) const;
237  unsigned char getFVbyt(const _TCHAR* fieldName) const;
238  short getFVsht(const _TCHAR* fieldName) const;
239  int getFVint(const _TCHAR* fieldName) const;
240  int getFVlng(const _TCHAR* fieldName) const;
241  __int64 getFV64(const _TCHAR* fieldName) const;
242  float getFVflt(const _TCHAR* fieldName) const;
243  double getFVdbl(const _TCHAR* fieldName) const;
244  const char* getFVAstr(const _TCHAR* fieldName) const;
245  void* getFVbin(const _TCHAR* fieldName, uint_td& size) const;
246  bool getFVNull(short index) const ;
247  bool getFVNull(const _TCHAR* fieldName) const;
248 
249  inline bitset getFVbits(short index) const
250  {
251  return bitset(getFV64(index));
252  }
253 
254  inline bitset getFVbits(const _TCHAR* fieldName) const
255  {
256  return bitset(getFV64(fieldName));
257  }
258 
259  void setFV(short index, double data);
260  void setFV(short index, float data);
261  void setFV(short index, unsigned char data);
262  void setFV(short index, short data);
263  void setFVA(short index, const char* data);
264  void setFV(short index, int data);
265  void setFV(short index, const void* data, uint_td size);
266  void setFV(const _TCHAR* fieldName, int data);
267  void setFVA(const _TCHAR* fieldName, const char* data);
268  void setFVNull(short index, bool v);
269  void setFVNull(const _TCHAR* fieldName, bool v);
270 
271 #ifdef _WIN32
272  const wchar_t* getFVWstr(const _TCHAR* fieldName) const;
273  const wchar_t* getFVWstr(short index) const;
274  void setFVW(short index, const wchar_t* data);
275  void setFVW(const _TCHAR* fieldName, const wchar_t* data);
276 #endif
277 
278 #ifdef _UNICODE
279  inline const wchar_t* getFVstr(short index) const { return getFVWstr(index); };
280  inline const wchar_t* getFVstr(const wchar_t* fieldName) const
281  {
282  return getFVWstr(fieldName);
283  };
284 #else
285  inline const char* getFVstr(short index) const { return getFVAstr(index); };
286  inline const char* getFVstr(const char* fieldName) const
287  {
288  return getFVAstr(fieldName);
289  };
290 #endif
291 
292  inline void setFV(short index, const char* data) { setFVA(index, data); };
293  inline void setFV(const _TCHAR* fieldName, const char* data)
294  {
295  setFVA(fieldName, data);
296  };
297 #ifdef _WIN32
298  inline void setFV(short index, const wchar_t* data)
299  {
300  setFVW(index, data);
301  };
302  inline void setFV(const _TCHAR* fieldName, const wchar_t* data)
303  {
304  setFVW(fieldName, data);
305  };
306 #endif
307 
308  inline void setFV(short index, const bitset& bits)
309  {
310  setFV(index, bits.internalValue());
311  }
312 
313  inline void setFV(const _TCHAR* fieldName, const bitset& bits)
314  {
315  setFV(fieldName, bits.internalValue());
316  }
317 
318 
319  void setFV(const _TCHAR* fieldName, double data);
320  void setFV(const _TCHAR* fieldName, float data);
321  void setFV(const _TCHAR* fieldName, unsigned char data);
322  void setFV(const _TCHAR* fieldName, short data);
323  void setFV(const _TCHAR* fieldName, const void* data, uint_td size);
324  void setFV(short index, __int64 data);
325  void setFV(const _TCHAR* fieldName, __int64 data);
326  void* fieldPtr(short index) const;
327  void keyValueDescription(_TCHAR* buf, int bufsize);
328  short getCurProcFieldCount() const;
329  short getCurProcFieldIndex(short index) const;
330  void setOnRecordCount(const recordCountFn v);
331  recordCountFn onRecordCount() const;
333  void setAlias(const _TCHAR* orign, const _TCHAR* alias);
334 };
335 
336 #define KEYVALUE_PTR 0
337 #define KEYVALUE_STR 1
338 #define KEYVALUE_NEED_COPY 2
339 #define KEYVALUE_STR_NEED_COPY 3
340 
341 /** @cond INTERNAL */
342 
343 struct DLLLIB keyValuePtr
344 {
345 
346  const void* ptr;
347  ushort_td len;
348  short type;
349  keyValuePtr(const void* p, ushort_td l, short typeStr);
350  ~keyValuePtr();
351 };
352 /** @endcond */
353 
354 class DLLLIB queryBase
355 {
356  friend class filter;
357  struct impl* m_impl;
358 
359 protected:
360  const std::vector<std::_tstring>& getSelects() const;
361  const std::vector<std::_tstring>& getWheres() const;
362  const std::vector<std::_tstring>& getSeekKeyValues() const;
363  const std::vector<keyValuePtr>& getSeekValuesPtr() const;
364 
365 public:
367  {
368  none = 0,
369  joinHasOneOrHasMany = 1,
370  combineCondition = 2
371  };
372 
373  queryBase();
374  queryBase(const queryBase& r);
375  queryBase& operator=(const queryBase& r);
376 
377  virtual ~queryBase();
378  void reset();
379  void clearSeekKeyValues();
380  void clearSelectFields();
381  void addField(const _TCHAR* name);
382  void addLogic(const _TCHAR* name, const _TCHAR* logic, const _TCHAR* value);
383  void addLogic(const _TCHAR* combine, const _TCHAR* name,
384  const _TCHAR* logic, const _TCHAR* value);
385  void addSeekKeyValue(const _TCHAR* value, bool reset = false);
386  void addSeekBookmark(bookmark_td& bm, ushort_td len, bool reset = false);
387  void addSeekKeyValuePtr(const void* value, ushort_td len, short typeStr,
388  bool reset = false);
389  void reserveSeekKeyValueSize(size_t v);
390  void reserveSeekKeyValuePtrSize(size_t v);
391  queryBase& queryString(const _TCHAR* str, bool autoEscape = false);
392  queryBase& reject(int v);
393  queryBase& limit(int v);
394  queryBase& direction(table::eFindType v);
395  queryBase& all();
396  queryBase& optimize(eOptimize v);
397  queryBase& bookmarkAlso(bool v);
398  queryBase& joinKeySize(int v);
399  queryBase& stopAtLimit(bool v);
400  const _TCHAR* toString() const;
401  table::eFindType getDirection() const;
402  int getReject() const;
403  int getLimit() const;
404  bool isAll() const;
405  int getJoinKeySize() const;
406  eOptimize getOptimize() const;
407  bool isStopAtLimit() const;
408  bool isBookmarkAlso() const;
409  bool isSeekByBookmarks() const;
410  short selectCount() const;
411  const _TCHAR* getSelect(short index) const;
412  short whereTokens() const;
413  const _TCHAR* getWhereToken(short index) const;
414  void setWhereToken(short index, const _TCHAR* v);
415  void reverseAliasName(const _TCHAR* alias, const _TCHAR* src);
416  void release(); // don't virtual
417  static queryBase* create();
418 };
419 
420 /** @cond INTERNAL */
421 
422 inline std::_tstring lexical_cast(__int64 v)
423 {
424  _TCHAR tmp[256];
425  _i64tot_s(v, tmp, 256, 10);
426  return std::_tstring(tmp);
427 }
428 
429 inline std::_tstring lexical_cast(int v)
430 {
431  _TCHAR tmp[256];
432  _ltot_s(v, tmp, 256, 10);
433  return std::_tstring(tmp);
434 }
435 
436 inline std::_tstring lexical_cast(short v)
437 {
438  _TCHAR tmp[256];
439  _ltot_s((int)v, tmp, 256, 10);
440  return std::_tstring(tmp);
441 }
442 
443 inline std::_tstring lexical_cast(char v)
444 {
445  _TCHAR tmp[256];
446  _ltot_s((int)v, tmp, 256, 10);
447  return std::_tstring(tmp);
448 }
449 
450 inline std::_tstring lexical_cast(double v)
451 {
452  _TCHAR tmp[256];
453  _stprintf_s(tmp, 256, _T("%.*f"), 16, v);
454  return std::_tstring(tmp);
455 }
456 
457 inline std::_tstring lexical_cast(float v)
458 {
459  _TCHAR tmp[256];
460  _stprintf_s(tmp, 256, _T("%.*f"), 16, v);
461  return std::_tstring(tmp);
462 }
463 
464 inline std::_tstring lexical_cast(const _TCHAR* v)
465 {
466  if (v)
467  return std::_tstring(v);
468  THROW_BZS_ERROR_WITH_CODEMSG(STATUS_FILTERSTRING_ERROR,
469  _T("Invalid the value, The value is NULL."));
470  return std::_tstring(_T(""));
471 }
472 
473 
474 class qlogic
475 {
476  std::_tstring m_name;
477  std::_tstring m_value;
478  std::_tstring m_type;
479  combineType m_next;
480 
481 public:
482  template <class T>
483  qlogic(const _TCHAR* name, const _TCHAR* type, T value, combineType next)
484  : m_name(name), m_type(type), m_next(next)
485  {
486  m_value = lexical_cast(value);
487  }
488 };
489 /** @endcond */
490 
491 class DLLLIB query : public queryBase
492 {
493 public:
494  query() : queryBase() {}
495  query(const query& r) : queryBase(r) {}
496 
497  virtual ~query() {}
498 
500  {
502  return *this;
503  }
504 
505  query& select(const _TCHAR* name, const _TCHAR* name1 = NULL,
506  const _TCHAR* name2 = NULL, const _TCHAR* name3 = NULL,
507  const _TCHAR* name4 = NULL, const _TCHAR* name5 = NULL,
508  const _TCHAR* name6 = NULL, const _TCHAR* name7 = NULL,
509  const _TCHAR* name8 = NULL, const _TCHAR* name9 = NULL,
510  const _TCHAR* name10 = NULL)
511  {
512  if (_tcscmp(name, _T("*")) == 0)
513  {
514  clearSelectFields();
515  return *this;
516  }
517  addField(name);
518  if (name1)
519  addField(name1);
520  if (name2)
521  addField(name2);
522  if (name3)
523  addField(name3);
524  if (name4)
525  addField(name4);
526  if (name5)
527  addField(name5);
528  if (name6)
529  addField(name6);
530  if (name7)
531  addField(name7);
532  if (name8)
533  addField(name8);
534  if (name9)
535  addField(name9);
536  if (name10)
537  addField(name10);
538  return *this;
539  }
540 
541  template <class T>
542  query& where(const _TCHAR* name, const _TCHAR* qlogic, T value)
543  {
544  addLogic(name, qlogic, lexical_cast(value).c_str());
545  return *this;
546  }
547 
548  query& whereIsNull(const _TCHAR* name)
549  {
550  addLogic(name, _T("<==>"), _T(""));
551  return *this;
552  }
553 
554  query& whereIsNotNull(const _TCHAR* name)
555  {
556  addLogic(name, _T("<!=>"), _T(""));
557  return *this;
558  }
559 
560  template <class T>
561  query& and_(const _TCHAR* name, const _TCHAR* qlogic, T value)
562  {
563  if (whereTokens() == 0)
564  THROW_BZS_ERROR_WITH_CODEMSG(STATUS_FILTERSTRING_ERROR,
565  _T("Invalid function call."));
566 
567  addLogic(_T("and"), name, qlogic, lexical_cast(value).c_str());
568  return *this;
569  }
570 
571  query& andIsNull(const _TCHAR* name)
572  {
573  addLogic(_T("and"), name, _T("<==>"), _T(""));
574  return *this;
575  }
576 
577  query& andIsNotNull(const _TCHAR* name)
578  {
579  addLogic(_T("and"), name, _T("<!=>"), _T(""));
580  return *this;
581  }
582 
583  template <class T>
584  query& or_(const _TCHAR* name, const _TCHAR* qlogic, T value)
585  {
586  if (whereTokens() == 0)
587  THROW_BZS_ERROR_WITH_CODEMSG(STATUS_FILTERSTRING_ERROR,
588  _T("Invalid function call."));
589 
590  addLogic(_T("or"), name, qlogic, lexical_cast(value).c_str());
591  return *this;
592  }
593 
594  query& orIsNull(const _TCHAR* name)
595  {
596  addLogic(_T("or"), name, _T("<==>"), _T(""));
597  return *this;
598  }
599 
600  query& orIsNotNull(const _TCHAR* name)
601  {
602  addLogic(_T("or"), name, _T("<!=>"), _T(""));
603  return *this;
604  }
605 
606 
607  template <class T0, class T1, class T2, class T3, class T4, class T5,
608  class T6, class T7>
609  query& in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
610  const T4 kv4, const T5 kv5, const T6 kv6, const T7 kv7)
611  {
612  addSeekKeyValue(lexical_cast(kv0).c_str());
613  addSeekKeyValue(lexical_cast(kv1).c_str());
614  addSeekKeyValue(lexical_cast(kv2).c_str());
615  addSeekKeyValue(lexical_cast(kv3).c_str());
616  addSeekKeyValue(lexical_cast(kv4).c_str());
617  addSeekKeyValue(lexical_cast(kv5).c_str());
618  addSeekKeyValue(lexical_cast(kv6).c_str());
619  addSeekKeyValue(lexical_cast(kv7).c_str());
620  return *this;
621  }
622  template <class T0, class T1, class T2, class T3, class T4, class T5,
623  class T6>
624  query& in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
625  const T4 kv4, const T5 kv5, const T6 kv6)
626  {
627  addSeekKeyValue(lexical_cast(kv0).c_str());
628  addSeekKeyValue(lexical_cast(kv1).c_str());
629  addSeekKeyValue(lexical_cast(kv2).c_str());
630  addSeekKeyValue(lexical_cast(kv3).c_str());
631  addSeekKeyValue(lexical_cast(kv4).c_str());
632  addSeekKeyValue(lexical_cast(kv5).c_str());
633  addSeekKeyValue(lexical_cast(kv6).c_str());
634  return *this;
635  }
636 
637  template <class T0, class T1, class T2, class T3, class T4, class T5>
638  query& in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
639  const T4 kv4, const T5 kv5)
640  {
641  addSeekKeyValue(lexical_cast(kv0).c_str());
642  addSeekKeyValue(lexical_cast(kv1).c_str());
643  addSeekKeyValue(lexical_cast(kv2).c_str());
644  addSeekKeyValue(lexical_cast(kv3).c_str());
645  addSeekKeyValue(lexical_cast(kv4).c_str());
646  addSeekKeyValue(lexical_cast(kv5).c_str());
647  return *this;
648  }
649 
650  template <class T0, class T1, class T2, class T3, class T4>
651  query& in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
652  const T4 kv4)
653  {
654  addSeekKeyValue(lexical_cast(kv0).c_str());
655  addSeekKeyValue(lexical_cast(kv1).c_str());
656  addSeekKeyValue(lexical_cast(kv2).c_str());
657  addSeekKeyValue(lexical_cast(kv3).c_str());
658  addSeekKeyValue(lexical_cast(kv4).c_str());
659  return *this;
660  }
661 
662  template <class T0, class T1, class T2, class T3>
663  query& in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3)
664  {
665  addSeekKeyValue(lexical_cast(kv0).c_str());
666  addSeekKeyValue(lexical_cast(kv1).c_str());
667  addSeekKeyValue(lexical_cast(kv2).c_str());
668  addSeekKeyValue(lexical_cast(kv3).c_str());
669  return *this;
670  }
671 
672  template <class T0, class T1, class T2>
673  query& in(const T0 kv0, const T1 kv1, const T2 kv2)
674  {
675  addSeekKeyValue(lexical_cast(kv0).c_str());
676  addSeekKeyValue(lexical_cast(kv1).c_str());
677  addSeekKeyValue(lexical_cast(kv2).c_str());
678  return *this;
679  }
680 
681  template <class T0, class T1> query& in(const T0 kv0, const T1 kv1)
682  {
683  addSeekKeyValue(lexical_cast(kv0).c_str());
684  addSeekKeyValue(lexical_cast(kv1).c_str());
685  return *this;
686  }
687 
688  template <class T0> query& in(const T0 kv0)
689  {
690  addSeekKeyValue(lexical_cast(kv0).c_str());
691  return *this;
692  }
693 
694  inline query& segmentsForInValue(int v) { joinKeySize(v); return *this;}
695 
696  static query* create(); // implemet int activeTable.cpp
697 };
698 
699 /** @cond INTERNAL */
700 int DLLLIB makeSupplyValues(/*in out*/const _TCHAR* values[], int size,
701  const _TCHAR* value, const _TCHAR* value1 = NULL,
702  const _TCHAR* value2 = NULL, const _TCHAR* value3 = NULL,
703  const _TCHAR* value4 = NULL, const _TCHAR* value5 = NULL,
704  const _TCHAR* value6 = NULL, const _TCHAR* value7 = NULL,
705  const _TCHAR* value8 = NULL, const _TCHAR* value9 = NULL,
706  const _TCHAR* value10 = NULL);
707 /** @endcond */
708 
709 bool DLLLIB supplyValues(pq_handle& filter, const _TCHAR* values[], int size);
710 bool DLLLIB supplyValue(pq_handle& filter, int index, const _TCHAR* v);
711 bool DLLLIB supplyValue(pq_handle& filter, int index, short v);
712 bool DLLLIB supplyValue(pq_handle& filter, int index, int v);
713 bool DLLLIB supplyValue(pq_handle& filter, int index, __int64 v);
714 bool DLLLIB supplyValue(pq_handle& filter, int index, float v);
715 bool DLLLIB supplyValue(pq_handle& filter, int index, double v);
716 
717 
718 #pragma warning(default : 4251)
719 
720 } // namespace client
721 } // namespace tdap
722 } // namespace protocol
723 } // namespace db
724 } // namespace bzs
725 
726 #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_TABLE_H
query & in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4)
Definition: table.h:651
query()
Definition: table.h:494
query(const query &r)
Definition: table.h:495
int onInsertBefore()
Definition: table.h:156
const tabledef * tableDef() const
Definition: table.h:181
pq_handle setQuery(table_ptr &tb, const queryBase &q, bool serverPrepare=false)
Definition: trdboostapi.h:564
void setFV(short index, const bitset &bits)
Definition: table.h:308
void writeRecordData()
Definition: table.h:146
query & orIsNull(const _TCHAR *name)
Definition: table.h:594
クエリー(フィルター)作成の補助をするためのベースクラス
Definition: table.h:354
query & in(const T0 kv0, const T1 kv1)
Definition: table.h:681
eFindType
Definition: nsTable.h:57
query & orIsNotNull(const _TCHAR *name)
Definition: table.h:600
BOOKMARK構造体
Definition: tdapcapi.h:37
データベースアクセス基本クラス (nocopyable)
Definition: nsDatabase.h:85
query & whereIsNull(const _TCHAR *name)
Definition: table.h:548
query & where(const _TCHAR *name, const _TCHAR *qlogic, T value)
Definition: table.h:542
フィールドコレクションクラス
Definition: fields.h:256
eOptimize
クエリーの実行時に行われる最適化条件をセットします。
Definition: table.h:366
findIterator find(table_ptr tb, const char_td keynum, const Q &q, const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5, const T6 kv6, const T7 kv7)
Definition: trdboostapi.h:589
__int64 internalValue() const
Definition: tdapSchema.h:315
query & reset()
Definition: table.h:499
query & in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5, const T6 kv6)
Definition: table.h:624
void setFV(const _TCHAR *fieldName, const bitset &bits)
Definition: table.h:313
bool DLLLIB supplyValues(pq_handle &filter, const _TCHAR *values[], int size)
eFindType
findオペレーションで検索の方向を示すタイプ
Definition: nsTable.h:57
テーブルアクセスクラス (nocopyable)
Definition: table.h:91
query & in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5, const T6 kv6, const T7 kv7)
Definition: table.h:609
int onUpdateBefore()
Definition: table.h:151
テーブルアクセスの基本クラス (abstruct nocopyable)
Definition: nsTable.h:45
void setFV(const _TCHAR *fieldName, const char *data)
Definition: table.h:293
query & select(const _TCHAR *name, const _TCHAR *name1=NULL, const _TCHAR *name2=NULL, const _TCHAR *name3=NULL, const _TCHAR *name4=NULL, const _TCHAR *name5=NULL, const _TCHAR *name6=NULL, const _TCHAR *name7=NULL, const _TCHAR *name8=NULL, const _TCHAR *name9=NULL, const _TCHAR *name10=NULL)
Definition: table.h:505
query & in(const T0 kv0, const T1 kv1, const T2 kv2)
Definition: table.h:673
unsigned int nullBytes() const
Definition: table.h:165
fielddef のコレクションクラス
Definition: field.h:74
query & in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3)
Definition: table.h:663
bitset getFVbits(short index) const
Definition: table.h:249
query & in(const T0 kv0)
Definition: table.h:688
query & andIsNull(const _TCHAR *name)
Definition: table.h:571
グルーピング レコード数カウンター
Definition: groupQuery.h:287
create tableで使用するキーセグメント定義構造体
Definition: tdapSchema.h:127
フィールドコレクションのベースクラス
Definition: fields.h:123
fieldsBase row
Definition: fields.h:252
bool DLLLIB supplyValue(pq_handle &filter, int index, const _TCHAR *v)
query & whereIsNotNull(const _TCHAR *name)
Definition: table.h:554
query & and_(const _TCHAR *name, const _TCHAR *qlogic, T value)
Definition: table.h:561
const char * getFVstr(short index) const
Definition: table.h:285
読み取り用クエリー
Definition: table.h:491
query & andIsNotNull(const _TCHAR *name)
Definition: table.h:577
const char * getFVstr(const char *fieldName) const
Definition: table.h:286
データベースアクセスクラス
Definition: database.h:59
query & in(const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5)
Definition: table.h:638
void setFV(short index, const char *data)
Definition: table.h:292
virtual void setNoUpdateTimeStamp(bool v)
Definition: table.h:175
書き込み可能な行のクラスです。
Definition: memRecord.h:170
ビット集合アクセスクラス
Definition: tdapSchema.h:294
query & or_(const _TCHAR *name, const _TCHAR *qlogic, T value)
Definition: table.h:584
pq_handle prepare(const queryBase *query, bool serverPrepare=false)
Definition: table.h:219
bitset getFVbits(const _TCHAR *fieldName) const
Definition: table.h:254
const _TCHAR * c_str(const btrDate &d)
Definition: btrDate.h:232
bool valiableFormatType() const
Definition: table.h:187
bool blobFieldUsed() const
Definition: table.h:192
const tabledef ** tableDefPtr() const
Definition: table.h:182
テーブル定義構造体
Definition: tdapSchema.h:1051
eNullReset
clearBuffer() でNULL許可フィールドの初期化方法を示します。
Definition: table.h:179
virtual ~query()
Definition: table.h:497
query & segmentsForInValue(int v)
Definition: table.h:694

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