mariadb/storage/ndb/include/kernel/AttributeDescriptor.hpp
unknown ee740746af Import ndb varsize
BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829:
  Delete: storage/ndb/src/kernel/vm/MetaData.cpp
BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c:
  Delete: storage/ndb/src/kernel/vm/MetaData.hpp
BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42:
  Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp
BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d:
  Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp
BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9:
  Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp
storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp''
storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp''
storage/ndb/include/kernel/signaldata/CreateObj.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp''
storage/ndb/include/kernel/signaldata/DictObjOp.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp''
storage/ndb/include/kernel/signaldata/DropFilegroup.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp''
storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp''
storage/ndb/include/kernel/signaldata/DropObj.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp''
storage/ndb/include/kernel/signaldata/Extent.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp''
storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp''
storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp''
storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp''
storage/ndb/include/kernel/signaldata/RestoreImpl.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp''
storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp:
  New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp''
storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp''
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp''
storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp''
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp''
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp''
storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp''
storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp''
storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp''
storage/ndb/src/kernel/blocks/diskpage.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp''
storage/ndb/src/kernel/blocks/diskpage.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp''
storage/ndb/src/kernel/blocks/lgman.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp''
storage/ndb/src/kernel/blocks/lgman.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp''
storage/ndb/src/kernel/blocks/pgman.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp''
storage/ndb/src/kernel/blocks/pgman.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp''
storage/ndb/src/kernel/blocks/print_file.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp''
storage/ndb/src/kernel/blocks/restore.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp''
storage/ndb/src/kernel/blocks/restore.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp''
storage/ndb/src/kernel/blocks/tsman.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp''
storage/ndb/src/kernel/blocks/tsman.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp''
storage/ndb/src/kernel/vm/DLCFifoList.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp''
storage/ndb/src/kernel/vm/DLCHashTable.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp''
storage/ndb/src/kernel/vm/KeyTable2Ref.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp''
storage/ndb/src/kernel/vm/Rope.cpp:
  New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp''
storage/ndb/src/kernel/vm/Rope.hpp:
  New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00

236 lines
5.9 KiB
C++

