00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef DICT_TAB_INFO_HPP 00018 #define DICT_TAB_INFO_HPP 00019 00020 #include "SignalData.hpp" 00021 #include <AttributeDescriptor.hpp> 00022 #include <SimpleProperties.hpp> 00023 #include <ndb_limits.h> 00024 #include <NdbSqlUtil.hpp> 00025 #include <ndb_global.h> 00026 00027 #ifndef my_decimal_h 00028 00029 // sql/my_decimal.h requires many more sql/*.h new to ndb 00030 // for now, copy the bit we need TODO proper fix 00031 00032 #define DECIMAL_MAX_LENGTH ((8 * 9) - 8) 00033 00034 #ifndef NOT_FIXED_DEC 00035 #define NOT_FIXED_DEC 31 00036 #endif 00037 00038 C_MODE_START 00039 extern int decimal_bin_size(int, int); 00040 C_MODE_END 00041 00042 inline int my_decimal_get_binary_size(uint precision, uint scale) 00043 { 00044 return decimal_bin_size((int)precision, (int)scale); 00045 } 00046 00047 #endif 00048 00049 #define DTIMAP(x, y, z) \ 00050 { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 } 00051 00052 #define DTIMAP2(x, y, z, u, v) \ 00053 { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 } 00054 00055 #define DTIMAPS(x, y, z, u, v) \ 00056 { DictTabInfo::y, offsetof(x, z), SimpleProperties::StringValue, u, v, 0 } 00057 00058 #define DTIMAPB(x, y, z, u, v, l) \ 00059 { DictTabInfo::y, offsetof(x, z), SimpleProperties::BinaryValue, u, v, \ 00060 offsetof(x, l) } 00061 00062 #define DTIBREAK(x) \ 00063 { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 } 00064 00065 class DictTabInfo { 00069 // Blocks 00070 friend class Backup; 00071 friend class Dbdict; 00072 friend class Ndbcntr; 00073 friend class Trix; 00074 friend class DbUtil; 00075 // API 00076 friend class NdbSchemaOp; 00077 00081 friend bool printDICTTABINFO(FILE * output, 00082 const Uint32 * theData, 00083 Uint32 len, 00084 Uint16 receiverBlockNo); 00085 00086 public: 00087 enum RequestType { 00088 CreateTableFromAPI = 1, 00089 AddTableFromDict = 2, // Between DICT's 00090 CopyTable = 3, // Between DICT's 00091 ReadTableFromDiskSR = 4, // Local in DICT 00092 GetTabInfoConf = 5, 00093 AlterTableFromAPI = 6 00094 }; 00095 00096 enum KeyValues { 00097 TableName = 1, // String, Mandatory 00098 TableId = 2, //Mandatory between DICT's otherwise not allowed 00099 TableVersion = 3, //Mandatory between DICT's otherwise not allowed 00100 TableLoggedFlag = 4, //Default Logged 00101 NoOfKeyAttr = 5, //Default 1 00102 NoOfAttributes = 6, //Mandatory 00103 NoOfNullable = 7, //Deafult 0 00104 NoOfVariable = 8, //Default 0 00105 TableKValue = 9, //Default 6 00106 MinLoadFactor = 10, //Default 70 00107 MaxLoadFactor = 11, //Default 80 00108 KeyLength = 12, //Default 1 (No of words in primary key) 00109 FragmentTypeVal = 13, //Default AllNodesSmallTable 00110 TableTypeVal = 18, //Default TableType::UserTable 00111 PrimaryTable = 19, //Mandatory for index otherwise RNIL 00112 PrimaryTableId = 20, //ditto 00113 IndexState = 21, 00114 InsertTriggerId = 22, 00115 UpdateTriggerId = 23, 00116 DeleteTriggerId = 24, 00117 CustomTriggerId = 25, 00118 FrmLen = 26, 00119 FrmData = 27, 00120 00121 FragmentCount = 128, // No of fragments in table (!fragment replicas) 00122 FragmentDataLen = 129, 00123 FragmentData = 130, // CREATE_FRAGMENTATION reply 00124 TablespaceId = 131, 00125 TablespaceVersion = 132, 00126 TablespaceDataLen = 133, 00127 TablespaceData = 134, 00128 RangeListDataLen = 135, 00129 RangeListData = 136, 00130 ReplicaDataLen = 137, 00131 ReplicaData = 138, 00132 MaxRowsLow = 139, 00133 MaxRowsHigh = 140, 00134 DefaultNoPartFlag = 141, 00135 LinearHashFlag = 142, 00136 MinRowsLow = 143, 00137 MinRowsHigh = 144, 00138 00139 RowGCIFlag = 150, 00140 RowChecksumFlag = 151, 00141 00142 TableEnd = 999, 00143 00144 AttributeName = 1000, // String, Mandatory 00145 AttributeId = 1001, //Mandatory between DICT's otherwise not allowed 00146 AttributeType = 1002, //for osu 4.1->5.0.x 00147 AttributeSize = 1003, //Default DictTabInfo::a32Bit 00148 AttributeArraySize = 1005, //Default 1 00149 AttributeKeyFlag = 1006, //Default noKey 00150 AttributeStorageType = 1007, //Default NDB_STORAGETYPE_MEMORY 00151 AttributeNullableFlag = 1008, //Default NotNullable 00152 AttributeDKey = 1010, //Default NotDKey 00153 AttributeExtType = 1013, //Default ExtUnsigned 00154 AttributeExtPrecision = 1014, //Default 0 00155 AttributeExtScale = 1015, //Default 0 00156 AttributeExtLength = 1016, //Default 0 00157 AttributeAutoIncrement = 1017, //Default false 00158 AttributeDefaultValue = 1018, //Default value (printable string), 00159 AttributeArrayType = 1019, //Default NDB_ARRAYTYPE_FIXED 00160 AttributeEnd = 1999 // 00161 }; 00162 // ---------------------------------------------------------------------- 00163 // Part of the protocol is that we only transfer parameters which do not 00164 // have a default value. Thus the default values are part of the protocol. 00165 // ---------------------------------------------------------------------- 00166 00167 00168 00169 // FragmentType constants 00170 enum FragmentType { 00171 AllNodesSmallTable = 0, 00172 AllNodesMediumTable = 1, 00173 AllNodesLargeTable = 2, 00174 SingleFragment = 3, 00175 DistrKeyHash = 4, 00176 DistrKeyLin = 5, 00177 UserDefined = 6, 00178 DistrKeyUniqueHashIndex = 7, 00179 DistrKeyOrderedIndex = 8 00180 }; 00181 00182 // TableType constants + objects 00183 enum TableType { 00184 UndefTableType = 0, 00185 SystemTable = 1, 00186 UserTable = 2, 00187 UniqueHashIndex = 3, 00188 HashIndex = 4, 00189 UniqueOrderedIndex = 5, 00190 OrderedIndex = 6, 00191 // constant 10 hardcoded in Dbdict.cpp 00192 HashIndexTrigger = 11, 00193 SubscriptionTrigger = 16, 00194 ReadOnlyConstraint = 17, 00195 IndexTrigger = 18, 00196 00197 Tablespace = 20, 00198 LogfileGroup = 21, 00199 Datafile = 22, 00200 Undofile = 23 00201 }; 00202 00203 // used 1) until type BlobTable added 2) in upgrade code 00204 static bool 00205 isBlobTableName(const char* name, Uint32* ptab_id = 0, Uint32* pcol_no = 0); 00206 00207 static inline bool 00208 isTable(int tableType) { 00209 return 00210 tableType == SystemTable || 00211 tableType == UserTable; 00212 } 00213 static inline bool 00214 isIndex(int tableType) { 00215 return 00216 tableType == UniqueHashIndex || 00217 tableType == HashIndex || 00218 tableType == UniqueOrderedIndex || 00219 tableType == OrderedIndex; 00220 } 00221 static inline bool 00222 isUniqueIndex(int tableType) { 00223 return 00224 tableType == UniqueHashIndex || 00225 tableType == UniqueOrderedIndex; 00226 } 00227 static inline bool 00228 isNonUniqueIndex(int tableType) { 00229 return 00230 tableType == HashIndex || 00231 tableType == OrderedIndex; 00232 } 00233 static inline bool 00234 isHashIndex(int tableType) { 00235 return 00236 tableType == UniqueHashIndex || 00237 tableType == HashIndex; 00238 } 00239 static inline bool 00240 isOrderedIndex(int tableType) { 00241 return 00242 tableType == UniqueOrderedIndex || 00243 tableType == OrderedIndex; 00244 } 00245 static inline bool 00246 isTrigger(int tableType) { 00247 return 00248 tableType == HashIndexTrigger || 00249 tableType == SubscriptionTrigger || 00250 tableType == ReadOnlyConstraint || 00251 tableType == IndexTrigger; 00252 } 00253 static inline bool 00254 isFilegroup(int tableType) { 00255 return 00256 tableType == Tablespace || 00257 tableType == LogfileGroup; 00258 } 00259 00260 static inline bool 00261 isFile(int tableType) { 00262 return 00263 tableType == Datafile|| 00264 tableType == Undofile; 00265 } 00266 00267 // Object state for translating from/to API 00268 enum ObjectState { 00269 StateUndefined = 0, 00270 StateOffline = 1, 00271 StateBuilding = 2, 00272 StateDropping = 3, 00273 StateOnline = 4, 00274 StateBackup = 5, 00275 StateBroken = 9 00276 }; 00277 00278 // Object store for translating from/to API 00279 enum ObjectStore { 00280 StoreUndefined = 0, 00281 StoreTemporary = 1, 00282 StorePermanent = 2 00283 }; 00284 00285 // AttributeSize constants 00286 STATIC_CONST( aBit = 0 ); 00287 STATIC_CONST( an8Bit = 3 ); 00288 STATIC_CONST( a16Bit = 4 ); 00289 STATIC_CONST( a32Bit = 5 ); 00290 STATIC_CONST( a64Bit = 6 ); 00291 STATIC_CONST( a128Bit = 7 ); 00292 00293 // Table data interpretation 00294 struct Table { 00295 char TableName[MAX_TAB_NAME_SIZE]; 00296 Uint32 TableId; 00297 char PrimaryTable[MAX_TAB_NAME_SIZE]; // Only used when "index" 00298 Uint32 PrimaryTableId; 00299 Uint32 TableLoggedFlag; 00300 Uint32 NoOfKeyAttr; 00301 Uint32 NoOfAttributes; 00302 Uint32 NoOfNullable; 00303 Uint32 NoOfVariable; 00304 Uint32 TableKValue; 00305 Uint32 MinLoadFactor; 00306 Uint32 MaxLoadFactor; 00307 Uint32 KeyLength; 00308 Uint32 FragmentType; 00309 Uint32 TableType; 00310 Uint32 TableVersion; 00311 Uint32 IndexState; 00312 Uint32 InsertTriggerId; 00313 Uint32 UpdateTriggerId; 00314 Uint32 DeleteTriggerId; 00315 Uint32 CustomTriggerId; 00316 Uint32 TablespaceId; 00317 Uint32 TablespaceVersion; 00318 Uint32 DefaultNoPartFlag; 00319 Uint32 LinearHashFlag; 00320 /* 00321 TODO RONM: 00322 We need to replace FRM, Fragment Data, Tablespace Data and in 00323 very particular RangeListData with dynamic arrays 00324 */ 00325 Uint32 FrmLen; 00326 char FrmData[MAX_FRM_DATA_SIZE]; 00327 Uint32 FragmentCount; 00328 Uint32 ReplicaDataLen; 00329 Uint16 ReplicaData[MAX_FRAGMENT_DATA_BYTES]; 00330 Uint32 FragmentDataLen; 00331 Uint16 FragmentData[3*MAX_NDB_PARTITIONS]; 00332 00333 Uint32 MaxRowsLow; 00334 Uint32 MaxRowsHigh; 00335 Uint32 MinRowsLow; 00336 Uint32 MinRowsHigh; 00337 00338 Uint32 TablespaceDataLen; 00339 Uint32 TablespaceData[2*MAX_NDB_PARTITIONS]; 00340 Uint32 RangeListDataLen; 00341 char RangeListData[4*2*MAX_NDB_PARTITIONS*2]; 00342 00343 Uint32 RowGCIFlag; 00344 Uint32 RowChecksumFlag; 00345 00346 Table() {} 00347 void init(); 00348 }; 00349 00350 static const 00351 SimpleProperties::SP2StructMapping TableMapping[]; 00352 00353 static const Uint32 TableMappingSize; 00354 00355 // AttributeExtType values 00356 enum ExtType { 00357 ExtUndefined = NdbSqlUtil::Type::Undefined, 00358 ExtTinyint = NdbSqlUtil::Type::Tinyint, 00359 ExtTinyunsigned = NdbSqlUtil::Type::Tinyunsigned, 00360 ExtSmallint = NdbSqlUtil::Type::Smallint, 00361 ExtSmallunsigned = NdbSqlUtil::Type::Smallunsigned, 00362 ExtMediumint = NdbSqlUtil::Type::Mediumint, 00363 ExtMediumunsigned = NdbSqlUtil::Type::Mediumunsigned, 00364 ExtInt = NdbSqlUtil::Type::Int, 00365 ExtUnsigned = NdbSqlUtil::Type::Unsigned, 00366 ExtBigint = NdbSqlUtil::Type::Bigint, 00367 ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned, 00368 ExtFloat = NdbSqlUtil::Type::Float, 00369 ExtDouble = NdbSqlUtil::Type::Double, 00370 ExtOlddecimal = NdbSqlUtil::Type::Olddecimal, 00371 ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned, 00372 ExtDecimal = NdbSqlUtil::Type::Decimal, 00373 ExtDecimalunsigned = NdbSqlUtil::Type::Decimalunsigned, 00374 ExtChar = NdbSqlUtil::Type::Char, 00375 ExtVarchar = NdbSqlUtil::Type::Varchar, 00376 ExtBinary = NdbSqlUtil::Type::Binary, 00377 ExtVarbinary = NdbSqlUtil::Type::Varbinary, 00378 ExtDatetime = NdbSqlUtil::Type::Datetime, 00379 ExtDate = NdbSqlUtil::Type::Date, 00380 ExtBlob = NdbSqlUtil::Type::Blob, 00381 ExtText = NdbSqlUtil::Type::Text, 00382 ExtBit = NdbSqlUtil::Type::Bit, 00383 ExtLongvarchar = NdbSqlUtil::Type::Longvarchar, 00384 ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary, 00385 ExtTime = NdbSqlUtil::Type::Time, 00386 ExtYear = NdbSqlUtil::Type::Year, 00387 ExtTimestamp = NdbSqlUtil::Type::Timestamp 00388 }; 00389 00390 // Attribute data interpretation 00391 struct Attribute { 00392 char AttributeName[MAX_TAB_NAME_SIZE]; 00393 Uint32 AttributeId; 00394 Uint32 AttributeType; // for osu 4.1->5.0.x 00395 Uint32 AttributeSize; 00396 Uint32 AttributeArraySize; 00397 Uint32 AttributeArrayType; 00398 Uint32 AttributeKeyFlag; 00399 Uint32 AttributeNullableFlag; 00400 Uint32 AttributeDKey; 00401 Uint32 AttributeExtType; 00402 Uint32 AttributeExtPrecision; 00403 Uint32 AttributeExtScale; 00404 Uint32 AttributeExtLength; 00405 Uint32 AttributeAutoIncrement; 00406 Uint32 AttributeStorageType; 00407 char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE]; 00408 00409 Attribute() {} 00410 void init(); 00411 00412 inline 00413 Uint32 sizeInWords() 00414 { 00415 return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5; 00416 } 00417 00418 // compute old-sty|e attribute size and array size 00419 inline bool 00420 translateExtType() { 00421 switch (AttributeExtType) { 00422 case DictTabInfo::ExtUndefined: 00423 return false; 00424 case DictTabInfo::ExtTinyint: 00425 case DictTabInfo::ExtTinyunsigned: 00426 AttributeSize = DictTabInfo::an8Bit; 00427 AttributeArraySize = AttributeExtLength; 00428 break; 00429 case DictTabInfo::ExtSmallint: 00430 case DictTabInfo::ExtSmallunsigned: 00431 AttributeSize = DictTabInfo::a16Bit; 00432 AttributeArraySize = AttributeExtLength; 00433 break; 00434 case DictTabInfo::ExtMediumint: 00435 case DictTabInfo::ExtMediumunsigned: 00436 AttributeSize = DictTabInfo::an8Bit; 00437 AttributeArraySize = 3 * AttributeExtLength; 00438 break; 00439 case DictTabInfo::ExtInt: 00440 case DictTabInfo::ExtUnsigned: 00441 AttributeSize = DictTabInfo::a32Bit; 00442 AttributeArraySize = AttributeExtLength; 00443 break; 00444 case DictTabInfo::ExtBigint: 00445 case DictTabInfo::ExtBigunsigned: 00446 AttributeSize = DictTabInfo::a64Bit; 00447 AttributeArraySize = AttributeExtLength; 00448 break; 00449 case DictTabInfo::ExtFloat: 00450 AttributeSize = DictTabInfo::a32Bit; 00451 AttributeArraySize = AttributeExtLength; 00452 break; 00453 case DictTabInfo::ExtDouble: 00454 AttributeSize = DictTabInfo::a64Bit; 00455 AttributeArraySize = AttributeExtLength; 00456 break; 00457 case DictTabInfo::ExtOlddecimal: 00458 AttributeSize = DictTabInfo::an8Bit; 00459 AttributeArraySize = 00460 (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * 00461 AttributeExtLength; 00462 break; 00463 case DictTabInfo::ExtOlddecimalunsigned: 00464 AttributeSize = DictTabInfo::an8Bit; 00465 AttributeArraySize = 00466 (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * 00467 AttributeExtLength; 00468 break; 00469 case DictTabInfo::ExtDecimal: 00470 case DictTabInfo::ExtDecimalunsigned: 00471 { 00472 // copy from Field_new_decimal ctor 00473 uint precision = AttributeExtPrecision; 00474 uint scale = AttributeExtScale; 00475 if (precision > DECIMAL_MAX_LENGTH || scale >= NOT_FIXED_DEC) 00476 precision = DECIMAL_MAX_LENGTH; 00477 uint bin_size = my_decimal_get_binary_size(precision, scale); 00478 AttributeSize = DictTabInfo::an8Bit; 00479 AttributeArraySize = bin_size * AttributeExtLength; 00480 } 00481 break; 00482 case DictTabInfo::ExtChar: 00483 case DictTabInfo::ExtBinary: 00484 AttributeSize = DictTabInfo::an8Bit; 00485 AttributeArraySize = AttributeExtLength; 00486 break; 00487 case DictTabInfo::ExtVarchar: 00488 case DictTabInfo::ExtVarbinary: 00489 if (AttributeExtLength > 0xff) 00490 return false; 00491 AttributeSize = DictTabInfo::an8Bit; 00492 AttributeArraySize = AttributeExtLength + 1; 00493 break; 00494 case DictTabInfo::ExtDatetime: 00495 // to fix 00496 AttributeSize = DictTabInfo::an8Bit; 00497 AttributeArraySize = 8 * AttributeExtLength; 00498 break; 00499 case DictTabInfo::ExtDate: 00500 // to fix 00501 AttributeSize = DictTabInfo::an8Bit; 00502 AttributeArraySize = 3 * AttributeExtLength; 00503 break; 00504 case DictTabInfo::ExtBlob: 00505 case DictTabInfo::ExtText: 00506 AttributeSize = DictTabInfo::an8Bit; 00507 // head + inline part (length in precision lower half) 00508 AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); 00509 break; 00510 case DictTabInfo::ExtBit: 00511 AttributeSize = DictTabInfo::aBit; 00512 AttributeArraySize = AttributeExtLength; 00513 break; 00514 case DictTabInfo::ExtLongvarchar: 00515 case DictTabInfo::ExtLongvarbinary: 00516 if (AttributeExtLength > 0xffff) 00517 return false; 00518 AttributeSize = DictTabInfo::an8Bit; 00519 AttributeArraySize = AttributeExtLength + 2; 00520 break; 00521 case DictTabInfo::ExtTime: 00522 AttributeSize = DictTabInfo::an8Bit; 00523 AttributeArraySize = 3 * AttributeExtLength; 00524 break; 00525 case DictTabInfo::ExtYear: 00526 AttributeSize = DictTabInfo::an8Bit; 00527 AttributeArraySize = 1 * AttributeExtLength; 00528 break; 00529 case DictTabInfo::ExtTimestamp: 00530 AttributeSize = DictTabInfo::an8Bit; 00531 AttributeArraySize = 4 * AttributeExtLength; 00532 break; 00533 default: 00534 return false; 00535 }; 00536 return true; 00537 } 00538 00539 inline void print(FILE *out) { 00540 fprintf(out, "AttributeId = %d\n", AttributeId); 00541 fprintf(out, "AttributeType = %d\n", AttributeType); 00542 fprintf(out, "AttributeSize = %d\n", AttributeSize); 00543 fprintf(out, "AttributeArraySize = %d\n", AttributeArraySize); 00544 fprintf(out, "AttributeArrayType = %d\n", AttributeArrayType); 00545 fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag); 00546 fprintf(out, "AttributeStorageType = %d\n", AttributeStorageType); 00547 fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag); 00548 fprintf(out, "AttributeDKey = %d\n", AttributeDKey); 00549 fprintf(out, "AttributeGroup = %d\n", AttributeGroup); 00550 fprintf(out, "AttributeAutoIncrement = %d\n", AttributeAutoIncrement); 00551 fprintf(out, "AttributeExtType = %d\n", AttributeExtType); 00552 fprintf(out, "AttributeExtPrecision = %d\n", AttributeExtPrecision); 00553 fprintf(out, "AttributeExtScale = %d\n", AttributeExtScale); 00554 fprintf(out, "AttributeExtLength = %d\n", AttributeExtLength); 00555 fprintf(out, "AttributeDefaultValue = \"%s\"\n", 00556 AttributeDefaultValue ? AttributeDefaultValue : ""); 00557 } 00558 }; 00559 00560 static const 00561 SimpleProperties::SP2StructMapping AttributeMapping[]; 00562 00563 static const Uint32 AttributeMappingSize; 00564 00565 // Signal constants 00566 STATIC_CONST( DataLength = 20 ); 00567 STATIC_CONST( HeaderLength = 5 ); 00568 00569 private: 00570 Uint32 senderRef; 00571 Uint32 senderData; 00572 Uint32 requestType; 00573 Uint32 totalLen; 00574 Uint32 offset; 00575 00581 Uint32 tabInfoData[DataLength]; 00582 00583 public: 00584 enum Depricated 00585 { 00586 AttributeDGroup = 1009, //Default NotDGroup 00587 AttributeStoredInd = 1011, //Default NotStored 00588 TableStorageVal = 14, //Disk storage specified per attribute 00589 SecondTableId = 17, //Mandatory between DICT's otherwise not allowed 00590 FragmentKeyTypeVal = 16 //Default PrimaryKey 00591 }; 00592 00593 enum Unimplemented 00594 { 00595 ScanOptimised = 15, //Default updateOptimised 00596 AttributeGroup = 1012, //Default 0 00597 FileNo = 102 00598 }; 00599 }; 00600 00601 #define DFGIMAP(x, y, z) \ 00602 { DictFilegroupInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 } 00603 00604 #define DFGIMAP2(x, y, z, u, v) \ 00605 { DictFilegroupInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 } 00606 00607 #define DFGIMAPS(x, y, z, u, v) \ 00608 { DictFilegroupInfo::y, offsetof(x, z), SimpleProperties::StringValue, u, v, 0 } 00609 00610 #define DFGIMAPB(x, y, z, u, v, l) \ 00611 { DictFilegroupInfo::y, offsetof(x, z), SimpleProperties::BinaryValue, u, v, \ 00612 offsetof(x, l) } 00613 00614 #define DFGIBREAK(x) \ 00615 { DictFilegroupInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 } 00616 00617 struct DictFilegroupInfo { 00618 enum KeyValues { 00619 FilegroupName = 1, 00620 FilegroupType = 2, 00621 FilegroupId = 3, 00622 FilegroupVersion = 4, 00623 00627 FileName = 100, 00628 FileType = 101, 00629 FileId = 103, 00630 FileFGroupId = 104, 00631 FileFGroupVersion = 105, 00632 FileSizeHi = 106, 00633 FileSizeLo = 107, 00634 FileFreeExtents = 108, 00635 FileVersion = 109, 00636 FileEnd = 199, // 00637 00641 TS_ExtentSize = 1000, // specified in bytes 00642 TS_LogfileGroupId = 1001, 00643 TS_LogfileGroupVersion = 1002, 00644 TS_GrowLimit = 1003, // In bytes 00645 TS_GrowSizeHi = 1004, 00646 TS_GrowSizeLo = 1005, 00647 TS_GrowPattern = 1006, 00648 TS_GrowMaxSize = 1007, 00649 00653 LF_UndoBufferSize = 2005, // In bytes 00654 LF_UndoGrowLimit = 2000, // In bytes 00655 LF_UndoGrowSizeHi = 2001, 00656 LF_UndoGrowSizeLo = 2002, 00657 LF_UndoGrowPattern = 2003, 00658 LF_UndoGrowMaxSize = 2004, 00659 LF_UndoFreeWordsHi = 2006, 00660 LF_UndoFreeWordsLo = 2007 00661 }; 00662 00663 // FragmentType constants 00664 enum FileTypeValues { 00665 Datafile = 0, 00666 Undofile = 1 00667 //, Redofile 00668 }; 00669 00670 struct GrowSpec { 00671 Uint32 GrowLimit; 00672 Uint32 GrowSizeHi; 00673 Uint32 GrowSizeLo; 00674 char GrowPattern[PATH_MAX]; 00675 Uint32 GrowMaxSize; 00676 }; 00677 00678 // Table data interpretation 00679 struct Filegroup { 00680 char FilegroupName[MAX_TAB_NAME_SIZE]; 00681 Uint32 FilegroupType; // ObjType 00682 Uint32 FilegroupId; 00683 Uint32 FilegroupVersion; 00684 00685 union { 00686 Uint32 TS_ExtentSize; 00687 Uint32 LF_UndoBufferSize; 00688 }; 00689 Uint32 TS_LogfileGroupId; 00690 Uint32 TS_LogfileGroupVersion; 00691 union { 00692 GrowSpec TS_DataGrow; 00693 GrowSpec LF_UndoGrow; 00694 }; 00695 //GrowSpec LF_RedoGrow; 00696 Uint32 LF_UndoFreeWordsHi; 00697 Uint32 LF_UndoFreeWordsLo; 00698 Filegroup() {} 00699 void init(); 00700 }; 00701 static const Uint32 MappingSize; 00702 static const SimpleProperties::SP2StructMapping Mapping[]; 00703 00704 struct File { 00705 char FileName[PATH_MAX]; 00706 Uint32 FileType; 00707 Uint32 FileId; 00708 Uint32 FileVersion; 00709 Uint32 FilegroupId; 00710 Uint32 FilegroupVersion; 00711 Uint32 FileSizeHi; 00712 Uint32 FileSizeLo; 00713 Uint32 FileFreeExtents; 00714 00715 File() {} 00716 void init(); 00717 }; 00718 static const Uint32 FileMappingSize; 00719 static const SimpleProperties::SP2StructMapping FileMapping[]; 00720 }; 00721 00722 #endif
1.4.7

