全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
tdapSchema.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
2 #define BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_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 
22 #include <bzs/db/protocol/tdap/tdapcapi.h>
23 #include <string.h>
24 #include <algorithm>
25 #include <wchar.h>
26 #include <stdio.h>
27 #include <bzs/env/compiler.h>
28 #include <bzs/env/crosscompile.h>
29 #include <bzs/db/protocol/tdap/mysql/characterset.h>
30 #include <bzs/db/blobStructs.h>
31 #include <assert.h>
32 #include <bzs/db/protocol/tdap/myDateTime.h>
33 namespace bzs
34 {
35 namespace db
36 {
37 namespace protocol
38 {
39 namespace tdap
40 {
41 
42 namespace mysql
43 {
44 class schemaBuilder;
45 }
46 namespace client
47 {
48 class dbdef;
49 class fielddefs;
50 class table;
51 class database;
52 struct openTablePrams;
53 struct dbdimple;
54 class filter;
55 class recordCache;
56 class fielddefs;
57 class fields;
58 class field;
59 class memoryRecord;
60 struct logic;
61 class recordsetQuery;
62 class sqlBuilder;
63 }
64 
65 #pragma pack(push, 1)
67 
68 using std::min;
69 using std::max;
70 
71 #ifdef SWIG
72 
73 /* For swig interface
74  Export names .
75  */
76 union FLAGS
77 {
78  unsigned short all;
79 
80  unsigned short bit0 : 1;
81  unsigned short bit1 : 1;
82  unsigned short bit2 : 1;
83  unsigned short bit3 : 1;
84  unsigned short bit4 : 1;
85  unsigned short bit5 : 1;
86  unsigned short bit6 : 1;
87  unsigned short bit7 : 1;
88  unsigned short bit8 : 1;
89  unsigned short bit9 : 1;
90  unsigned short bitA : 1;
91  unsigned short bitB : 1;
92  unsigned short bitC : 1;
93  unsigned short bitD : 1;
94  unsigned short bitE : 1;
95  unsigned short bitF : 1;
96 };
97 #else // NOT SWIG
98 
99 union FLAGS
100 {
101  unsigned short all;
102 
103  struct
104  {
105  unsigned short bit0 : 1;
106  unsigned short bit1 : 1;
107  unsigned short bit2 : 1;
108  unsigned short bit3 : 1;
109  unsigned short bit4 : 1;
110  unsigned short bit5 : 1;
111  unsigned short bit6 : 1;
112  unsigned short bit7 : 1;
113  unsigned short bit8 : 1;
114  unsigned short bit9 : 1;
115  unsigned short bitA : 1;
116  unsigned short bitB : 1;
117  unsigned short bitC : 1;
118  unsigned short bitD : 1;
119  unsigned short bitE : 1;
120  unsigned short bitF : 1;
121  };
122 };
123 #endif // NOT SWIG
124 
125 /* brief Key infomation for create table operation
126  */
127 struct keySpec
128 {
129  ushort_td keyPos; /* key position */
130  ushort_td keyLen; /* key length */
131  FLAGS keyFlag; /* key flag */
132  uint_td keyCount; /* key count */
133  uchar_td keyType; /* key type of extended */
134  uchar_td nullValue; /* value of null */
135  uchar_td reserve2[2]; /* reserved */
136  uchar_td keyNo; /* fixed key number */
137  uchar_td acsNo; /* no acs */
138 }; /* total 16 byte */
139 
140 /* brief File infomation for create table operation
141  */
142 struct fileSpec
143 {
144  ushort_td recLen; /* record length */
145  ushort_td pageSize; /* page sise */
146  ushort_td indexCount; /* index count */
147  uint_td recCount; /* record count for stat */
148  FLAGS fileFlag; /* file flags */
149  uchar_td reserve1[2]; /* reserved */
150  ushort_td preAlloc; /* page allocation count */
151  keySpec keySpecs[1]; /* key specs */
152 }; /* total ? byte */
153 
154 /* brief A key segment infomation
155  */
157 {
158  uchar_td fieldNum; // Refarence field buymber
159  FLAGS flags; // key flags. 11 to 15bit is not use.
160 };
161 
162 /** keySegment::flags
163 */
164 #define kf_duplicatable bit0
165 #define kf_changeatable bit1
166 #define kf_allseg_nullkey bit3
167 #define kf_order_desc bit6
168 #define kf_extend bit8
169 #define kf_seg_nullkey bit9
170 #define kf_incase bitA
171 
172 
173 
174 /* brief A key infomation
175  */
176 #define MAX_KEY_SEGMENT 8
177 #define COMP_KEY_FLAGS(l, r, NAME) (l.NAME == r.NAME)
178 struct keydef
179 {
180  uchar_td segmentCount;
181  keySegment segments[MAX_KEY_SEGMENT];
182  uchar_td keyNumber;
183 
184  bool operator==(const keydef& r) const
185  {
186  if (this == &r) return true;
187  bool ret = (segmentCount == r.segmentCount) && (keyNumber == r.keyNumber);
188  if (!ret) return false;
189  for (int i = 0;i < segmentCount; ++i)
190  {
191  FLAGS f = segments[i].flags;
192  FLAGS rf = r.segments[i].flags;
193  ret = COMP_KEY_FLAGS(f, rf, kf_duplicatable) &&
194  COMP_KEY_FLAGS(f, rf, kf_changeatable) &&
195  COMP_KEY_FLAGS(f, rf, kf_allseg_nullkey) &&
196  COMP_KEY_FLAGS(f, rf, kf_order_desc) &&
197  COMP_KEY_FLAGS(f, rf, kf_seg_nullkey) &&
198  COMP_KEY_FLAGS(f, rf, kf_incase);
199  if (!ret) return false;
200  }
201  return true;
202  }
203 
204 private:
205  short synchronize(const keydef* kd);
206  friend struct tabledef;
207  friend class client::dbdef;
208 };
209 
210 static const int MYSQL_FDNAME_SIZE = 64;
211 static const int MYSQL_TBNAME_SIZE = 64;
212 static const int PERVASIVE_FDNAME_SIZE = 20;
213 static const int FIELD_NAME_SIZE = MYSQL_FDNAME_SIZE;
214 static const int TABLE_NAME_SIZE = 32;
215 static const int FILE_NAME_SIZE = 266;
216 
217 /** @cond INTERNAL */
218 #if (defined(__x86_32__) || defined(__APPLE_32__))
219 static const int TABLEDEF_FILLER_SIZE = 17; // 25-4-4;
220 #else
221 static const int TABLEDEF_FILLER_SIZE = 1; // 17-8 -8;
222 #endif
223 /** @endcond */
224 
225 #ifndef MYSQL_DYNAMIC_PLUGIN
226 
227 /* A field type name that specified by a type is returned.
228  */
229 PACKAGE const _TCHAR* getTypeName(short type);
230 
231 /* A field alignment that specified by a type is returned.
232  */
233 PACKAGE int getTypeAlign(short type);
234 
235 /* calcurate byts of char type by charctor number.
236  */
237 PACKAGE ushort_td
238  lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum);
239 
240 #endif // MYSQL_DYNAMIC_PLUGIN
241 
242 /* Is field type string ? */
243 inline bool isStringTypeForIndex(uchar_td type)
244 {
245  switch (type)
246  {
247  case ft_string:
248  case ft_zstring:
249  case ft_wstring:
250  case ft_wzstring:
251  case ft_mychar:
252  case ft_mywchar:
253  case ft_myvarchar:
254  case ft_myvarbinary:
255  case ft_mywvarchar:
256  case ft_mywvarbinary:
257  return true;
258  }
259  return false;
260 }
261 
262 inline bool isStringType(uchar_td type)
263 {
264  switch (type)
265  {
266  case ft_mygeometry:
267  case ft_myjson:
268  case ft_myblob:
269  case ft_mytext:
270  case ft_lstring:
271  case ft_note:
272  return true;
273  }
274  return isStringTypeForIndex(type);
275 }
276 
277 /** @cond INTERNAL */
278 #define PAD_CHAR_OPTION_SAVED 1
279 #define USE_PAD_CHAR 2
280 #define TRIM_PAD_CHAR 4
281 
282 #define FIELD_OPTION_NULLABLE 1
283 #define FIELD_OPTION_MARIADB 2
284 #define FIELD_OPTION_REGACY_TIME 4
285 
286 #define DEFAULT_VALUE_SIZE 8
287 
288 //For decimals
289 #define DIGITS_INT32 9
290 static const int decimalBytesBySurplus[DIGITS_INT32 + 1] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 4};
291 
292 /** @endcond */
293 
294 class bitset
295 {
296  unsigned __int64 m_i64;
297 
298 public:
299  bitset() : m_i64(0) { }
300 
301  bitset(__int64 v) : m_i64(v) { }
302 
303  inline void set(int index, bool value)
304  {
305  unsigned __int64 bits = 1ULL << index;
306  m_i64 = value ? m_i64 | bits : m_i64 & ~bits;
307  }
308 
309  inline bool get(int index) const
310  {
311  unsigned __int64 bits = 1ULL << index;
312  return (m_i64 & bits) != 0;
313  }
314 
315  inline __int64 internalValue() const { return (__int64)m_i64; }
316 
317  inline bool operator[](int index) const {return get(index); };
318 
319  inline bool operator==(const bitset& r) const
320  {
321  return (m_i64 == r.m_i64);
322  }
323 
324  inline bool contains(const bitset& r, bool all=true) const
325  {
326  return all ? ((m_i64 & r.m_i64) == r.m_i64) : ((m_i64 & r.m_i64) != 0);
327  }
328 
329 };
330 
331 /* Mark of ** that BizStation Corp internal use only.
332  */
333 template <int N> struct fielddef_t
334 {
335 protected:
336  char m_name[N];
337 
338 public:
339  uchar_td type; // type (zstring integer)
340  ushort_td len; // length
341  uchar_td decimals; // ** decimals
342  char viewNum; // ** An order of a list view column
343  ushort_td viewWidth; // ** view width pix
344  double max; // ** max value
345  double min; // ** min value
346 protected:
347  char m_defValue[DEFAULT_VALUE_SIZE];
348 public:
349  uchar_td lookTable; // ** reference table number
350  uchar_td lookField; // ** field number of reference table
351  uchar_td lookFields[3]; // ** View fields of reference bit567
352  ushort_td pos; // Field offset position from record image
353 protected:
354  uchar_td m_nullbit; // bit number for null indicator
355  uchar_td m_nullbytes; // byte of null indicator which head of record memory block.
356  char m_chainChar[2];
357 
358 public:
359 union
360 {
361  ushort_td ddfid; // ddf field id
362  ushort_td digits; // for ft_myDecimal
363 };
364  ushort_td filterId; // ** filter id for reference
365  uchar_td filterKeynum; // ** key number for reference
366  uchar_td nullValue; // null value for P.SQL
367  ushort_td userOption; // ** option
368  uchar_td lookDBNum; // ** database number of reference bitD
369 
370  /** The length of the mysql part key
371 
372  If this field is used by two or more keys, and both this length is used.
373  */
374  ushort_td keylen;
375 
376 protected:
377  uchar_td m_charsetIndex; // charctor set index of this field data
378  ushort_td m_schemaCodePage;
380  uchar_td m_options;
381 
382 public:
383  FLAGS enableFlags; // ** enable flags. see below
384 
385  inline void setSchemaCodePage(uint_td v) { m_schemaCodePage = (ushort_td)v; };
386 private:
387  friend class client::dbdef;
388  friend class client::fielddefs;
389  friend struct tabledef;
390 };
391 
392 /* This is only for BizStation Corp internal.
393  enableFlags
394  bit0 show list view
395  bit1 enable max value
396  bit2 enable min value
397  bit3 reserved. not use
398  bit4 enable lookTable
399  bit5 enable lookFields[0]
400  bit6 enable lookFields[1]
401  bit7 enable lookFields[2]
402  bit8 It append to a front column.
403  bit9 enable reference filter
404  bitA call field name rename function.
405  bitB disbale export this field data.
406  bitC not show list view but add select field list
407  bitD enable lookDBNum
408  bitE field value is changed
409  bitF defaultNull
410  */
411 
414 
415 #ifdef SWIG
417 #endif // SWIG
418 
419 struct PACKAGE fielddef : public fielddef_t_my
420 {
421 
422 #ifdef _UNICODE
423  const wchar_t* name() const; // Return a field name.
424  const wchar_t* name(wchar_t* buf) const; // Return a field name to bufffer .
425  const wchar_t* chainChar() const; // ** internal use only.
426  const wchar_t* defaultValue_str() const;
427  void setName(const wchar_t* s);
428  void setChainChar(const wchar_t* s); // ** internal use only.
429  void setDefaultValue(const wchar_t* s);
430 #else // NOT _UNICODE
431 
432 #ifdef MYSQL_DYNAMIC_PLUGIN
433 
434  //inline const char* name() const { return m_name; };
435 
436  //inline const char* chainChar() const { return m_chainChar; };
437 
438  //inline const char* defaultValue_str() const{return m_defValue; }
439 
440  inline void setName(const char* s)
441  {
442  strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
443  }
444 
445  inline void setChainChar(const char* s)
446  {
447  strncpy_s(m_chainChar, 2, s, sizeof(m_chainChar) - 1);
448  }
449 
450  inline void setDefaultValue(const char* s)
451  {
452  if (isBlob())
453  {
454  memset(m_defValue, 0, DEFAULT_VALUE_SIZE);
455  return;
456  }
457 
458  enableFlags.bitF = false;
459  __int64 i64 = 0;
460  switch(type)
461  {
462  case ft_time:
463  case ft_mytime:
464  {
465  myDateTime dt(7, true);
466  dt.setTime(s);
467  i64 = dt.getValue();
468  memcpy(m_defValue, &i64, 7);
469  return;
470  }
471  case ft_date:
472  case ft_mydate:
473  case ft_datetime:
474  case ft_mytimestamp:
475  case ft_mydatetime:
476  i64 = str_to_64<myDateTime, char>(7, true, s);
477  memcpy(m_defValue, &i64, 7);
478  return;
479  case ft_integer:
480  case ft_autoinc:
481  *((__int64*)m_defValue) = _atoi64(s);
482  return;
483  case ft_uinteger:
484  case ft_logical:
485  case ft_set:
486  case ft_bit:
487  case ft_enum:
488  case ft_autoIncUnsigned:
489  case ft_myyear:
490  *((unsigned __int64*)m_defValue) = strtoull(s, NULL, 10);
491  return;
492  }
493 
494  if (isNumericType())
495  {
496  *((double*)m_defValue) = atof(s);
497  return;
498  }
499  strncpy_s(m_defValue, 8, s, sizeof(m_defValue) - 1);
500  }
501 
502  inline void setDefaultValue(double v)
503  {
504  *((double*)m_defValue) = v;
505  }
506 
507  inline void setDefaultValue(__int64 v)
508  {
509  *((__int64*)m_defValue) = v;
510  }
511 
512 
513 #else // NOT MYSQL_DYNAMIC_PLUGIN
514  const char* name() const;
515  const char* name(char* buf) const;
516  const char* chainChar() const;
517  const char* defaultValue_str() const;
518  void setName(const char* s);
519  void setChainChar(const char* s);
520 #endif // NOT MYSQL_DYNAMIC_PLUGIN
521 #endif // NOT _UNICODE
522 
523  inline const char* nameA() const { return m_name; };
524 
525  inline void setNameA(const char* s)
526  {
527  strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
528  }
529 
530 #ifndef MYSQL_DYNAMIC_PLUGIN
531  void setDefaultValue(const char* s);
532 
533  void setDefaultValue(__int64 v);
534 
535  void setDefaultValue(double v);
536 
537  void setDefaultValue(const bitset& v)
538  {
539  setDefaultValue(v.internalValue());
540  }
541 
542  double defaultValue() const;
543 
544  __int64 defaultValue64() const;
545 
546  inline const _TCHAR* typeName() const { return getTypeName(type); };
547 
548  inline int align() const { return getTypeAlign(type); };
549 
550  inline void setLenByCharnum(ushort_td charnum)
551  {
552  len = lenByCharnum(type, m_charsetIndex, charnum);
553  }
554 
555  void setDecimalDigits(int dig, int dec);
556 #endif // MYSQL_DYNAMIC_PLUGIN
557 
558  inline unsigned int codePage() const
559  {
560  return mysql::codePage((unsigned short)m_charsetIndex);
561  }
562 
563  /* Is string type or not.
564  */
565  inline bool isStringType() const {return tdap::isStringType(type);}
566 
567  inline bool isPadCharType() const
568  {
569  return ((type == ft_mychar) || (type == ft_mywchar) ||
570  (type == ft_string) || (type == ft_wstring));
571  }
572 
573  inline bool isIntegerType() const
574  {
575  return ((type == ft_integer) || (type == ft_logical) || (type == ft_uinteger) ||
576  (type == ft_autoinc) || (type == ft_set) || (type == ft_bit) ||
577  (type == ft_enum) || (type == ft_autoIncUnsigned) || (type == ft_myyear));
578  }
579 
580  inline bool isNumericType() const
581  {
582  return ((type == ft_integer) || (type == ft_decimal) ||
583  (type == ft_money) || (type == ft_logical) || (type == ft_currency) ||
584  (type == ft_numeric) || (type == ft_bfloat) || (type == ft_float) ||
585  (type == ft_uinteger) || (type == ft_autoinc) || (type == ft_set) ||
586  (type == ft_bit) || (type == ft_enum) || (type == ft_numericsts) ||
587  (type == ft_numericsa) || (type == ft_autoIncUnsigned) ||
588  (type == ft_myyear) || (type == ft_mydecimal));
589  }
590 
591  inline bool isDateTimeType() const
592  {
593  return ((type == ft_date) || (type == ft_mydate) ||
594  (type == ft_time) || (type == ft_mytime) ||
595  (type == ft_datetime) || (type == ft_timestamp) ||
596  (type == ft_mydatetime) || (type == ft_mytimestamp));
597  }
598 
599  inline bool isNullKeysegType() const
600  {
601  return (nullValue == 0x00) && (len <= 8) &&
602  ((type == ft_logical) || (type == ft_integer) ||
603  (type == ft_uinteger) || (type == ft_enum)|| (type == ft_set));
604 
605  }
606 
607  /* Charctor numbers from charset.
608  */
609  unsigned int charNum() const;
610 
611  bool isValidCharNum() const;
612 
613  inline void setCharsetIndex(uchar_td index)
614  {
615  m_charsetIndex = index;
616  if ((type == ft_wstring) || (type == ft_wzstring) ||
617  (type == ft_mywvarchar) || (type == ft_mywvarbinary) ||
618  (type == ft_mywchar))
619  m_charsetIndex = CHARSET_UTF16LE;
620  }
621 
622  inline uchar_td charsetIndex() const { return m_charsetIndex; };
623 
624  inline bool isBlob() const
625  {
626  return (type == ft_myblob) || (type == ft_mytext) || (type == ft_mygeometry) || (type == ft_myjson);
627  }
628 
629  inline void setPadCharSettings(bool set, bool trim)
630  {
631  m_padCharOptions = 0;
632  m_padCharOptions |= PAD_CHAR_OPTION_SAVED;
633  if ((type == ft_mychar) || (type == ft_mywchar))
634  {
635  m_padCharOptions |= USE_PAD_CHAR;
636  if (trim)
637  m_padCharOptions |= TRIM_PAD_CHAR;
638  } // For compatibility with conventional.
639  else if ((type == ft_string) || (type == ft_wstring))
640  {
641  if (set)
642  m_padCharOptions |= USE_PAD_CHAR;
643  if (trim)
644  m_padCharOptions |= TRIM_PAD_CHAR;
645  }
646  }
647 
648  /* When ft_string or ft_wstring, fill by pad char at write. */
649  inline bool isUsePadChar() const {return (m_padCharOptions & USE_PAD_CHAR) == USE_PAD_CHAR;}
650 
651  /* When ft_string or ft_wstring or ft_mychar or ft_mywchar,
652  remove pad char at read.*/
653  inline bool isTrimPadChar() const {return (m_padCharOptions & TRIM_PAD_CHAR) == TRIM_PAD_CHAR;}
654 
655  inline bool isNullable() const {return (m_options & FIELD_OPTION_NULLABLE) == FIELD_OPTION_NULLABLE;}
656 
657  void setNullable(bool v, bool defaultNull = true)
658  {
659  if (v)
660  {
661  m_options |= FIELD_OPTION_NULLABLE;
662  enableFlags.bitF = defaultNull;
663  }
664  else
665  {
666  m_options &= ~FIELD_OPTION_NULLABLE;
667  enableFlags.bitF = false;
668  }
669  }
670 
671  void setTimeStampOnUpdate(bool v)
672  {
673  if (type == ft_mytimestamp || type == ft_mydatetime)
674  m_defValue[7] = v ? 1: 0;
675  }
676 
677  bool isTimeStampOnUpdate() const
678  {
679  if (type == ft_mytimestamp || type == ft_mydatetime)
680  return (m_defValue[7] == 1);
681  return false;
682  }
683 
684  inline bool isDefaultNull() const
685  {
686  return enableFlags.bitF;
687  }
688 
689  inline bool isLegacyTimeFormat() const
690  {
691  return (m_options & FIELD_OPTION_REGACY_TIME) != 0;
692  }
693 
694  inline uint_td blobLenBytes() const
695  {
696  if (isBlob())
697  return len - 8;
698  return 0;
699  }
700 
701  /* length bytes of var field
702  */
703  inline uint_td varLenBytes() const
704  {
705  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
706  type == ft_lstring)
707  return len < 256 ? 1 : 2;
708  else if (type == ft_lvar)
709  return 2;
710  return 0;
711  }
712 
713  bool operator==(const fielddef& r) const;
714 
715 private:
716  const char* defaultValue_strA(char* p, size_t size) const;
717  /* data length
718  */
719  inline uint_td dataLen(const uchar_td* ptr) const
720  {
721  int blen = varLenBytes();
722  if (blen == 0)
723  return len;
724  else if (blen == 1)
725  return *((unsigned char*)ptr);
726  return *((unsigned short*)ptr);
727  }
728 
729  inline uint_td blobDataLen(const uchar_td* ptr) const
730  {
731  int blen = blobLenBytes();
732  if (blen == 0)
733  return len;
734  uint_td v = 0;
735  memcpy(&v, ptr, blen);
736  return v;
737  }
738 
739  inline uint_td maxVarDatalen() const
740  {
741  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
742  type == ft_lstring)
743  return (len < 256) ? len - 1 : len - 2;
744  else if (type == ft_lvar)
745  return len - 4;
746  else if (isBlob())
747  {
748  switch (len - 8)
749  {
750  case 1:
751  return 0xFF;
752  case 2:
753  return 0xFFFF;
754  case 3:
755  return 0xFFFFFF;
756  case 4:
757  return 0xFFFFFFFF;
758  }
759  return 0;
760  }
761  return 0;
762  }
763 
764  /* data image for key
765  * param ptr address of record buffer
766  */
767  inline const uchar_td* keyData(const uchar_td* ptr) const
768  {
769  if (isBlob())
770  return blobDataPtr(ptr);
771  int sizeByte = varLenBytes();
772  return ptr + sizeByte;
773  }
774 
775  inline uint_td keyDataLen(const uchar_td* ptr) const
776  {
777  if (isBlob())
778  return blobDataLen(ptr);
779  return dataLen(ptr);
780  }
781 
782  /* Is variable key type
783  */
784  inline bool isKeyVarType() const
785  {
786  return (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) || isBlob());
787  }
788 
789  /* max key segment length. not include sizeBytes.
790  */
791  inline ushort_td maxKeylen() const { return keylen ? keylen : len; };
792 
793  /* copy key data for send to mysql and btrv
794  * return next copy address.
795  * If datalen==0xff then From is field formated (string) type.
796  * If datalen!=0xff then From is none field formated (string) type.
797  */
798  inline uchar_td* keyCopy(uchar_td* to, const uchar_td* from, ushort_td datalen,
799  bool isNull, bool transactd)
800  {
801  ushort_td keylen = maxKeylen(); // size of max key segmnet for mysql
802  ushort_td keyVarlen = varLenByteForKey(); // size of var sizeByte for record.
803  ushort_td copylen = std::min<ushort_td>(keylen, datalen);
804 
805  memset(to, 0x00, keylen + 1); //clear plus null byte
806  if (isNullable() && transactd)
807  {
808  // mysql only
809  if (isNull)
810  {
811  *to = 1;
812  return to + 1 + keylen - keyVarlen;
813  }else
814  ++to;
815  }
816  if(!isNull)
817  {
818  if (keyVarlen)
819  {
820  if (datalen==0xff)
821  copylen = (ushort_td)std::min<uint_td>((uint_td)copylen,
822  keyDataLen(from));
823  // Var size is allways 2byte for key.
824  memcpy(to, &copylen, 2);
825  to += 2;
826  if (datalen==0xff)
827  from = keyData(from);
828  }
829  memcpy(to, from, copylen);
830  }
831  return to + keylen - keyVarlen;// incremnt 2 + (store_len - varlen)
832  }
833 
834  inline const uchar_td* blobDataPtr(const uchar_td* ptr) const
835  {
836  int blen = blobLenBytes();
837  if (blen == 0)
838  return NULL;
839  const uchar_td** p = (const uchar_td**)(ptr + blen);
840  return *p;
841  }
842 
843  inline uint_td unPackCopy(uchar_td* dest, const uchar_td* src) const
844  {
845  int clen = varLenBytes();
846  if (clen == 0)
847  clen = len;
848  else if (clen == 1)
849  clen += *((unsigned char*)src);
850  else
851  clen += *((unsigned short*)src);
852  memcpy(dest, src, clen);
853  return clen;
854  }
855 
856  inline ushort_td varLenByteForKey() const
857  {
858  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
859  (type == ft_lstring))
860  return len < 256 ? 1 : 2;
861  else if (isBlob())
862  return len - 8;
863  return 0;
864  }
865 
866  /* Get keyValue from keybuf for seek mode error description
867  * return next copy key address.
868  */
869  inline const uchar_td* getKeyValueFromKeybuf(const uchar_td* from,
870  const uchar_td** data,
871  ushort_td& size)
872  {
873  ushort_td keyVarlen =
874  varLenByteForKey(); // size of var sizeByte for record.
875  if (keyVarlen)
876  {
877  size = *((ushort_td*)from);
878  *data = from + 2;
879  }
880  else
881  {
882  size = maxKeylen();
883  *data = from;
884  }
885  return *data + size;
886  }
887 
888  /* copy blob data for recordset
889 
890  @param blobBlock copy to adddres
891  @return new copy to address
892 
893  */
894  inline unsigned char* setBlobFieldPointer(uchar_td* dest, const blobHeader* hd,
895  unsigned char* blobBlock, int fieldNum) const
896  {
897  assert(hd->curRow < hd->rows);
898  const blobField* f = hd->nextField;
899  int sizeByte = blobLenBytes();
900  unsigned int size = f->size;
901  //Copy data size
902  memcpy(dest, &size, sizeByte);
903  //Copy data
904  if (size)
905  {
906  memcpy(blobBlock, f->data(), size);
907  //Copy data ptr
908  memcpy(dest + sizeByte, &blobBlock, sizeof(char*));
909  }else
910  memset(dest + sizeByte, 0, sizeof(char*));
911  hd->nextField = (blobField*)f->next();
912  if (fieldNum == hd->fieldCount - 1)
913  ++hd->curRow;
914  return blobBlock + size;
915  }
916 
917  inline void setPadCharDefaultSettings()
918  {
919  if (!isPadCharOptionSaved())
920  {
921  // For compatibility with conventional.
922  if ((type == ft_string) || (type == ft_wstring) ||
923  (type == ft_mychar) || (type == ft_mywchar))
924  {
925  m_padCharOptions |= USE_PAD_CHAR;
926  m_padCharOptions |= TRIM_PAD_CHAR;
927  }
928  }
929  else if ((type == ft_mychar) || (type == ft_mywchar))
930  m_padCharOptions |= USE_PAD_CHAR;
931  }
932 
933 
934  /* PadChar options are saved at schema.
935  This is for compatibility with conventional.*/
936  bool isPadCharOptionSaved() const
937  {
938  return (m_padCharOptions & PAD_CHAR_OPTION_SAVED) == PAD_CHAR_OPTION_SAVED;
939  }
940 #ifdef SP_SCOPE_FIELD_TEST
941 public:
942 #endif
943  inline uchar_td nullbit() const {return m_nullbit;} // bit number for null indicator
944  inline uchar_td nullbytes() const {return m_nullbytes;} // byte of null indicator which head of record memory block.
945  inline void setOptions(uchar_td v) {m_options = v;}
946 private:
947 
948  /** Length of compare
949  * if part of string or zstring then return strlen * sizeof(char or wchar).
950  */
951  inline uint_td compDataLen(const uchar_td* ptr, bool part) const
952  {
953  uint_td length = keyDataLen(ptr);
954  if (part)
955  {
956  if ((type == ft_string) || (type == ft_zstring) ||
957  (type == ft_note) || (type == ft_mychar))
958  length = (uint_td)strlen((const char*)ptr);
959  else if ((type == ft_wstring) || (type == ft_wzstring) ||
960  (type == ft_mywchar))
961  length = (uint_td)strlen16((char16_t*)ptr)*sizeof(char16_t);
962  }
963  return length;
964  }
965 
966  short synchronize(const fielddef* td);
967 
968  void fixCharnum_bug();
969 
970  friend class client::database;
971  friend class client::dbdef;
972  friend class client::field;
973  friend class client::fields;
974  friend class client::recordCache;
975  friend class client::fielddefs;
976  friend class client::memoryRecord;
977  friend class client::filter;
978  friend class client::table;
979  friend struct client::logic;
981  friend class client::sqlBuilder;
982  friend class mysql::schemaBuilder;
983  friend struct tabledef;
984 
985 /** @cond INTERNAL */
986  friend uint_td dataLen(const fielddef& fd, const uchar_td* ptr);
987  friend uint_td blobDataLen(const fielddef& fd, const uchar_td* ptr);
988  friend uint_td blobLenBytes(const fielddef& fd);
989 /** @endcond */
990 };
991 
992 /** @cond INTERNAL */
993 inline void updateTimeStampStr(const fielddef* fd, char* p, size_t size)
994 {
995  if (fd->isLegacyTimeFormat())
996  sprintf_s(p, 64, " ON UPDATE CURRENT_TIMESTAMP");
997  else
998  sprintf_s(p, 64, " ON UPDATE CURRENT_TIMESTAMP(%d)", fd->decimals);
999 }
1000 
1001 #ifdef _WIN32
1002 inline void updateTimeStampStr(const fielddef* fd, wchar_t* p, size_t size)
1003 {
1004  if (fd->isLegacyTimeFormat())
1005  swprintf_s(p, 64, L" ON UPDATE CURRENT_TIMESTAMP");
1006  else
1007  {
1008  int dec = (fd->type == ft_mytimestamp) ? (fd->len - 4) * 2 : (fd->len - 5) * 2;
1009  swprintf_s(p, 64, L" ON UPDATE CURRENT_TIMESTAMP(%d)",dec);
1010  }
1011 }
1012 #endif
1013 
1014 inline uint_td dataLen(const fielddef& fd, const uchar_td* ptr)
1015 {
1016  return fd.dataLen(ptr);
1017 }
1018 
1019 inline uint_td blobDataLen(const fielddef& fd, const uchar_td* ptr)
1020 {
1021  return fd.blobDataLen(ptr);
1022 }
1023 
1024 inline uint_td blobLenBytes(const fielddef& fd)
1025 {
1026  return fd.blobLenBytes();
1027 }
1028 
1029 inline _TCHAR* timeStampDefaultStr(const fielddef& fd, _TCHAR* buf, size_t bufsize)
1030 {
1031  if (fd.type == ft_mytimestamp || fd.type == ft_mydatetime)
1032  {
1033  buf[0] = 0x00;
1034  if (fd.isLegacyTimeFormat())
1035  _stprintf_s(buf, bufsize, _T("CURRENT_TIMESTAMP"));
1036  else
1037  _stprintf_s(buf, bufsize, _T("CURRENT_TIMESTAMP(%d)"), fd.decimals);
1038  }
1039  return buf;
1040 }
1041 
1042 
1043 /** @endcond */
1044 
1045 #define FORMAT_VERSON_BTRV_DEF 0
1046 #define FORMAT_VERSON_CURRENT 1
1047 
1048 
1049 /* Mark of ** that BizStation Corp internal use only.
1050  */
1051 struct PACKAGE tabledef
1052 {
1053  friend class client::dbdef; // for formatVersion
1054  friend class client::table; // for inUse
1055  friend class client::database; // for m_mysqlNullMode
1056  friend struct client::openTablePrams;
1057  friend struct client::dbdimple;
1058  friend class client::filter;
1059  friend class client::recordCache;
1060  friend class client::fielddefs;
1061  friend class client::sqlBuilder;
1062  friend class mysql::schemaBuilder;
1063 
1064 
1066  {
1067  cleanup();
1068  }
1069  void cleanup()
1070  {
1071  memset(this, 0, sizeof(tabledef));
1072  formatVersion = FORMAT_VERSON_CURRENT;
1073  m_utimeFieldNum = -1;
1074  primaryKeyNum = -1;
1075  parentKeyNum = -1;
1076  replicaKeyNum = -1;
1077  pageSize = 2048;
1078  schemaCodePage = 65001;//CP_UTF8
1079 
1080  // set temp server version
1081  m_useInMariadb = true;
1082  }
1083 
1084 #ifdef _UNICODE
1085  const wchar_t* fileName() const; // file name
1086  const wchar_t* tableName() const; // table name
1087  void setFileName(const wchar_t* s);
1088  void setTableName(const wchar_t* s);
1089  void convertToUtf8Schema();
1090 private:
1091  const char* toChar(char* buf, const wchar_t* s, int size) const;
1092 #else
1093 #ifdef MYSQL_DYNAMIC_PLUGIN
1094 
1095  const char* fileName() const { return m_fileName; };
1096 
1097  const char* tableName() const { return m_tableName; };
1098 
1099  inline void setFileName(const char* s) { setFileNameA(s); };
1100 
1101  inline void setTableName(const char* s) { setTableNameA(s); };
1102 private:
1103  inline const char* toChar(char* buf, const char* s, int size) const
1104  {
1105  strncpy_s(buf, size, s, size - 1);
1106  return buf;
1107  };
1108 #else
1109  const char* fileName() const;
1110  const char* tableName() const;
1111  void setFileName(const char* s);
1112  void setTableName(const char* s);
1113  void convertToUtf8Schema();
1114 private:
1115  const char* toChar(char* buf, const char* s, int size) const;
1116 #endif // MYSQL_DYNAMIC_PLUGIN
1117 #endif
1118 public:
1119  const char* fileNameA() const { return m_fileName; };
1120 
1121  const char* tableNameA() const { return m_tableName; };
1122 
1123  inline void setFileNameA(const char* s)
1124  {
1125  strncpy_s(m_fileName, FILE_NAME_SIZE, s, FILE_NAME_SIZE - 1);
1126  }
1127 
1128  inline void setTableNameA(const char* s)
1129  {
1130  strncpy_s(m_tableName, TABLE_NAME_SIZE, s, sizeof(m_tableName) - 1);
1131  }
1132 
1133  inline uchar_td nullfields() const { return m_nullfields;}
1134 
1135  inline uchar_td nullbytes() const { return m_nullbytes; }
1136 
1137  inline uchar_td inUse() const { return m_inUse; }
1138 
1139  int size() const;
1140  short fieldNumByName(const _TCHAR* name) const;
1141 
1142  inline ushort_td recordlen() const { return m_maxRecordLen; }
1143 
1144  uint_td unPack(char* ptr, size_t size) const;
1145 
1146  inline void setValidationTarget(bool isMariadb, uchar_td srvMinorVersion)
1147  {
1148  m_useInMariadb = isMariadb;
1149  m_srvMinorVer = srvMinorVersion;
1150  }
1151 
1152  inline bool isMysqlNullMode() const { return m_mysqlNullMode; }
1153 
1154  inline bool isLegacyTimeFormat(const fielddef& fd) const
1155  {
1156  if (fd.type == ft_mytime || fd.type == ft_mydatetime ||
1157  fd.type == ft_mytimestamp)
1158  {
1159  if (m_useInMariadb)
1160  {
1161  if (fd.decimals == 0 && (m_srvMinorVer == 5 || m_srvMinorVer == 0)) return true;
1162  }
1163  else
1164  {
1165  if (m_srvMinorVer < 6) return true;
1166  }
1167  }
1168  return false;
1169  }
1170  bool operator==(const tabledef& r) const;
1171 
1172 private:
1173  short synchronize(const tabledef* td);
1174  bool isNullKey(const keydef& key) const;
1175  uint_td pack(char* ptr, size_t size) const;
1176  short findKeynumByFieldNum(short fieldNum) const;
1177  inline ushort_td recordlenServer() const {return m_maxRecordLen;}
1178  bool isNeedNis(const keydef& key) const;
1179  bool isNULLFieldFirstKeySegField(const keydef& key) const;
1180  bool isNullValueZeroAll(const keydef& key) const;
1181  void setMysqlNullMode(bool v);
1182  void calcReclordlen(bool force= false);
1183  inline keydef* setKeydefsPtr()
1184  {
1185  return keyDefs = (keydef*)((char*)this + sizeof(tabledef) +
1186  (fieldCount * sizeof(fielddef)));
1187  }
1188 
1189  inline fielddef* setFielddefsPtr()
1190  {
1191  return fieldDefs = (fielddef*)((char*)this + sizeof(tabledef));
1192  }
1193 
1194  inline bool isMariaTimeFormat() const
1195  {
1196  return (m_useInMariadb && (m_srvMajorVer == 5 || m_srvMinorVer == 0));
1197  }
1198 
1199 public:
1200  ushort_td id; // table id
1201 
1202 #ifdef SWIG
1203  /* For swig interface
1204  export field names.
1205  */
1206  ushort_td pageSize; // page size
1207  ushort_td varSize; // second field length
1208 #else
1209 
1210  union
1211  {
1212  ushort_td pageSize; // page size
1213  ushort_td varSize; // second field length
1214  };
1215 #endif
1216 
1217  ushort_td preAlloc; // pre alloc page seize
1218  ushort_td fieldCount; // Number of field
1219  uchar_td keyCount; // Number of key
1220 
1221 private:
1222  char m_fileName[FILE_NAME_SIZE];
1223  char m_tableName[TABLE_NAME_SIZE];
1224 
1225 public:
1226  short version; // table version
1227  uchar_td charsetIndex; // SCHARSET_INFO vector index;
1228 private:
1229  uchar_td m_nullfields; // number of nullable field
1230  uchar_td m_nullbytes; // number of null indicator byte
1231  uchar_td m_inUse;
1232  bool m_mysqlNullMode ; // use in mysqlnull mode
1233  bool m_useInMariadb ; // use in mariadb
1234  uchar_td m_srvMajorVer; // server major version;
1235  uchar_td m_srvMinorVer; // server minor version;
1236  ushort_td m_utimeFieldNum; // uodate timestamp field number
1237  uchar_td m_filler0[8]; // reserved
1238 public:
1239  FLAGS flags; // file flags
1240  uchar_td primaryKeyNum; // Primary key number. -1 is no primary.
1241  uchar_td parentKeyNum; // ** Key number for listview. -1 is no use.
1242  uchar_td replicaKeyNum; // ** Key number for repdata. -1 is no use.
1243  FLAGS optionFlags; // ** optional flags
1244  ushort_td convertFileNum; // ** not use
1245 private:
1246  ushort_td m_maxRecordLen; // max record length of var size table.
1247 public:
1248  uchar_td treeIndex; // ** View index for listview.
1249  uchar_td iconIndex; // ** Icon index for listview.
1250  ushort_td ddfid;
1251  ushort_td fixedRecordLen; // Fixed record length for var size table.
1253  uchar_td iconIndex2;
1254  uchar_td iconIndex3;
1255  uint_td schemaCodePage; // Code page of this schema string data.
1256 
1257 private:
1258  char formatVersion;
1259  client::dbdef* parent;
1260  void* defaultImage;
1261  uchar_td reserved[TABLEDEF_FILLER_SIZE]; // reserved
1262 public:
1263  fielddef* fieldDefs; // Pointer cahche of first field.
1264  keydef* keyDefs; // Pointer cahche of first key.
1265 };
1266 
1267 // sizeof(fielddef) * 255 + sizeof(keydef) * 64 + sizeof(tabledef)
1268 // (124 * 255) + (26 * 64) + 388 = 31620 + 1664 + 388 = 33672
1269 #define MAX_SCHEMASIZE 33672
1270 
1271 /* optionFlags BizStation internal use only.
1272  Bit0 send windows messege.
1273  Bit1 show tree view.
1274  Bit2 is master table or not
1275  Bit3 is replicate or not
1276  Bit4 is backup target or not.
1277  Bit5 is encript or not
1278  Bit6 is this table destination of convert .
1279  Bit7 is support short cut in listveiw.
1280  Bit8 is call validate function at delete record.
1281  Bit9 Can export this table.
1282  BitA is this table include valiable fields (varchar or varbinary is used)
1283  BitB is this table include blob field (Blob is used)
1284  BitC is this table include fixedbinary
1285  */
1286 
1287 struct PACKAGE btrVersion
1288 {
1289  ushort_td majorVersion;
1290  ushort_td minorVersion;
1291  unsigned char type;
1292 
1293  const _TCHAR* moduleVersionShortString(_TCHAR* buf);
1294  const _TCHAR* moduleTypeString();
1295 
1296  inline bool isSupportDateTimeTimeStamp() const
1297  {
1298  if (majorVersion >= 10) return true;
1299  if ((majorVersion == 5) && (minorVersion > 5)) return true;
1300  return false;
1301  }
1302 
1303  inline bool isSupportMultiTimeStamp() const
1304  {
1305  return isSupportDateTimeTimeStamp();
1306  }
1307 
1308  inline bool isMariaDB() const { return type == MYSQL_TYPE_MARIA; }
1309 
1310  inline bool isMysql56TimeFormat() const
1311  {
1312  if ((majorVersion == 10) && (minorVersion >= 1)) return true;
1313  if ((majorVersion == 5) && (minorVersion >= 6)) return true;
1314  return false;
1315  }
1316 
1317  inline bool isFullLegacyTimeFormat() const
1318  {
1319  return !isMariaDB() && (minorVersion < 6);
1320  }
1321 
1322 };
1323 
1325 {
1326  btrVersion versions[4];
1327 };
1328 
1329 #define VER_IDX_CLINET 0
1330 #define VER_IDX_DB_SERVER 1
1331 #define VER_IDX_PLUGIN 2
1332 
1333 
1334 
1335 
1336 #pragma pack(pop)
1337 pragma_pop;
1338 
1339 
1340 PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR* cmpstr);
1341 
1342 } // namespace tdap
1343 } // namespace protocol
1344 } // namespace db
1345 } // namespace bzs
1346 
1347 #endif // BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
ushort_td preAlloc
Definition: tdapSchema.h:150
uchar_td iconIndex
Definition: tdapSchema.h:1249
bool isMysql56TimeFormat() const
Definition: tdapSchema.h:1310
uchar_td replicaKeyNum
Definition: tdapSchema.h:1242
ushort_td filterId
Definition: tdapSchema.h:364
void setFileNameA(const char *s)
Definition: tdapSchema.h:1123
bool isBlob() const
Definition: tdapSchema.h:624
ushort_td keylen
Definition: tdapSchema.h:374
uchar_td inUse() const
Definition: tdapSchema.h:1137
ushort_td minorVersion
Definition: tdapSchema.h:1290
ushort_td fixedRecordLen
Definition: tdapSchema.h:1251
uchar_td lookTable
Definition: tdapSchema.h:349
フィールド定義構造体
Definition: tdapSchema.h:333
ushort_td ddfid
Definition: tdapSchema.h:361
bool isDefaultNull() const
Definition: tdapSchema.h:684
ushort_td len
Definition: tdapSchema.h:340
サーバーおよびクライアントモジュールのバージョン構造体
Definition: tdapSchema.h:1287
int autoIncExSpace
Definition: tdapSchema.h:1252
FLAGS fileFlag
Definition: tdapSchema.h:148
void setPadCharSettings(bool set, bool trim)
Definition: tdapSchema.h:629
uchar_td parentKeyNum
Definition: tdapSchema.h:1241
bool isLegacyTimeFormat() const
Definition: tdapSchema.h:689
unsigned short bitC
Definition: tdapSchema.h:117
pragma_pop
Definition: btrDate.h:107
uchar_td decimals
Definition: tdapSchema.h:341
bool isNullKeysegType() const
Definition: tdapSchema.h:599
ushort_td viewWidth
Definition: tdapSchema.h:343
unsigned short bitB
Definition: tdapSchema.h:116
ushort_td recLen
Definition: tdapSchema.h:144
void setTimeStampOnUpdate(bool v)
Definition: tdapSchema.h:671
ushort_td varSize
Definition: tdapSchema.h:1213
uchar_td m_charsetIndex
Definition: tdapSchema.h:377
uchar_td reserve1[2]
Definition: tdapSchema.h:149
char m_name[N]
Definition: tdapSchema.h:336
uchar_td reserve2[2]
Definition: tdapSchema.h:135
uint_td varLenBytes() const
Definition: tdapSchema.h:703
bool isLegacyTimeFormat(const fielddef &fd) const
Definition: tdapSchema.h:1154
unsigned int codePage() const
Definition: tdapSchema.h:558
bool isIntegerType() const
Definition: tdapSchema.h:573
bool isStringType(uchar_td type)
Definition: tdapSchema.h:262
ushort_td preAlloc
Definition: tdapSchema.h:1217
const char * nameA() const
Definition: tdapSchema.h:523
uchar_td acsNo
Definition: tdapSchema.h:137
keydef * keyDefs
Definition: tdapSchema.h:1264
uchar_td iconIndex3
Definition: tdapSchema.h:1254
bool isUsePadChar() const
Definition: tdapSchema.h:649
ushort_td id
Definition: tdapSchema.h:1200
void setSchemaCodePage(uint_td v)
Definition: tdapSchema.h:385
キーセグメント定義構造体
Definition: tdapSchema.h:156
const char * fileNameA() const
Definition: tdapSchema.h:1119
PACKAGE const _TCHAR * getTypeName(short type)
void setNameA(const char *s)
Definition: tdapSchema.h:525
フィールド定義構造体
Definition: tdapSchema.h:419
bool operator==(const bitset &r) const
Definition: tdapSchema.h:319
ビットフィールド共用体
Definition: tdapSchema.h:99
fielddef_t< MYSQL_FDNAME_SIZE > fielddef_t_my
Definition: tdapSchema.h:412
unsigned short all
Definition: tdapSchema.h:101
bool isTimeStampOnUpdate() const
Definition: tdapSchema.h:677
フィールドコレクションクラス
Definition: fields.h:256
bool isNullable() const
Definition: tdapSchema.h:655
bool isMysqlNullMode() const
Definition: tdapSchema.h:1152
char m_chainChar[2]
Definition: tdapSchema.h:356
bool operator==(const keydef &r) const
Definition: tdapSchema.h:184
uint_td keyCount
Definition: tdapSchema.h:132
__int64 internalValue() const
Definition: tdapSchema.h:315
バージョン配列構造体
Definition: tdapSchema.h:1324
FLAGS enableFlags
Definition: tdapSchema.h:383
bitset(__int64 v)
Definition: tdapSchema.h:301
PACKAGE ushort_td lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum)
uchar_td nullbytes() const
Definition: tdapSchema.h:1135
uchar_td treeIndex
Definition: tdapSchema.h:1248
const char * tableNameA() const
Definition: tdapSchema.h:1121
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
テーブルアクセスクラス (nocopyable)
Definition: table.h:91
unsigned short bit8
Definition: tdapSchema.h:113
uchar_td keyCount
Definition: tdapSchema.h:1219
ushort_td majorVersion
Definition: tdapSchema.h:1289
ushort_td userOption
Definition: tdapSchema.h:367
bool isFullLegacyTimeFormat() const
Definition: tdapSchema.h:1317
unsigned short bit7
Definition: tdapSchema.h:112
bitset()
Definition: tdapSchema.h:299
uint_td schemaCodePage
Definition: tdapSchema.h:1255
FLAGS keyFlag
Definition: tdapSchema.h:131
char m_defValue[DEFAULT_VALUE_SIZE]
Definition: tdapSchema.h:347
uchar_td m_padCharOptions
Definition: tdapSchema.h:379
FLAGS flags
Definition: tdapSchema.h:159
fielddef のコレクションクラス
Definition: field.h:74
bool isMariaDB() const
Definition: tdapSchema.h:1308
uchar_td type
Definition: tdapSchema.h:339
bool operator[](int index) const
Definition: tdapSchema.h:317
uchar_td charsetIndex() const
Definition: tdapSchema.h:622
キー定義構造体
Definition: tdapSchema.h:178
uint_td recCount
Definition: tdapSchema.h:147
uchar_td keyType
Definition: tdapSchema.h:133
uchar_td nullValue
Definition: tdapSchema.h:134
unsigned short bitE
Definition: tdapSchema.h:119
double min
Definition: tdapSchema.h:345
ushort_td fieldCount
Definition: tdapSchema.h:1218
uint_td blobLenBytes() const
Definition: tdapSchema.h:694
FLAGS optionFlags
Definition: tdapSchema.h:1243
FLAGS flags
Definition: tdapSchema.h:1239
create tableで使用するキーセグメント定義構造体
Definition: tdapSchema.h:127
uchar_td lookFields[3]
Definition: tdapSchema.h:351
tabledef()
Definition: tdapSchema.h:1065
ushort_td ddfid
Definition: tdapSchema.h:1250
recordset フィルタリングクエリー
Definition: groupQuery.h:107
ushort_td pos
Definition: tdapSchema.h:352
unsigned short bitD
Definition: tdapSchema.h:118
bool isPadCharType() const
Definition: tdapSchema.h:567
void setDefaultValue(const bitset &v)
Definition: tdapSchema.h:537
uchar_td nullfields() const
Definition: tdapSchema.h:1133
keySegment segments[MAX_KEY_SEGMENT]
Definition: tdapSchema.h:181
void setValidationTarget(bool isMariadb, uchar_td srvMinorVersion)
Definition: tdapSchema.h:1146
bool isDateTimeType() const
Definition: tdapSchema.h:591
unsigned short bitF
Definition: tdapSchema.h:120
bool contains(const bitset &r, bool all=true) const
Definition: tdapSchema.h:324
unsigned short bitA
Definition: tdapSchema.h:115
short version
Definition: tdapSchema.h:1226
unsigned short bit9
Definition: tdapSchema.h:114
uchar_td fieldNum
Definition: tdapSchema.h:158
ushort_td pageSize
Definition: tdapSchema.h:1212
void setNullable(bool v, bool defaultNull=true)
Definition: tdapSchema.h:657
ushort_td keyPos
Definition: tdapSchema.h:129
uchar_td keyNumber
Definition: tdapSchema.h:182
uchar_td m_nullbit
Definition: tdapSchema.h:354
uchar_td iconIndex2
Definition: tdapSchema.h:1253
ushort_td keyLen
Definition: tdapSchema.h:130
uchar_td primaryKeyNum
Definition: tdapSchema.h:1240
uchar_td segmentCount
Definition: tdapSchema.h:180
void setLenByCharnum(ushort_td charnum)
Definition: tdapSchema.h:550
pragma_pack1
Definition: btrDate.h:36
void set(int index, bool value)
Definition: tdapSchema.h:303
bool isNumericType() const
Definition: tdapSchema.h:580
unsigned short bit1
Definition: tdapSchema.h:106
ushort_td digits
Definition: tdapSchema.h:362
fielddef_t< PERVASIVE_FDNAME_SIZE > fielddef_t_pv
Definition: tdapSchema.h:413
unsigned short bit3
Definition: tdapSchema.h:108
unsigned short bit5
Definition: tdapSchema.h:110
friend struct tabledef
Definition: tdapSchema.h:983
unsigned short bit6
Definition: tdapSchema.h:111
データベースアクセスクラス
Definition: database.h:59
void setCharsetIndex(uchar_td index)
Definition: tdapSchema.h:613
uchar_td filterKeynum
Definition: tdapSchema.h:365
uchar_td lookDBNum
Definition: tdapSchema.h:368
uchar_td lookField
Definition: tdapSchema.h:350
uchar_td nullValue
Definition: tdapSchema.h:366
uchar_td m_nullbytes
Definition: tdapSchema.h:355
unsigned short bit0
Definition: tdapSchema.h:105
fielddef * fieldDefs
Definition: tdapSchema.h:1263
bool isSupportMultiTimeStamp() const
Definition: tdapSchema.h:1303
unsigned short bit2
Definition: tdapSchema.h:107
ビット集合アクセスクラス
Definition: tdapSchema.h:294
bool isTrimPadChar() const
Definition: tdapSchema.h:653
ushort_td convertFileNum
Definition: tdapSchema.h:1244
void cleanup()
Definition: tdapSchema.h:1069
int align() const
Definition: tdapSchema.h:548
ushort_td recordlen() const
Definition: tdapSchema.h:1142
char viewNum
Definition: tdapSchema.h:342
ushort_td m_schemaCodePage
Definition: tdapSchema.h:378
PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR *cmpstr)
bool isStringTypeForIndex(uchar_td type)
Definition: tdapSchema.h:243
bool isSupportDateTimeTimeStamp() const
Definition: tdapSchema.h:1296
unsigned char type
Definition: tdapSchema.h:1291
PACKAGE int getTypeAlign(short type)
uchar_td charsetIndex
Definition: tdapSchema.h:1227
uchar_td keyNo
Definition: tdapSchema.h:136
rowの実装クラス
Definition: memRecord.h:69
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:142
テーブル定義構造体
Definition: tdapSchema.h:1051
keySpec keySpecs[1]
Definition: tdapSchema.h:151
ushort_td pageSize
Definition: tdapSchema.h:145
double max
Definition: tdapSchema.h:344
uchar_td m_options
Definition: tdapSchema.h:380
フィールドアクセスクラス
Definition: field.h:118
const _TCHAR * typeName() const
Definition: tdapSchema.h:546
unsigned short bit4
Definition: tdapSchema.h:109
ushort_td indexCount
Definition: tdapSchema.h:146
void setTableNameA(const char *s)
Definition: tdapSchema.h:1128
bool isStringType() const
Definition: tdapSchema.h:565

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