全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド ページ
tdapSchema.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
2 #define BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
3 /* =================================================================
4  Copyright (C) 2000-2013 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 <bzs/env/compiler.h>
27 #include <bzs/env/crosscompile.h>
28 #include <bzs/db/protocol/tdap/mysql/characterset.h>
29 #include <bzs/db/blobStructs.h>
30 #include <assert.h>
31 
32 namespace bzs
33 {
34 namespace db
35 {
36 namespace protocol
37 {
38 namespace tdap
39 {
40 
41 namespace client
42 {
43 class dbdef;
44 }
45 
46 #pragma pack(push, 1)
48 
49 using std::min;
50 using std::max;
51 
52 #ifdef SWIG
53 
54 /* For swig interface
55  Export names .
56  */
57 union FLAGS
58 {
59  unsigned short all;
60 
61  unsigned short bit0 : 1;
62  unsigned short bit1 : 1;
63  unsigned short bit2 : 1;
64  unsigned short bit3 : 1;
65  unsigned short bit4 : 1;
66  unsigned short bit5 : 1;
67  unsigned short bit6 : 1;
68  unsigned short bit7 : 1;
69  unsigned short bit8 : 1;
70  unsigned short bit9 : 1;
71  unsigned short bitA : 1;
72  unsigned short bitB : 1;
73  unsigned short bitC : 1;
74  unsigned short bitD : 1;
75  unsigned short bitE : 1;
76  unsigned short bitF : 1;
77 };
78 #else // NOT SWIG
79 
80 union FLAGS
81 {
82  unsigned short all;
83 
84  struct
85  {
86  unsigned short bit0 : 1;
87  unsigned short bit1 : 1;
88  unsigned short bit2 : 1;
89  unsigned short bit3 : 1;
90  unsigned short bit4 : 1;
91  unsigned short bit5 : 1;
92  unsigned short bit6 : 1;
93  unsigned short bit7 : 1;
94  unsigned short bit8 : 1;
95  unsigned short bit9 : 1;
96  unsigned short bitA : 1;
97  unsigned short bitB : 1;
98  unsigned short bitC : 1;
99  unsigned short bitD : 1;
100  unsigned short bitE : 1;
101  unsigned short bitF : 1;
102  };
103 };
104 #endif // NOT SWIG
105 
106 /* brief Key infomation for create table operation
107  */
108 struct keySpec
109 {
110  ushort_td keyPos; /* key position */
111  ushort_td keyLen; /* key length */
112  FLAGS keyFlag; /* key flag */
113  uint_td keyCount; /* key count */
114  uchar_td keyType; /* key type of extended */
115  uchar_td nullValue; /* value of null */
116  uchar_td reserve2[2]; /* reserved */
117  uchar_td keyNo; /* fixed key number */
118  uchar_td acsNo; /* no acs */
119 }; /* total 16 byte */
120 
121 /* brief File infomation for create table operation
122  */
123 struct fileSpec
124 {
125  ushort_td recLen; /* record length */
126  ushort_td pageSize; /* page sise */
127  ushort_td indexCount; /* index count */
128  uint_td recCount; /* record count for stat */
129  FLAGS fileFlag; /* file flags */
130  uchar_td reserve1[2]; /* reserved */
131  ushort_td preAlloc; /* page allocation count */
132  keySpec keySpecs[1]; /* key specs */
133 }; /* total ? byte */
134 
135 /* brief A key segment infomation
136  */
138 {
139  uchar_td fieldNum; // Refarence field buymber
140  FLAGS flags; // key flags. 11 to 15bit is not use.
141 };
142 
143 /* brief A key infomation
144  */
145 #define MAX_KEY_SEGMENT 8
146 
147 struct keydef
148 {
149  uchar_td segmentCount; // Number of segment
150  keySegment segments[MAX_KEY_SEGMENT]; // key segments . max 8 segments
151  uchar_td keyNumber; // key number
152 };
153 
154 static const int MYSQL_FDNAME_SIZE = 64;
155 static const int MYSQL_TBNAME_SIZE = 64;
156 static const int PERVASIVE_FDNAME_SIZE = 20;
157 static const int FIELD_NAME_SIZE = MYSQL_FDNAME_SIZE;
158 static const int TABLE_NAME_SIZE = 32;
159 static const int FILE_NAME_SIZE = 266;
160 
161 #if (defined(__x86_32__) || __APPLE_32__)
162 static const int TABLEDEF_FILLER_SIZE = 21; // 25-4;
163 #else
164 static const int TABLEDEF_FILLER_SIZE = 9; // 17-8;
165 #endif
166 
167 #ifndef MYSQL_DYNAMIC_PLUGIN
168 
169 /* A field type name that specified by a type is returned.
170  */
171 PACKAGE const _TCHAR* getTypeName(short type);
172 
173 /* A field alignment that specified by a type is returned.
174  */
175 PACKAGE int getTypeAlign(short type);
176 
177 /* calcurate byts of char type by charctor number.
178  */
179 PACKAGE ushort_td
180  lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum);
181 
182 #endif // MYSQL_DYNAMIC_PLUGIN
183 
184 /* Is field type string ? */
185 inline bool isStringTypeForIndex(uchar_td type)
186 {
187  switch (type)
188  {
189  case ft_string:
190  case ft_zstring:
191  case ft_wstring:
192  case ft_wzstring:
193  case ft_mychar:
194  case ft_mywchar:
195  case ft_myvarchar:
196  case ft_myvarbinary:
197  case ft_mywvarchar:
198  case ft_mywvarbinary:
199  return true;
200  }
201  return false;
202 }
203 
204 inline bool isStringType(uchar_td type)
205 {
206  switch (type)
207  {
208  case ft_myblob:
209  case ft_mytext:
210  case ft_lstring:
211  case ft_note:
212  return true;
213  }
214  return isStringTypeForIndex(type);
215 }
216 
217 /** @cond INTERNAL */
218 #define PAD_CHAR_OPTION_SAVED 1
219 #define USE_PAD_CHAR 2
220 #define TRIM_PAD_CHAR 4
221 /** @endcond */
222 
223 /* Mark of ** that BizStation Corp internal use only.
224  */
225 template <int N> struct fielddef_t
226 {
227 protected:
228  char m_name[N];
229 
230 public:
231  uchar_td type; // type (zstring integer)
232  ushort_td len; // length
233  uchar_td decimals; // ** decimals
234  char viewNum; // ** An order of a list view column
235  ushort_td viewWidth; // ** view width pix
236  double max; // ** max value
237  double min; // ** min value
238  double defValue; // ** default value
239  uchar_td lookTable; // ** reference table number
240  uchar_td lookField; // ** field number of reference table
241  uchar_td lookFields[3]; // ** View fields of reference bit567
242  ushort_td pos; // Field offset position from record image
243  ushort_td defViewWidth; // ** default view wifth
244 
245 protected:
246  char m_chainChar[2];
247 
248 public:
249  ushort_td ddfid; // ddf field id
250  ushort_td filterId; // ** filter id for reference
251  uchar_td filterKeynum; // ** key number for reference
252  uchar_td nullValue; // null value
253  ushort_td userOption; // ** option
254  uchar_td lookDBNum; // ** database number of reference bitD
255 
256  /** The length of the mysql part key
257 
258  If this field is used by two or more keys, and both this length is used.
259  */
260  ushort_td keylen;
261 
262 protected:
263  uchar_td m_charsetIndex; // charctor set index of this field data
264  ushort_td m_schemaCodePage;
265  ushort_td m_padCharOptions;
266 public:
267  FLAGS enableFlags; // ** enable flags. see below
268 
269 private:
270  inline void setSchemaCodePage(uint_td v) { m_schemaCodePage = (ushort_td)v; };
271  friend class client::dbdef;
272 };
273 
274 /* This is only for BizStation Corp internal.
275  enableFlags
276  bit0 show list view
277  bit1 enable max value
278  bit2 enable min value
279  bit3 enable default value
280  bit4 enable lookTable
281  bit5 enable lookFields[0]
282  bit6 enable lookFields[1]
283  bit7 enable lookFields[2]
284  bit8 It append to a front column.
285  bit9 enable reference filter
286  bitA call field name rename function.
287  bitB disbale export this field data.
288  bitC not show list view but add select field list
289  bitD enable lookDBNum
290  bitE field value is changed
291  */
292 
295 
296 #ifdef SWIG
298 #endif // SWIG
299 
300 struct PACKAGE fielddef : public fielddef_t_my
301 {
302 #ifdef _UNICODE
303  const wchar_t* name() const; // Return a field name.
304  const wchar_t* name(wchar_t* buf) const; // Return a field name to bufffer .
305  const wchar_t* chainChar() const; // ** internal use only.
306  void setName(const wchar_t* s);
307  void setChainChar(const wchar_t* s); // ** internal use only.
308 #else // NOT _UNICODE
309 
310 #ifdef MYSQL_DYNAMIC_PLUGIN
311 
312  inline const char* name() const { return m_name; };
313 
314  inline const char* chainChar() const { return m_chainChar; };
315 
316  inline void setName(const char* s)
317  {
318  strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
319  };
320 
321  inline void setChainChar(const char* s)
322  {
323  strncpy_s(m_chainChar, 2, s, sizeof(m_chainChar) - 1);
324  };
325 
326 #else // NOT MYSQL_DYNAMIC_PLUGIN
327  const char* name() const;
328  const char* name(char* buf) const;
329  const char* chainChar() const;
330  void setName(const char* s);
331  void setChainChar(const char* s);
332 #endif // NOT MYSQL_DYNAMIC_PLUGIN
333 #endif // NOT _UNICODE
334 
335  inline const char* nameA() const { return m_name; };
336 
337  inline void setNameA(const char* s)
338  {
339  strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
340  };
341 #ifndef MYSQL_DYNAMIC_PLUGIN
342 
343  inline const _TCHAR* typeName() const { return getTypeName(type); };
344 
345  inline int align() const { return getTypeAlign(type); };
346 
347  inline void setLenByCharnum(ushort_td charnum)
348  {
349  len = lenByCharnum(type, m_charsetIndex, charnum);
350  }
351 
352 #endif // MYSQL_DYNAMIC_PLUGIN
353 
354 private:
355  /* Is variable key type
356  */
357  inline bool isKeyVarType() const
358  {
359  return (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
360  (type == ft_myblob) || (type == ft_mytext));
361  }
362 
363  /* max key segment length. not include sizeBytes.
364  */
365  inline ushort_td maxKeylen() const { return keylen ? keylen : len; };
366 
367 public:
368  inline unsigned int codePage() const
369  {
370  return mysql::codePage((unsigned short)m_charsetIndex);
371  }
372 
373  /* Is string type or not.
374  */
375  bool isStringType() const;
376 
377  inline bool isNumericType() const
378  {
379  return ((type == ft_integer) || (type == ft_decimal) ||
380  (type == ft_money) || (type == ft_logical) ||
381  (type == ft_numeric) || (type == ft_bfloat) ||
382  (type == ft_uinteger) || (type == ft_autoinc) ||
383  (type == ft_bit) || (type == ft_numericsts) ||
384  (type == ft_numericsa) || (type == ft_autoIncUnsigned));
385  }
386 
387  /* Charctor numbers from charset.
388  */
389  unsigned int charNum() const;
390 
391  inline void setCharsetIndex(uchar_td index)
392  {
393  m_charsetIndex = index;
394  if ((type == ft_wstring) || (type == ft_wzstring) ||
395  (type == ft_mywvarchar) || (type == ft_mywvarbinary) ||
396  (type == ft_mywchar))
397  m_charsetIndex = CHARSET_UTF16LE;
398  }
399 
400  inline uchar_td charsetIndex() const { return m_charsetIndex; };
401 
402  /* length bytes of var field
403  */
404  inline int varLenBytes() const
405  {
406  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
407  type == ft_lstring)
408  return len < 256 ? 1 : 2;
409  else if (type == ft_lvar)
410  return 2;
411  return 0;
412  }
413 
414  inline uint_td blobLenBytes() const
415  {
416  if ((type == ft_myblob) || (type == ft_mytext))
417  return len - 8;
418  return 0;
419  }
420 
421  inline bool isBlob() const
422  {
423  return (type == ft_myblob) || (type == ft_mytext);
424  }
425 
426  inline int maxVarDatalen() const
427  {
428  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
429  type == ft_lstring)
430  return (len < 256) ? len - 1 : len - 2;
431  else if (type == ft_lvar)
432  return len - 4;
433  else if ((type == ft_myblob) || (type == ft_mytext))
434  {
435  switch (len - 8)
436  {
437  case 1:
438  return 0xFF;
439  case 2:
440  return 0xFFFF;
441  case 3:
442  return 0xFFFFFF;
443  case 4:
444  return 0xFFFFFFFF;
445  }
446  return 0;
447  }
448  return 0;
449  }
450 
451  /* data length
452  */
453  inline uint_td dataLen(const uchar_td* ptr) const
454  {
455  int blen = varLenBytes();
456  if (blen == 0)
457  return len;
458  else if (blen == 1)
459  return *((unsigned char*)ptr);
460  return *((unsigned short*)ptr);
461  }
462 
463  inline uint_td blobDataLen(const uchar_td* ptr) const
464  {
465  int blen = blobLenBytes();
466  if (blen == 0)
467  return len;
468  uint_td v = 0;
469  memcpy(&v, ptr, blen);
470  return v;
471  }
472 
473  /* data image for key
474  * param ptr address of record buffer
475  */
476  inline const uchar_td* keyData(const uchar_td* ptr) const
477  {
478  if ((type == ft_myblob) || (type == ft_mytext))
479  return blobDataPtr(ptr);
480  int sizeByte = varLenBytes();
481  return ptr + sizeByte;
482  }
483 
484  inline uint_td keyDataLen(const uchar_td* ptr) const
485  {
486  if ((type == ft_myblob) || (type == ft_mytext))
487  return blobDataLen(ptr);
488  return dataLen(ptr);
489  }
490 
491  inline void setPadCharSettings(bool set, bool trim)
492  {
493  m_padCharOptions = 0;
494  m_padCharOptions |= PAD_CHAR_OPTION_SAVED;
495  if ((type == ft_mychar) || (type == ft_mywchar))
496  {
497  m_padCharOptions |= USE_PAD_CHAR;
498  if (trim)
499  m_padCharOptions |= TRIM_PAD_CHAR;
500  } // For compatibility with conventional.
501  else if ((type == ft_string) || (type == ft_wstring))
502  {
503  if (set)
504  m_padCharOptions |= USE_PAD_CHAR;
505  if (trim)
506  m_padCharOptions |= TRIM_PAD_CHAR;
507  }
508  }
509 
510  /* When ft_string or ft_wstring, fill by pad char at write. */
511  bool usePadChar() const {return (m_padCharOptions & USE_PAD_CHAR) == USE_PAD_CHAR;}
512 
513  /* When ft_string or ft_wstring or ft_mychar or ft_mywchar,
514  remove pad char at read.*/
515  bool trimPadChar() const {return (m_padCharOptions & TRIM_PAD_CHAR) == TRIM_PAD_CHAR;}
516 
517 
518 /** @cond INTERNAL */
519  /* copy key data for send to mysql
520  * return next copy address.
521  * If datalen==0xff then From is field formated (string) type.
522  * If datalen!=0xff then From is none field formated (string) type.
523  */
524  inline uchar_td* keyCopy(uchar_td* to, const uchar_td* from, ushort_td datalen=0xff)
525  {
526 
527  ushort_td kl = maxKeylen(); // size of max key segmnet for mysql
528  memset(to, 0x00, kl);
529  ushort_td keyVarlen =
530  varLenByteForKey(); // size of var sizeByte for record.
531  ushort_td copylen = std::min<ushort_td>(kl, datalen);
532  if (keyVarlen)
533  {
534  if (datalen==0xff)
535  copylen = (ushort_td)std::min<uint_td>((uint_td)copylen,
536  keyDataLen(from));
537  // Var size is allways 2byte for key.
538  memcpy(to, &copylen, 2);
539  to += 2;
540  if (datalen==0xff)
541  from = keyData(from);
542  }
543  memcpy(to, from, copylen);
544  return to + kl - keyVarlen;// incremnt 2 + (store_len - varlen)
545  }
546 
547 
548  inline const uchar_td* blobDataPtr(const uchar_td* ptr) const
549  {
550  int blen = blobLenBytes();
551  if (blen == 0)
552  return NULL;
553  const uchar_td** p = (const uchar_td**)(ptr + blen);
554  return *p;
555  }
556 
557  inline uint_td unPackCopy(uchar_td* dest, const uchar_td* src) const
558  {
559  int clen = varLenBytes();
560  if (clen == 0)
561  clen = len;
562  else if (clen == 1)
563  clen += *((unsigned char*)src);
564  else
565  clen += *((unsigned short*)src);
566  memcpy(dest, src, clen);
567  return clen;
568  }
569 
570  inline ushort_td varLenByteForKey() const
571  {
572  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
573  (type == ft_lstring))
574  return len < 256 ? 1 : 2;
575  else if ((type == ft_myblob) || (type == ft_mytext))
576  return len - 8;
577  return 0;
578  }
579 
580  /* Get keyValue from keybuf for seek mode error description
581  * return next copy key address.
582  */
583  inline const uchar_td* getKeyValueFromKeybuf(const uchar_td* from,
584  const uchar_td** data,
585  ushort_td& size)
586  {
587  ushort_td keyVarlen =
588  varLenByteForKey(); // size of var sizeByte for record.
589  if (keyVarlen)
590  {
591  size = *((ushort_td*)from);
592  *data = from + 2;
593  }
594  else
595  {
596  size = maxKeylen();
597  *data = from;
598  }
599  return *data + size;
600  }
601 
602  /* copy blob data for recordset
603 
604  @param blobBlock copy to adddres
605  @return new copy to address
606 
607  */
608  inline unsigned char* setBlobFieldPointer(uchar_td* dest, const blobHeader* hd,
609  unsigned char* blobBlock, int fieldNum) const
610  {
611  assert(hd->curRow < hd->rows);
612  const blobField* f = hd->nextField;
613  int sizeByte = blobLenBytes();
614  unsigned int size = f->size;
615  //Copy data size
616  memcpy(dest, &size, sizeByte);
617  //Copy data
618  memcpy(blobBlock, f->data(), size);
619  //Copy data ptr
620  memcpy(dest + sizeByte, &blobBlock, sizeof(char*));
621  hd->nextField = (blobField*)f->next();
622  if (fieldNum == hd->fieldCount - 1)
623  ++hd->curRow;
624  return blobBlock + size;
625  }
626 
627  inline void setPadCharDefaultSettings()
628  {
629  if (!padCharOptionSaved())
630  {
631  // For compatibility with conventional.
632  if ((type == ft_string) || (type == ft_wstring) ||
633  (type == ft_mychar) || (type == ft_mywchar))
634  {
635  m_padCharOptions |= USE_PAD_CHAR;
636  m_padCharOptions |= TRIM_PAD_CHAR;
637  }
638  }
639  else if ((type == ft_mychar) || (type == ft_mywchar))
640  m_padCharOptions |= USE_PAD_CHAR;
641  }
642 
643  /* PadChar options are saved at schema.
644  This is for compatibility with conventional.*/
645  bool padCharOptionSaved() const
646  {
647  return (m_padCharOptions & PAD_CHAR_OPTION_SAVED) == PAD_CHAR_OPTION_SAVED;
648  }
649 
650 /** @endcond */
651 };
652 
653 namespace client
654 {
655 class dbdef;
656 }
657 
658 /* Mark of ** that BizStation Corp internal use only.
659  */
660 struct PACKAGE tabledef
661 {
662  friend class client::dbdef; // for formatVersion
663 
664  tabledef() { cleanup(); }
665 
666  void cleanup()
667  {
668  memset(this, 0, sizeof(tabledef));
669  formatVersion = 1;
670  primaryKeyNum = -1;
671  parentKeyNum = -1;
672  replicaKeyNum = -1;
673  pageSize = 2048;
674  }
675 
676 #ifdef _UNICODE
677  const wchar_t* fileName() const; // file name
678  const wchar_t* tableName() const; // table name
679  void setFileName(const wchar_t* s);
680  void setTableName(const wchar_t* s);
681  const char* toChar(char* buf, const wchar_t* s, int size);
682 
683 #else
684 #ifdef MYSQL_DYNAMIC_PLUGIN
685 
686  const char* fileName() const { return m_fileName; };
687 
688  const char* tableName() const { return m_tableName; };
689 
690  inline void setFileName(const char* s) { setFileNameA(s); };
691 
692  inline void setTableName(const char* s) { setTableNameA(s); };
693 
694  inline const char* toChar(char* buf, const char* s, int size)
695  {
696  strncpy_s(buf, size, s, size - 1);
697  return buf;
698  };
699 #else
700  const char* fileName() const;
701  const char* tableName() const;
702  void setFileName(const char* s);
703  void setTableName(const char* s);
704  const char* toChar(char* buf, const char* s, int size);
705 #endif // MYSQL_DYNAMIC_PLUGIN
706 #endif
707 
708  const char* fileNameA() const { return m_fileName; };
709 
710  const char* tableNameA() const { return m_tableName; };
711 
712  inline void setFileNameA(const char* s)
713  {
714  strncpy_s(m_fileName, FILE_NAME_SIZE, s, FILE_NAME_SIZE - 1);
715  }
716 
717  inline void setTableNameA(const char* s)
718  {
719  strncpy_s(m_tableName, TABLE_NAME_SIZE, s, sizeof(m_tableName) - 1);
720  }
721 
722  uint_td unPack(char* ptr, size_t size) const;
723  uint_td pack(char* ptr, size_t size) const;
724 
725  ushort_td id; // table id
726 
727 #ifdef SWIG
728  /* For swig interface
729  export field names.
730  */
731  ushort_td pageSize; // page size
732  ushort_td varSize; // second field length
733 #else
734 
735  union
736  {
737  ushort_td pageSize; // page size
738  ushort_td varSize; // second field length
739  };
740 #endif
741 
742  ushort_td preAlloc; // pre alloc page seize
743  ushort_td fieldCount; // Number of field
744  uchar_td keyCount; // Number of key
745 
746 private:
747  char m_fileName[FILE_NAME_SIZE];
748  char m_tableName[TABLE_NAME_SIZE];
749 
750 public:
751  short version; // table version
752  uchar_td charsetIndex; // SCHARSET_INFO vector index;
753  uchar_td filler0[17]; // reserved
754  FLAGS flags; // file flags
755  uchar_td primaryKeyNum; // Primary key number. -1 is no primary.
756  uchar_td parentKeyNum; // ** Key number for listview. -1 is no use.
757  uchar_td replicaKeyNum; // ** Key number for repdata. -1 is no use.
758  FLAGS optionFlags; // ** optional flags
759  ushort_td convertFileNum; // ** not use
760  ushort_td maxRecordLen; // max record length of var size table.
761  uchar_td treeIndex; // ** View index for listview.
762  uchar_td iconIndex; // ** Icon index for listview.
763  ushort_td ddfid;
764  ushort_td fixedRecordLen; // Fixed record length for var size table.
766  uchar_td iconIndex2;
767  uchar_td iconIndex3;
768  uint_td schemaCodePage; // Code page of this schema string data.
769 
770 private:
771  char formatVersion;
772 
773 public:
775  uchar_td reserved[TABLEDEF_FILLER_SIZE]; // reserved
776 
777  fielddef* fieldDefs; // Pointer cahche of first field.
778  keydef* keyDefs; // Pointer cahche of first key.
779 };
780 
781 /* optionFlags BizStation internal use only.
782  Bit0 send windows messege.
783  Bit1 show tree view.
784  Bit2 is master table or not
785  Bit3 is replicate or not
786  Bit4 is backup target or not.
787  Bit5 is encript or not
788  Bit6 is this table destination of convert .
789  Bit7 is support short cut in listveiw.
790  Bit8 is call validate function at delete record.
791  Bit9 Can export this table.
792  BitA is this table include valiable fields (varchar or varbinary is used)
793  BitB is this table include blob field (Blob is used)
794  */
795 
796 struct PACKAGE btrVersion
797 {
798  ushort_td majorVersion;
799  ushort_td minorVersion;
800  unsigned char type;
801 
802  const _TCHAR* moduleVersionShortString(_TCHAR* buf);
803  const _TCHAR* moduleTypeString();
804 };
805 
807 {
808  btrVersion versions[4];
809 };
810 
811 #pragma pack(pop)
812 pragma_pop;
813 
814 /* filter cobine type */
816 {
820 };
821 
822 /* compair types */
824 {
825  eEqual = 1,
826  eGreater = 2,
827  eLess = 3,
828  eNotEq = 4,
830  eLessEq = 6,
831  eBitAnd = 8,
833 };
834 
835 PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR* cmpstr);
836 
837 } // namespace tdap
838 } // namespace protocol
839 } // namespace db
840 } // namespace bzs
841 
842 #endif // BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
ushort_td preAlloc
Definition: tdapSchema.h:131
uchar_td iconIndex
Definition: tdapSchema.h:762
uchar_td replicaKeyNum
Definition: tdapSchema.h:757
ushort_td filterId
Definition: tdapSchema.h:250
void setFileNameA(const char *s)
Definition: tdapSchema.h:712
bool isBlob() const
Definition: tdapSchema.h:421
Definition: tdapSchema.h:818
ushort_td keylen
Definition: tdapSchema.h:260
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
ushort_td minorVersion
Definition: tdapSchema.h:799
ushort_td fixedRecordLen
Definition: tdapSchema.h:764
uchar_td lookTable
Definition: tdapSchema.h:239
フィールド定義構造体
Definition: tdapSchema.h:225
ushort_td ddfid
Definition: tdapSchema.h:249
ushort_td len
Definition: tdapSchema.h:232
サーバーおよびクライアントモジュールのバージョン構造体
Definition: tdapSchema.h:796
int autoIncExSpace
Definition: tdapSchema.h:765
combineType
Definition: tdapSchema.h:815
FLAGS fileFlag
Definition: tdapSchema.h:129
void setPadCharSettings(bool set, bool trim)
Definition: tdapSchema.h:491
uchar_td parentKeyNum
Definition: tdapSchema.h:756
unsigned short bitC
Definition: tdapSchema.h:98
pragma_pop
Definition: btrDate.h:106
uchar_td decimals
Definition: tdapSchema.h:233
ushort_td viewWidth
Definition: tdapSchema.h:235
unsigned short bitB
Definition: tdapSchema.h:97
ushort_td recLen
Definition: tdapSchema.h:125
ushort_td varSize
Definition: tdapSchema.h:738
uchar_td m_charsetIndex
Definition: tdapSchema.h:263
uchar_td reserve1[2]
Definition: tdapSchema.h:130
char m_name[N]
Definition: tdapSchema.h:228
uchar_td reserve2[2]
Definition: tdapSchema.h:116
Definition: tdapSchema.h:831
int varLenBytes() const
Definition: tdapSchema.h:404
unsigned int codePage() const
Definition: tdapSchema.h:368
bool isStringType(uchar_td type)
Definition: tdapSchema.h:204
ushort_td preAlloc
Definition: tdapSchema.h:742
uint_td blobDataLen(const uchar_td *ptr) const
Definition: tdapSchema.h:463
const char * nameA() const
Definition: tdapSchema.h:335
uchar_td acsNo
Definition: tdapSchema.h:118
keydef * keyDefs
Definition: tdapSchema.h:778
Definition: tdapSchema.h:828
uchar_td iconIndex3
Definition: tdapSchema.h:767
Definition: tdapSchema.h:827
ushort_td id
Definition: tdapSchema.h:725
int maxVarDatalen() const
Definition: tdapSchema.h:426
キーセグメント定義構造体
Definition: tdapSchema.h:137
const char * fileNameA() const
Definition: tdapSchema.h:708
PACKAGE const _TCHAR * getTypeName(short type)
void setNameA(const char *s)
Definition: tdapSchema.h:337
bool trimPadChar() const
Definition: tdapSchema.h:515
フィールド定義構造体
Definition: tdapSchema.h:300
Definition: tdapSchema.h:817
ビットフィールド共用体
Definition: tdapSchema.h:80
uint_td keyDataLen(const uchar_td *ptr) const
Definition: tdapSchema.h:484
fielddef_t< MYSQL_FDNAME_SIZE > fielddef_t_my
Definition: tdapSchema.h:293
unsigned short all
Definition: tdapSchema.h:82
char m_chainChar[2]
Definition: tdapSchema.h:246
bool usePadChar() const
Definition: tdapSchema.h:511
Definition: tdapSchema.h:830
ushort_td m_padCharOptions
Definition: tdapSchema.h:265
uint_td keyCount
Definition: tdapSchema.h:113
Definition: tdapSchema.h:832
バージョン配列構造体
Definition: tdapSchema.h:806
FLAGS enableFlags
Definition: tdapSchema.h:267
ushort_td defViewWidth
Definition: tdapSchema.h:243
PACKAGE ushort_td lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum)
uchar_td treeIndex
Definition: tdapSchema.h:761
Definition: tdapSchema.h:825
const char * tableNameA() const
Definition: tdapSchema.h:710
テーブルスキーマ管理クラス (nocopyable noncreatable)
Definition: dbDef.h:46
unsigned short bit8
Definition: tdapSchema.h:94
uchar_td keyCount
Definition: tdapSchema.h:744
ushort_td majorVersion
Definition: tdapSchema.h:798
ushort_td userOption
Definition: tdapSchema.h:253
unsigned short bit7
Definition: tdapSchema.h:93
uint_td schemaCodePage
Definition: tdapSchema.h:768
FLAGS keyFlag
Definition: tdapSchema.h:112
eCompType
Definition: tdapSchema.h:823
FLAGS flags
Definition: tdapSchema.h:140
uchar_td type
Definition: tdapSchema.h:231
uchar_td charsetIndex() const
Definition: tdapSchema.h:400
キー定義構造体
Definition: tdapSchema.h:147
uint_td recCount
Definition: tdapSchema.h:128
uchar_td keyType
Definition: tdapSchema.h:114
uchar_td nullValue
Definition: tdapSchema.h:115
unsigned short bitE
Definition: tdapSchema.h:100
double min
Definition: tdapSchema.h:237
ushort_td fieldCount
Definition: tdapSchema.h:743
uint_td blobLenBytes() const
Definition: tdapSchema.h:414
FLAGS optionFlags
Definition: tdapSchema.h:758
FLAGS flags
Definition: tdapSchema.h:754
create tableで使用するキーセグメント定義構造体
Definition: tdapSchema.h:108
uchar_td lookFields[3]
Definition: tdapSchema.h:241
tabledef()
Definition: tdapSchema.h:664
ushort_td ddfid
Definition: tdapSchema.h:763
ushort_td pos
Definition: tdapSchema.h:242
unsigned short bitD
Definition: tdapSchema.h:99
keySegment segments[MAX_KEY_SEGMENT]
Definition: tdapSchema.h:150
unsigned short bitF
Definition: tdapSchema.h:101
unsigned short bitA
Definition: tdapSchema.h:96
short version
Definition: tdapSchema.h:751
unsigned short bit9
Definition: tdapSchema.h:95
uchar_td fieldNum
Definition: tdapSchema.h:139
ushort_td pageSize
Definition: tdapSchema.h:737
ushort_td keyPos
Definition: tdapSchema.h:110
uchar_td keyNumber
Definition: tdapSchema.h:151
uchar_td iconIndex2
Definition: tdapSchema.h:766
ushort_td keyLen
Definition: tdapSchema.h:111
uchar_td primaryKeyNum
Definition: tdapSchema.h:755
uchar_td segmentCount
Definition: tdapSchema.h:149
void setLenByCharnum(ushort_td charnum)
Definition: tdapSchema.h:347
pragma_pack1
Definition: btrDate.h:35
bool isNumericType() const
Definition: tdapSchema.h:377
unsigned short bit1
Definition: tdapSchema.h:87
fielddef_t< PERVASIVE_FDNAME_SIZE > fielddef_t_pv
Definition: tdapSchema.h:294
unsigned short bit3
Definition: tdapSchema.h:89
Definition: tdapSchema.h:826
unsigned short bit5
Definition: tdapSchema.h:91
unsigned short bit6
Definition: tdapSchema.h:92
void setCharsetIndex(uchar_td index)
Definition: tdapSchema.h:391
uchar_td filterKeynum
Definition: tdapSchema.h:251
uchar_td lookDBNum
Definition: tdapSchema.h:254
uchar_td lookField
Definition: tdapSchema.h:240
uchar_td nullValue
Definition: tdapSchema.h:252
unsigned short bit0
Definition: tdapSchema.h:86
ushort_td maxRecordLen
Definition: tdapSchema.h:760
fielddef * fieldDefs
Definition: tdapSchema.h:777
double defValue
Definition: tdapSchema.h:238
unsigned short bit2
Definition: tdapSchema.h:88
Definition: tdapSchema.h:819
ushort_td convertFileNum
Definition: tdapSchema.h:759
client::dbdef * parent
Definition: tdapSchema.h:774
void cleanup()
Definition: tdapSchema.h:666
int align() const
Definition: tdapSchema.h:345
uint_td dataLen(const uchar_td *ptr) const
Definition: tdapSchema.h:453
char viewNum
Definition: tdapSchema.h:234
ushort_td m_schemaCodePage
Definition: tdapSchema.h:264
PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR *cmpstr)
bool isStringTypeForIndex(uchar_td type)
Definition: tdapSchema.h:185
unsigned char type
Definition: tdapSchema.h:800
PACKAGE int getTypeAlign(short type)
uchar_td charsetIndex
Definition: tdapSchema.h:752
uchar_td keyNo
Definition: tdapSchema.h:117
Definition: tdapSchema.h:829
create tableで使用するファイル定義構造体
Definition: tdapSchema.h:123
テーブル定義構造体
Definition: tdapSchema.h:660
keySpec keySpecs[1]
Definition: tdapSchema.h:132
ushort_td pageSize
Definition: tdapSchema.h:126
double max
Definition: tdapSchema.h:236
const _TCHAR * typeName() const
Definition: tdapSchema.h:343
unsigned short bit4
Definition: tdapSchema.h:90
ushort_td indexCount
Definition: tdapSchema.h:127
const uchar_td * keyData(const uchar_td *ptr) const
Definition: tdapSchema.h:476
void setTableNameA(const char *s)
Definition: tdapSchema.h:717

Transactd SDK 2015年09月08日(火) 19時13分35秒 doxygen