/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef ATTRIBUTE_DESCRIPTOR_HPP
#define ATTRIBUTE_DESCRIPTOR_HPP
class AttributeDescriptor {
friend class Dbdict;
friend class Dbtc;
friend class Dbacc;
friend class Dbtup;
friend class Dbtux;
friend class Dblqh;
friend class SimulatedBlock;
public:
static void setType(Uint32 &, Uint32 type);
static void setSize(Uint32 &, Uint32 size);
static void setArrayType(Uint32 &, Uint32 arrayType);
static void setArraySize(Uint32 &, Uint32 arraySize);
static void setNullable(Uint32 &, Uint32 nullable);
static void setDKey(Uint32 &, Uint32 dkey);
static void setPrimaryKey(Uint32 &, Uint32 dkey);
static void setDynamic(Uint32 &, Uint32 dynamicInd);
static void setDiskBased(Uint32 &, Uint32 val);
static Uint32 getType(const Uint32 &);
static Uint32 getSize(const Uint32 &);
static Uint32 getSizeInBytes(const Uint32 &);
static Uint32 getSizeInWords(const Uint32 &);
static Uint32 getArrayType(const Uint32 &);
static Uint32 getArraySize(const Uint32 &);
static Uint32 getNullable(const Uint32 &);
static Uint32 getDKey(const Uint32 &);
static Uint32 getPrimaryKey(const Uint32 &);
static Uint32 getDynamic(const Uint32 &);
static Uint32 getDiskBased(const Uint32 &);
Uint32 m_data;
};
/**
*
* a = Array type - 2 Bits -> Max 3 (Bit 0-1)
* t = Attribute type - 5 Bits -> Max 31 (Bit 2-6)
* s = Attribute size - 3 Bits -> Max 7 (Bit 8-10)
* d = Disk based - 1 Bit 11
* n = Nullable - 1 Bit 12
* k = Distribution Key Ind - 1 Bit 13
* p = Primary key attribute - 1 Bit 14
* y = Dynamic attribute - 1 Bit 15
* z = Array size - 16 Bits -> Max 65535 (Bit 16-31)
*
* 1111111111222222222233
* 01234567890123456789012345678901
* aattttt sssdnkpyzzzzzzzzzzzzzzzz
* aattsss n d k pyzzzzzzzzzzzzzzzz [ old format ]
*
*/
#define AD_ARRAY_TYPE_SHIFT (0)
#define AD_ARRAY_TYPE_MASK (3)
#define AD_TYPE_SHIFT (2)
#define AD_TYPE_MASK (31)
#define AD_SIZE_SHIFT (8)
#define AD_SIZE_MASK (7)
#define AD_SIZE_IN_BYTES_SHIFT (3)
#define AD_SIZE_IN_WORDS_OFFSET (31)
#define AD_SIZE_IN_WORDS_SHIFT (5)
#define AD_DISK_SHIFT (11)
#define AD_NULLABLE_SHIFT (12)
#define AD_DISTR_KEY_SHIFT (13)
#define AD_PRIMARY_KEY (14)
#define AD_DYNAMIC (15)
#define AD_ARRAY_SIZE_SHIFT (16)
#define AD_ARRAY_SIZE_MASK (65535)
inline
void
AttributeDescriptor::setType(Uint32 & desc, Uint32 type){
assert(type <= AD_TYPE_MASK);
desc |= (type << AD_TYPE_SHIFT);
}
inline
void
AttributeDescriptor::setSize(Uint32 & desc, Uint32 size){
assert(size <= AD_SIZE_MASK);
desc |= (size << AD_SIZE_SHIFT);
}
inline
void
AttributeDescriptor::setArrayType(Uint32 & desc, Uint32 arrayType){
assert(arrayType <= AD_ARRAY_TYPE_MASK);
desc |= (arrayType << AD_ARRAY_TYPE_SHIFT);
}
inline
void
AttributeDescriptor::setArraySize(Uint32 & desc, Uint32 arraySize){
assert(arraySize <= AD_ARRAY_SIZE_MASK);
desc |= (arraySize << AD_ARRAY_SIZE_SHIFT);
}
inline
void
AttributeDescriptor::setNullable(Uint32 & desc, Uint32 nullable){
assert(nullable <= 1);
desc |= (nullable << AD_NULLABLE_SHIFT);
}
inline
void
AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){
assert(dkey <= 1);
desc |= (dkey << AD_DISTR_KEY_SHIFT);
}
inline
void
AttributeDescriptor::setPrimaryKey(Uint32 & desc, Uint32 dkey){
assert(dkey <= 1);
desc |= (dkey << AD_PRIMARY_KEY);
}
inline
void
AttributeDescriptor::setDynamic(Uint32 & desc, Uint32 dynamic){
assert(dynamic <= 1);
desc |= (dynamic << AD_DYNAMIC);
}
inline
void
AttributeDescriptor::setDiskBased(Uint32 & desc, Uint32 val)
{
assert(val <= 1);
desc |= (val << AD_DISK_SHIFT);
}
/**
* Getters
*/
inline
Uint32
AttributeDescriptor::getType(const Uint32 & desc){
return (desc >> AD_TYPE_SHIFT) & AD_TYPE_MASK;
}
inline
Uint32
AttributeDescriptor::getSize(const Uint32 & desc){
return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
}
inline
Uint32
AttributeDescriptor::getSizeInBytes(const Uint32 & desc){
return (getArraySize(desc) << getSize(desc))
>> AD_SIZE_IN_BYTES_SHIFT;
}
inline
Uint32
AttributeDescriptor::getSizeInWords(const Uint32 & desc){
return ((getArraySize(desc) << getSize(desc))
+ AD_SIZE_IN_WORDS_OFFSET)
>> AD_SIZE_IN_WORDS_SHIFT;
}
inline
Uint32
AttributeDescriptor::getArrayType(const Uint32 & desc){
return (desc >> AD_ARRAY_TYPE_SHIFT) & AD_ARRAY_TYPE_MASK;
}
inline
Uint32
AttributeDescriptor::getArraySize(const Uint32 & desc){
return (desc >> AD_ARRAY_SIZE_SHIFT) & AD_ARRAY_SIZE_MASK;
}
inline
Uint32
AttributeDescriptor::getNullable(const Uint32 & desc){
return (desc >> AD_NULLABLE_SHIFT) & 1;
}
inline
Uint32
AttributeDescriptor::getDKey(const Uint32 & desc){
return (desc >> AD_DISTR_KEY_SHIFT) & 1;
}
inline
Uint32
AttributeDescriptor::getPrimaryKey(const Uint32 & desc){
return (desc >> AD_PRIMARY_KEY) & 1;
}
inline
Uint32
AttributeDescriptor::getDynamic(const Uint32 & desc){
return (desc >> AD_DYNAMIC) & 1;
}
inline
Uint32
AttributeDescriptor::getDiskBased(const Uint32 & desc)
{
return (desc >> AD_DISK_SHIFT) & 1;
}
class NdbOut&
operator<<(class NdbOut&, const AttributeDescriptor&);
#endif