📄 dicttabinfo.hpp
字号:
Uint32 CustomTriggerId; Uint32 FrmLen; char FrmData[MAX_FRM_DATA_SIZE]; Uint32 FragmentCount; Uint32 FragmentDataLen; Uint16 FragmentData[(MAX_FRAGMENT_DATA_BYTES+1)/2]; void init(); }; static const SimpleProperties::SP2StructMapping TableMapping[]; static const Uint32 TableMappingSize; // AttributeExtType values enum ExtType { ExtUndefined = NdbSqlUtil::Type::Undefined, ExtTinyint = NdbSqlUtil::Type::Tinyint, ExtTinyunsigned = NdbSqlUtil::Type::Tinyunsigned, ExtSmallint = NdbSqlUtil::Type::Smallint, ExtSmallunsigned = NdbSqlUtil::Type::Smallunsigned, ExtMediumint = NdbSqlUtil::Type::Mediumint, ExtMediumunsigned = NdbSqlUtil::Type::Mediumunsigned, ExtInt = NdbSqlUtil::Type::Int, ExtUnsigned = NdbSqlUtil::Type::Unsigned, ExtBigint = NdbSqlUtil::Type::Bigint, ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned, ExtFloat = NdbSqlUtil::Type::Float, ExtDouble = NdbSqlUtil::Type::Double, ExtOlddecimal = NdbSqlUtil::Type::Olddecimal, ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned, ExtDecimal = NdbSqlUtil::Type::Decimal, ExtDecimalunsigned = NdbSqlUtil::Type::Decimalunsigned, ExtChar = NdbSqlUtil::Type::Char, ExtVarchar = NdbSqlUtil::Type::Varchar, ExtBinary = NdbSqlUtil::Type::Binary, ExtVarbinary = NdbSqlUtil::Type::Varbinary, ExtDatetime = NdbSqlUtil::Type::Datetime, ExtDate = NdbSqlUtil::Type::Date, ExtBlob = NdbSqlUtil::Type::Blob, ExtText = NdbSqlUtil::Type::Text, ExtBit = NdbSqlUtil::Type::Bit, ExtLongvarchar = NdbSqlUtil::Type::Longvarchar, ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary, ExtTime = NdbSqlUtil::Type::Time, ExtYear = NdbSqlUtil::Type::Year, ExtTimestamp = NdbSqlUtil::Type::Timestamp }; // Attribute data interpretation struct Attribute { char AttributeName[MAX_TAB_NAME_SIZE]; Uint32 AttributeId; Uint32 AttributeType; // for osu 4.1->5.0.x Uint32 AttributeSize; Uint32 AttributeArraySize; Uint32 AttributeKeyFlag; Uint32 AttributeNullableFlag; Uint32 AttributeDKey; Uint32 AttributeExtType; Uint32 AttributeExtPrecision; Uint32 AttributeExtScale; Uint32 AttributeExtLength; Uint32 AttributeAutoIncrement; char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE]; void init(); inline Uint32 sizeInWords() { return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5; } // compute old-sty|e attribute size and array size inline bool translateExtType() { switch (AttributeExtType) { case DictTabInfo::ExtUndefined: return false; case DictTabInfo::ExtTinyint: case DictTabInfo::ExtTinyunsigned: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtSmallint: case DictTabInfo::ExtSmallunsigned: AttributeSize = DictTabInfo::a16Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtMediumint: case DictTabInfo::ExtMediumunsigned: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 3 * AttributeExtLength; break; case DictTabInfo::ExtInt: case DictTabInfo::ExtUnsigned: AttributeSize = DictTabInfo::a32Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtBigint: case DictTabInfo::ExtBigunsigned: AttributeSize = DictTabInfo::a64Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtFloat: AttributeSize = DictTabInfo::a32Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtDouble: AttributeSize = DictTabInfo::a64Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtOlddecimal: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * AttributeExtLength; break; case DictTabInfo::ExtOlddecimalunsigned: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * AttributeExtLength; break; case DictTabInfo::ExtDecimal: case DictTabInfo::ExtDecimalunsigned: { // copy from Field_new_decimal ctor uint precision = AttributeExtPrecision; uint scale = AttributeExtScale; if (precision > DECIMAL_MAX_LENGTH || scale >= NOT_FIXED_DEC) precision = DECIMAL_MAX_LENGTH; uint bin_size = my_decimal_get_binary_size(precision, scale); AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = bin_size * AttributeExtLength; } break; case DictTabInfo::ExtChar: case DictTabInfo::ExtBinary: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtVarchar: case DictTabInfo::ExtVarbinary: if (AttributeExtLength > 0xff) return false; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = AttributeExtLength + 1; break; case DictTabInfo::ExtDatetime: // to fix AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 8 * AttributeExtLength; break; case DictTabInfo::ExtDate: // to fix AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 3 * AttributeExtLength; break; case DictTabInfo::ExtBlob: case DictTabInfo::ExtText: AttributeSize = DictTabInfo::an8Bit; // head + inline part (length in precision lower half) AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); break; case DictTabInfo::ExtBit: AttributeSize = DictTabInfo::aBit; AttributeArraySize = AttributeExtLength; break; case DictTabInfo::ExtLongvarchar: case DictTabInfo::ExtLongvarbinary: if (AttributeExtLength > 0xffff) return false; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = AttributeExtLength + 2; break; case DictTabInfo::ExtTime: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 3 * AttributeExtLength; break; case DictTabInfo::ExtYear: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 1 * AttributeExtLength; break; case DictTabInfo::ExtTimestamp: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 4 * AttributeExtLength; break; default: return false; }; return true; } inline void print(FILE *out) { fprintf(out, "AttributeId = %d\n", AttributeId); fprintf(out, "AttributeType = %d\n", AttributeType); fprintf(out, "AttributeSize = %d\n", AttributeSize); fprintf(out, "AttributeArraySize = %d\n", AttributeArraySize); fprintf(out, "AttributeKeyFlag = %d\n", AttributeKeyFlag); fprintf(out, "AttributeStorage = %d\n", AttributeStorage); fprintf(out, "AttributeNullableFlag = %d\n", AttributeNullableFlag); fprintf(out, "AttributeDKey = %d\n", AttributeDKey); fprintf(out, "AttributeGroup = %d\n", AttributeGroup); fprintf(out, "AttributeAutoIncrement = %d\n", AttributeAutoIncrement); fprintf(out, "AttributeExtType = %d\n", AttributeExtType); fprintf(out, "AttributeExtPrecision = %d\n", AttributeExtPrecision); fprintf(out, "AttributeExtScale = %d\n", AttributeExtScale); fprintf(out, "AttributeExtLength = %d\n", AttributeExtLength); fprintf(out, "AttributeDefaultValue = \"%s\"\n", AttributeDefaultValue ? AttributeDefaultValue : ""); } }; static const SimpleProperties::SP2StructMapping AttributeMapping[]; static const Uint32 AttributeMappingSize; // Signal constants STATIC_CONST( DataLength = 20 ); STATIC_CONST( HeaderLength = 5 );private: Uint32 senderRef; Uint32 senderData; Uint32 requestType; Uint32 totalLen; Uint32 offset; /** * Length of this data = signal->length() - HeaderLength * Sender block ref = signal->senderBlockRef() */ Uint32 tabInfoData[DataLength];public: enum Depricated { AttributeDGroup = 1009, //Default NotDGroup AttributeStoredInd = 1011, //Default NotStored SecondTableId = 17, //Mandatory between DICT's otherwise not allowed FragmentKeyTypeVal = 16 //Default PrimaryKey }; enum Unimplemented { TableStorageVal = 14, //Default StorageType::MainMemory ScanOptimised = 15, //Default updateOptimised AttributeGroup = 1012 //Default 0 };};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -