MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DictTabInfo.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef DICT_TAB_INFO_HPP
19 #define DICT_TAB_INFO_HPP
20 
21 #include "SignalData.hpp"
22 #include <AttributeDescriptor.hpp>
23 #include <SimpleProperties.hpp>
24 #include <ndb_limits.h>
25 #include <NdbSqlUtil.hpp>
26 #include <ndb_global.h>
27 
28 #ifndef my_decimal_h
29 
30 // sql/my_decimal.h requires many more sql/*.h new to ndb
31 // for now, copy the bit we need TODO proper fix
32 
33 #define DECIMAL_MAX_FIELD_SIZE ((9 * 9) - (2 * 8))
34 
35 #ifndef DECIMAL_NOT_SPECIFIED
36 #define DECIMAL_NOT_SPECIFIED 31
37 #endif
38 
39 C_MODE_START
40 extern int decimal_bin_size(int, int);
41 C_MODE_END
42 
43 inline int my_decimal_get_binary_size(uint precision, uint scale)
44 {
45  return decimal_bin_size((int)precision, (int)scale);
46 }
47 
48 #endif
49 
50 #define DTIMAP(x, y, z) \
51  { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 }
52 
53 #define DTIMAP2(x, y, z, u, v) \
54  { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 }
55 
56 #define DTIMAPS(x, y, z, u, v) \
57  { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::StringValue, u, v, 0 }
58 
59 #define DTIMAPB(x, y, z, u, v, l) \
60  { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::BinaryValue, u, v, \
61  my_offsetof(x, l) }
62 
63 #define DTIBREAK(x) \
64  { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 }
65 
66 class DictTabInfo {
70  // Blocks
71  friend class Backup;
72  friend class Dbdict;
73  friend class Ndbcntr;
74  friend class Trix;
75  friend class DbUtil;
76  // API
77  friend class NdbSchemaOp;
78 
82  friend bool printDICTTABINFO(FILE * output,
83  const Uint32 * theData,
84  Uint32 len,
85  Uint16 receiverBlockNo);
86 
87 public:
88  enum RequestType {
89  CreateTableFromAPI = 1,
90  AddTableFromDict = 2, // Between DICT's
91  CopyTable = 3, // Between DICT's
92  ReadTableFromDiskSR = 4, // Local in DICT
93  GetTabInfoConf = 5,
94  AlterTableFromAPI = 6
95  };
96 
97  enum KeyValues {
98  TableName = 1, // String, Mandatory
99  TableId = 2, //Mandatory between DICT's otherwise not allowed
100  TableVersion = 3, //Mandatory between DICT's otherwise not allowed
101  TableLoggedFlag = 4, //Default Logged
102  NoOfKeyAttr = 5, //Default 1
103  NoOfAttributes = 6, //Mandatory
104  NoOfNullable = 7, //Deafult 0
105  NoOfVariable = 8, //Default 0
106  TableKValue = 9, //Default 6
107  MinLoadFactor = 10, //Default 70
108  MaxLoadFactor = 11, //Default 80
109  KeyLength = 12, //Default 1 (No of words in primary key)
110  FragmentTypeVal = 13, //Default AllNodesSmallTable
111  TableTypeVal = 18, //Default TableType::UserTable
112  PrimaryTable = 19, //Mandatory for index otherwise RNIL
113  PrimaryTableId = 20, //ditto
114  IndexState = 21,
115  InsertTriggerId = 22,
116  UpdateTriggerId = 23,
117  DeleteTriggerId = 24,
118  CustomTriggerId = 25,
119  FrmLen = 26,
120  FrmData = 27,
121 
122  TableTemporaryFlag = 28, //Default not Temporary
123  ForceVarPartFlag = 29,
124 
125  FragmentCount = 128, // No of fragments in table (!fragment replicas)
126  FragmentDataLen = 129,
127  FragmentData = 130, // CREATE_FRAGMENTATION reply
128  TablespaceId = 131,
129  TablespaceVersion = 132,
130  TablespaceDataLen = 133,
131  TablespaceData = 134,
132  RangeListDataLen = 135,
133  RangeListData = 136,
134  ReplicaDataLen = 137,
135  ReplicaData = 138,
136  MaxRowsLow = 139,
137  MaxRowsHigh = 140,
138  DefaultNoPartFlag = 141,
139  LinearHashFlag = 142,
140  MinRowsLow = 143,
141  MinRowsHigh = 144,
142 
143  RowGCIFlag = 150,
144  RowChecksumFlag = 151,
145 
146  SingleUserMode = 152,
147 
148  HashMapObjectId = 153,
149  HashMapVersion = 154,
150 
151  TableStorageType = 155,
152 
153  ExtraRowGCIBits = 156,
154  ExtraRowAuthorBits = 157,
155 
156  TableEnd = 999,
157 
158  AttributeName = 1000, // String, Mandatory
159  AttributeId = 1001, //Mandatory between DICT's otherwise not allowed
160  AttributeType = 1002, //for osu 4.1->5.0.x
161  AttributeSize = 1003, //Default DictTabInfo::a32Bit
162  AttributeArraySize = 1005, //Default 1
163  AttributeKeyFlag = 1006, //Default noKey
164  AttributeStorageType = 1007, //Default NDB_STORAGETYPE_MEMORY
165  AttributeNullableFlag = 1008, //Default NotNullable
166  AttributeDynamic = 1009, //Default not dynamic
167  AttributeDKey = 1010, //Default NotDKey
168  AttributeExtType = 1013, //Default ExtUnsigned
169  AttributeExtPrecision = 1014, //Default 0
170  AttributeExtScale = 1015, //Default 0
171  AttributeExtLength = 1016, //Default 0
172  AttributeAutoIncrement = 1017, //Default false
173  AttributeArrayType = 1019, //Default NDB_ARRAYTYPE_FIXED
174  AttributeDefaultValueLen = 1020, //Actual Length saved in AttributeDefaultValue
175  /* Default value (Binary type, not printable as string),
176  * For backward compatibility, the new keyValue
177  * (not use the old keyValue 1018) is added
178  when restoring data from low backup version data.
179  */
180  AttributeDefaultValue = 1021,
181  AttributeEnd = 1999 //
182  };
183  // ----------------------------------------------------------------------
184  // Part of the protocol is that we only transfer parameters which do not
185  // have a default value. Thus the default values are part of the protocol.
186  // ----------------------------------------------------------------------
187 
188 
189 
190  // FragmentType constants
191  enum FragmentType {
192  AllNodesSmallTable = 0,
193  AllNodesMediumTable = 1,
194  AllNodesLargeTable = 2,
195  SingleFragment = 3,
196  DistrKeyHash = 4,
197  DistrKeyLin = 5,
198  UserDefined = 6,
199  DistrKeyOrderedIndex = 8, // alias
200  HashMapPartition = 9
201  };
202 
203  // TableType constants + objects
204  enum TableType {
205  UndefTableType = 0,
206  SystemTable = 1,
207  UserTable = 2,
208  UniqueHashIndex = 3,
209  HashIndex = 4,
210  UniqueOrderedIndex = 5,
211  OrderedIndex = 6,
212  // constant 10 hardcoded in Dbdict.cpp
213  HashIndexTrigger = 11,
214  SubscriptionTrigger = 16,
215  ReadOnlyConstraint = 17,
216  IndexTrigger = 18,
217  ReorgTrigger = 19,
218 
219  Tablespace = 20,
221  Datafile = 22,
222  Undofile = 23,
223  HashMap = 24,
224 
225  SchemaTransaction = 30
226  };
227 
228  // used 1) until type BlobTable added 2) in upgrade code
229  static bool
230  isBlobTableName(const char* name, Uint32* ptab_id = 0, Uint32* pcol_no = 0);
231 
232  static inline bool
233  isTable(int tableType) {
234  return
235  tableType == SystemTable ||
236  tableType == UserTable;
237  }
238  static inline bool
239  isIndex(int tableType) {
240  return
241  tableType == UniqueHashIndex ||
242  tableType == HashIndex ||
243  tableType == UniqueOrderedIndex ||
244  tableType == OrderedIndex;
245  }
246  static inline bool
247  isUniqueIndex(int tableType) {
248  return
249  tableType == UniqueHashIndex ||
250  tableType == UniqueOrderedIndex;
251  }
252  static inline bool
253  isNonUniqueIndex(int tableType) {
254  return
255  tableType == HashIndex ||
256  tableType == OrderedIndex;
257  }
258  static inline bool
259  isHashIndex(int tableType) {
260  return
261  tableType == UniqueHashIndex ||
262  tableType == HashIndex;
263  }
264  static inline bool
265  isOrderedIndex(int tableType) {
266  return
267  tableType == UniqueOrderedIndex ||
268  tableType == OrderedIndex;
269  }
270  static inline bool
271  isTrigger(int tableType) {
272  return
273  tableType == HashIndexTrigger ||
274  tableType == SubscriptionTrigger ||
275  tableType == ReadOnlyConstraint ||
276  tableType == IndexTrigger ||
277  tableType == ReorgTrigger;
278  }
279  static inline bool
280  isFilegroup(int tableType) {
281  return
282  tableType == Tablespace ||
283  tableType == LogfileGroup;
284  }
285 
286  static inline bool
287  isFile(int tableType) {
288  return
289  tableType == Datafile||
290  tableType == Undofile;
291  }
292 
293  static inline bool
294  isHashMap(int tableType) {
295  return
296  tableType == HashMap;
297  }
298 
299  // Object state for translating from/to API
300  enum ObjectState {
301  StateUndefined = 0,
302  StateOffline = 1,
303  StateBuilding = 2,
304  StateDropping = 3,
305  StateOnline = 4,
306  StateBackup = 5,
307  StateBroken = 9
308  };
309 
310  // Object store for translating from/to API
311  enum ObjectStore {
312  StoreUndefined = 0,
313  StoreNotLogged = 1,
314  StorePermanent = 2
315  };
316 
317  // AttributeSize constants
318  STATIC_CONST( aBit = 0 );
319  STATIC_CONST( an8Bit = 3 );
320  STATIC_CONST( a16Bit = 4 );
321  STATIC_CONST( a32Bit = 5 );
322  STATIC_CONST( a64Bit = 6 );
323  STATIC_CONST( a128Bit = 7 );
324 
325  // Table data interpretation
326  struct Table {
327  char TableName[MAX_TAB_NAME_SIZE];
328  Uint32 TableId;
329  char PrimaryTable[MAX_TAB_NAME_SIZE]; // Only used when "index"
330  Uint32 PrimaryTableId;
331  Uint32 TableLoggedFlag;
332  Uint32 TableTemporaryFlag;
333  Uint32 ForceVarPartFlag;
334  Uint32 NoOfKeyAttr;
335  Uint32 NoOfAttributes;
336  Uint32 NoOfNullable;
337  Uint32 NoOfVariable;
338  Uint32 TableKValue;
339  Uint32 MinLoadFactor;
340  Uint32 MaxLoadFactor;
341  Uint32 KeyLength;
342  Uint32 FragmentType;
343  Uint32 TableType;
344  Uint32 TableVersion;
345  Uint32 IndexState;
346  Uint32 InsertTriggerId;
347  Uint32 UpdateTriggerId;
348  Uint32 DeleteTriggerId;
349  Uint32 CustomTriggerId;
350  Uint32 TablespaceId;
351  Uint32 TablespaceVersion;
352  Uint32 DefaultNoPartFlag;
353  Uint32 LinearHashFlag;
354  /*
355  TODO RONM:
356  We need to replace FRM, Fragment Data, Tablespace Data and in
357  very particular RangeListData with dynamic arrays
358  */
359  Uint32 FrmLen;
360  char FrmData[MAX_FRM_DATA_SIZE];
361  Uint32 FragmentCount;
362  Uint32 ReplicaDataLen;
363  Uint16 ReplicaData[MAX_FRAGMENT_DATA_BYTES];
364  Uint32 FragmentDataLen;
365  Uint16 FragmentData[3*MAX_NDB_PARTITIONS];
366 
367  Uint32 MaxRowsLow;
368  Uint32 MaxRowsHigh;
369  Uint32 MinRowsLow;
370  Uint32 MinRowsHigh;
371 
372  Uint32 TablespaceDataLen;
373  Uint32 TablespaceData[2*MAX_NDB_PARTITIONS];
374  Uint32 RangeListDataLen;
375  Uint32 RangeListData[2*MAX_NDB_PARTITIONS*2];
376 
377  Uint32 RowGCIFlag;
378  Uint32 RowChecksumFlag;
379 
380  Uint32 SingleUserMode;
381 
382  Uint32 HashMapObjectId;
383  Uint32 HashMapVersion;
384 
385  Uint32 TableStorageType;
386 
387  Uint32 ExtraRowGCIBits;
388  Uint32 ExtraRowAuthorBits;
389 
390  Table() {}
391  void init();
392  };
393 
394  static const
395  SimpleProperties::SP2StructMapping TableMapping[];
396 
397  static const Uint32 TableMappingSize;
398 
399  // AttributeExtType values
400  enum ExtType {
401  ExtUndefined = NdbSqlUtil::Type::Undefined,
402  ExtTinyint = NdbSqlUtil::Type::Tinyint,
403  ExtTinyunsigned = NdbSqlUtil::Type::Tinyunsigned,
404  ExtSmallint = NdbSqlUtil::Type::Smallint,
405  ExtSmallunsigned = NdbSqlUtil::Type::Smallunsigned,
406  ExtMediumint = NdbSqlUtil::Type::Mediumint,
407  ExtMediumunsigned = NdbSqlUtil::Type::Mediumunsigned,
408  ExtInt = NdbSqlUtil::Type::Int,
409  ExtUnsigned = NdbSqlUtil::Type::Unsigned,
410  ExtBigint = NdbSqlUtil::Type::Bigint,
411  ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
412  ExtFloat = NdbSqlUtil::Type::Float,
413  ExtDouble = NdbSqlUtil::Type::Double,
414  ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
415  ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
416  ExtDecimal = NdbSqlUtil::Type::Decimal,
417  ExtDecimalunsigned = NdbSqlUtil::Type::Decimalunsigned,
418  ExtChar = NdbSqlUtil::Type::Char,
419  ExtVarchar = NdbSqlUtil::Type::Varchar,
420  ExtBinary = NdbSqlUtil::Type::Binary,
421  ExtVarbinary = NdbSqlUtil::Type::Varbinary,
422  ExtDatetime = NdbSqlUtil::Type::Datetime,
423  ExtDate = NdbSqlUtil::Type::Date,
424  ExtBlob = NdbSqlUtil::Type::Blob,
425  ExtText = NdbSqlUtil::Type::Text,
426  ExtBit = NdbSqlUtil::Type::Bit,
427  ExtLongvarchar = NdbSqlUtil::Type::Longvarchar,
428  ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary,
429  ExtTime = NdbSqlUtil::Type::Time,
430  ExtYear = NdbSqlUtil::Type::Year,
431  ExtTimestamp = NdbSqlUtil::Type::Timestamp
432  };
433 
434  // Attribute data interpretation
435  struct Attribute {
436  char AttributeName[MAX_TAB_NAME_SIZE];
437  Uint32 AttributeId;
438  Uint32 AttributeType; // for osu 4.1->5.0.x
439  Uint32 AttributeSize;
440  Uint32 AttributeArraySize;
441  Uint32 AttributeArrayType;
442  Uint32 AttributeKeyFlag;
443  Uint32 AttributeNullableFlag;
444  Uint32 AttributeDKey;
445  Uint32 AttributeExtType;
446  Uint32 AttributeExtPrecision;
447  Uint32 AttributeExtScale;
448  Uint32 AttributeExtLength;
449  Uint32 AttributeAutoIncrement;
450  Uint32 AttributeStorageType;
451  Uint32 AttributeDynamic;
452  Uint32 AttributeDefaultValueLen; //byte sizes
453  Uint8 AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
454 
455  Attribute() {}
456  void init();
457 
458  inline
459  Uint32 sizeInWords()
460  {
461  return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5;
462  }
463 
464  // compute old-sty|e attribute size and array size
465  inline bool
466  translateExtType() {
467  switch (AttributeExtType) {
468  case DictTabInfo::ExtUndefined:
469  return false;
470  case DictTabInfo::ExtTinyint:
471  case DictTabInfo::ExtTinyunsigned:
472  AttributeSize = DictTabInfo::an8Bit;
473  AttributeArraySize = AttributeExtLength;
474  break;
475  case DictTabInfo::ExtSmallint:
476  case DictTabInfo::ExtSmallunsigned:
477  AttributeSize = DictTabInfo::a16Bit;
478  AttributeArraySize = AttributeExtLength;
479  break;
480  case DictTabInfo::ExtMediumint:
481  case DictTabInfo::ExtMediumunsigned:
482  AttributeSize = DictTabInfo::an8Bit;
483  AttributeArraySize = 3 * AttributeExtLength;
484  break;
485  case DictTabInfo::ExtInt:
486  case DictTabInfo::ExtUnsigned:
487  AttributeSize = DictTabInfo::a32Bit;
488  AttributeArraySize = AttributeExtLength;
489  break;
490  case DictTabInfo::ExtBigint:
491  case DictTabInfo::ExtBigunsigned:
492  AttributeSize = DictTabInfo::a64Bit;
493  AttributeArraySize = AttributeExtLength;
494  break;
495  case DictTabInfo::ExtFloat:
496  AttributeSize = DictTabInfo::a32Bit;
497  AttributeArraySize = AttributeExtLength;
498  break;
499  case DictTabInfo::ExtDouble:
500  AttributeSize = DictTabInfo::a64Bit;
501  AttributeArraySize = AttributeExtLength;
502  break;
503  case DictTabInfo::ExtOlddecimal:
504  AttributeSize = DictTabInfo::an8Bit;
505  AttributeArraySize =
506  (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
507  AttributeExtLength;
508  break;
509  case DictTabInfo::ExtOlddecimalunsigned:
510  AttributeSize = DictTabInfo::an8Bit;
511  AttributeArraySize =
512  (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
513  AttributeExtLength;
514  break;
515  case DictTabInfo::ExtDecimal:
516  case DictTabInfo::ExtDecimalunsigned:
517  {
518  // copy from Field_new_decimal ctor
519  uint precision = AttributeExtPrecision;
520  uint scale = AttributeExtScale;
521  if (precision > DECIMAL_MAX_FIELD_SIZE ||
522  scale >= DECIMAL_NOT_SPECIFIED)
523  return false;
524  uint bin_size = my_decimal_get_binary_size(precision, scale);
525  AttributeSize = DictTabInfo::an8Bit;
526  AttributeArraySize = bin_size * AttributeExtLength;
527  }
528  break;
529  case DictTabInfo::ExtChar:
530  case DictTabInfo::ExtBinary:
531  AttributeSize = DictTabInfo::an8Bit;
532  AttributeArraySize = AttributeExtLength;
533  break;
534  case DictTabInfo::ExtVarchar:
535  case DictTabInfo::ExtVarbinary:
536  if (AttributeExtLength > 0xff)
537  return false;
538  AttributeSize = DictTabInfo::an8Bit;
539  AttributeArraySize = AttributeExtLength + 1;
540  break;
541  case DictTabInfo::ExtDatetime:
542  // to fix
543  AttributeSize = DictTabInfo::an8Bit;
544  AttributeArraySize = 8 * AttributeExtLength;
545  break;
546  case DictTabInfo::ExtDate:
547  // to fix
548  AttributeSize = DictTabInfo::an8Bit;
549  AttributeArraySize = 3 * AttributeExtLength;
550  break;
551  case DictTabInfo::ExtBlob:
552  case DictTabInfo::ExtText:
553  AttributeSize = DictTabInfo::an8Bit;
554  if (unlikely(AttributeArrayType == NDB_ARRAYTYPE_FIXED)) {
555  // head + inline part (length in precision lower half)
556  AttributeArraySize = (NDB_BLOB_V1_HEAD_SIZE << 2) +
557  (AttributeExtPrecision & 0xFFFF);
558  } else {
559  AttributeArraySize = (NDB_BLOB_V2_HEAD_SIZE << 2) +
560  (AttributeExtPrecision & 0xFFFF);
561  }
562  break;
563  case DictTabInfo::ExtBit:
564  AttributeSize = DictTabInfo::aBit;
565  AttributeArraySize = AttributeExtLength;
566  break;
567  case DictTabInfo::ExtLongvarchar:
568  case DictTabInfo::ExtLongvarbinary:
569  if (AttributeExtLength > 0xffff)
570  return false;
571  AttributeSize = DictTabInfo::an8Bit;
572  AttributeArraySize = AttributeExtLength + 2;
573  break;
574  case DictTabInfo::ExtTime:
575  AttributeSize = DictTabInfo::an8Bit;
576  AttributeArraySize = 3 * AttributeExtLength;
577  break;
578  case DictTabInfo::ExtYear:
579  AttributeSize = DictTabInfo::an8Bit;
580  AttributeArraySize = 1 * AttributeExtLength;
581  break;
582  case DictTabInfo::ExtTimestamp:
583  AttributeSize = DictTabInfo::an8Bit;
584  AttributeArraySize = 4 * AttributeExtLength;
585  break;
586  default:
587  return false;
588  };
589  return true;
590  }
591 
592  inline void print(FILE *out) {
593  fprintf(out, "AttributeId = %d\n", AttributeId);
594  fprintf(out, "AttributeType = %d\n", AttributeType);
595  fprintf(out, "AttributeSize = %d\n", AttributeSize);
596  fprintf(out, "AttributeArraySize = %d\n", AttributeArraySize);
597  fprintf(out, "AttributeArrayType = %d\n", AttributeArrayType);
598  fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag);
599  fprintf(out, "AttributeStorageType = %d\n", AttributeStorageType);
600  fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag);
601  fprintf(out, "AttributeDKey = %d\n", AttributeDKey);
602  fprintf(out, "AttributeGroup = %d\n", AttributeGroup);
603  fprintf(out, "AttributeAutoIncrement = %d\n", AttributeAutoIncrement);
604  fprintf(out, "AttributeExtType = %d\n", AttributeExtType);
605  fprintf(out, "AttributeExtPrecision = %d\n", AttributeExtPrecision);
606  fprintf(out, "AttributeExtScale = %d\n", AttributeExtScale);
607  fprintf(out, "AttributeExtLength = %d\n", AttributeExtLength);
608  fprintf(out, "AttributeDefaultValueLen = %d\n",
609  AttributeDefaultValueLen);
610  fprintf(out, "AttributeDefaultValue: \n");
611  for (unsigned int i = 0; i < AttributeDefaultValueLen; i++)
612  fprintf(out, "0x%x", AttributeDefaultValue[i]);
613  }
614  };
615 
616  static const
617  SimpleProperties::SP2StructMapping AttributeMapping[];
618 
619  static const Uint32 AttributeMappingSize;
620 
621  // Signal constants
622  STATIC_CONST( DataLength = 20 );
623  STATIC_CONST( HeaderLength = 5 );
624 
625 private:
626  Uint32 senderRef;
627  Uint32 senderData;
628  Uint32 requestType;
629  Uint32 totalLen;
630  Uint32 offset;
631 
637  Uint32 tabInfoData[DataLength];
638 
639 public:
640  enum Deprecated
641  {
642  AttributeDGroup = 1009, //Default NotDGroup
643  AttributeStoredInd = 1011, //Default NotStored
644  TableStorageVal = 14, //Disk storage specified per attribute
645  SecondTableId = 17, //Mandatory between DICT's otherwise not allowed
646  FragmentKeyTypeVal = 16 //Default PrimaryKey
647  };
648 
649  enum Unimplemented
650  {
651  ScanOptimised = 15, //Default updateOptimised
652  AttributeGroup = 1012, //Default 0
653  FileNo = 102
654  };
655 };
656 
657 #define DFGIMAP(x, y, z) \
658  { DictFilegroupInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 }
659 
660 #define DFGIMAP2(x, y, z, u, v) \
661  { DictFilegroupInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 }
662 
663 #define DFGIMAPS(x, y, z, u, v) \
664  { DictFilegroupInfo::y, my_offsetof(x, z), SimpleProperties::StringValue, u, v, 0 }
665 
666 #define DFGIMAPB(x, y, z, u, v, l) \
667  { DictFilegroupInfo::y, my_offsetof(x, z), SimpleProperties::BinaryValue, u, v, \
668  my_offsetof(x, l) }
669 
670 #define DFGIBREAK(x) \
671  { DictFilegroupInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 }
672 
674  enum KeyValues {
675  FilegroupName = 1,
676  FilegroupType = 2,
677  FilegroupId = 3,
678  FilegroupVersion = 4,
679 
683  FileName = 100,
684  FileType = 101,
685  FileId = 103,
686  FileFGroupId = 104,
687  FileFGroupVersion = 105,
688  FileSizeHi = 106,
689  FileSizeLo = 107,
690  FileFreeExtents = 108,
691  FileVersion = 109,
692  FileEnd = 199, //
693 
697  TS_ExtentSize = 1000, // specified in bytes
698  TS_LogfileGroupId = 1001,
699  TS_LogfileGroupVersion = 1002,
700  TS_GrowLimit = 1003, // In bytes
701  TS_GrowSizeHi = 1004,
702  TS_GrowSizeLo = 1005,
703  TS_GrowPattern = 1006,
704  TS_GrowMaxSize = 1007,
705 
709  LF_UndoBufferSize = 2005, // In bytes
710  LF_UndoGrowLimit = 2000, // In bytes
711  LF_UndoGrowSizeHi = 2001,
712  LF_UndoGrowSizeLo = 2002,
713  LF_UndoGrowPattern = 2003,
714  LF_UndoGrowMaxSize = 2004,
715  LF_UndoFreeWordsHi = 2006,
716  LF_UndoFreeWordsLo = 2007
717  };
718 
719  // FragmentType constants
720  enum FileTypeValues {
721  Datafile = 0,
722  Undofile = 1
723  //, Redofile
724  };
725 
726  struct GrowSpec {
727  Uint32 GrowLimit;
728  Uint32 GrowSizeHi;
729  Uint32 GrowSizeLo;
730  char GrowPattern[PATH_MAX];
731  Uint32 GrowMaxSize;
732  };
733 
734  // Table data interpretation
735  struct Filegroup {
736  char FilegroupName[MAX_TAB_NAME_SIZE];
737  Uint32 FilegroupType; // ObjType
738  Uint32 FilegroupId;
739  Uint32 FilegroupVersion;
740 
741  union {
742  Uint32 TS_ExtentSize;
743  Uint32 LF_UndoBufferSize;
744  };
745  Uint32 TS_LogfileGroupId;
746  Uint32 TS_LogfileGroupVersion;
747  union {
748  GrowSpec TS_DataGrow;
749  GrowSpec LF_UndoGrow;
750  };
751  //GrowSpec LF_RedoGrow;
752  Uint32 LF_UndoFreeWordsHi;
753  Uint32 LF_UndoFreeWordsLo;
754  Filegroup() {}
755  void init();
756  };
757  static const Uint32 MappingSize;
758  static const SimpleProperties::SP2StructMapping Mapping[];
759 
760  struct File {
761  char FileName[PATH_MAX];
762  Uint32 FileType;
763  Uint32 FileId;
764  Uint32 FileVersion;
765  Uint32 FilegroupId;
766  Uint32 FilegroupVersion;
767  Uint32 FileSizeHi;
768  Uint32 FileSizeLo;
769  Uint32 FileFreeExtents;
770 
771  File() {}
772  void init();
773  };
774  static const Uint32 FileMappingSize;
775  static const SimpleProperties::SP2StructMapping FileMapping[];
776 };
777 
778 #define DHMIMAP(x, y, z) \
779  { DictHashMapInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 }
780 
781 #define DHMIMAP2(x, y, z, u, v) \
782  { DictHashMapInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 }
783 
784 #define DHMIMAPS(x, y, z, u, v) \
785  { DictHashMapInfo::y, my_offsetof(x, z), SimpleProperties::StringValue, u, v, 0 }
786 
787 #define DHMIMAPB(x, y, z, u, v, l) \
788  { DictHashMapInfo::y, my_offsetof(x, z), SimpleProperties::BinaryValue, u, v, \
789  my_offsetof(x, l) }
790 
791 #define DHMIBREAK(x) \
792  { DictHashMapInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 }
793 
795  enum KeyValues {
796  HashMapName = 1,
797  HashMapBuckets = 2,
798  HashMapValues = 3
799  };
800 
801  // Table data interpretation
802  struct HashMap {
803  char HashMapName[MAX_TAB_NAME_SIZE];
804  Uint32 HashMapBuckets;
805  Uint16 HashMapValues[512];
806  Uint32 HashMapObjectId;
807  Uint32 HashMapVersion;
808  HashMap() {}
809  void init();
810  };
811  static const Uint32 MappingSize;
813 };
814 
815 #endif