Documentation Home
MySQL NDB Cluster API Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 3.7Mb
PDF (A4) - 3.7Mb


2.3.27 The Table Class

This section provides information about theTable class, which models a database table in the NDB API.

Table Class Overview

Parent class

NdbDictionary

Child classes

None

Description

TheTable class represents a table in an NDB Cluster database. This class extends theObject class, which in turn is an inner class of theNdbDictionary class.

It is possible using the NDB API to create tables independently of the MySQL server. However, it is usually not advisable to do so, since tables created in this fashion cannot be seen by the MySQL server. Similarly, it is possible usingTable methods to modify existing tables, but these changes (except for renaming tables) are not visible to MySQL.

Methods

The following table lists the public methods of this class and the purpose or use of each method:

Table 2.79 Table class methods and descriptions

NameDescription
Table()Class constructor
~Table()Destructor
addColumn()Adds a column to the table
aggregate()Computes aggregate data for the table
equal()Compares the table with another table
getColumn()Gets a column (by name) from the table
getDefaultNoPartitionsFlag()Checks whether the default number of partitions is being used
getFragmentCount()Gets the number of fragments for this table
getExtraMetadata()Gets extra metadata for this table
getForceVarPart()Whether the table is forced to allocate a variable part
getFragmentData()Gets table fragment data (ID, state, and node group)
getFragmentDataLen()Gets the length of the table fragment data
getFragmentNodes()Gets IDs of data nodes on which fragments are located
getFragmentType()Gets the table'sFragmentType
getFrmData()Gets the data from the table.FRM file; deprecated in NDB 8.0.27
getFrmLength()Gets the length of the table's.FRM file; deprecated in NDB 8.0.27
getHashMap()Gets the table's hash map.
getKValue()Gets the table'sKValue
getLinearFlag()Gets the current setting for the table's linear hashing flag
getLogging()Checks whether logging to disk is enabled for this table
getMaxLoadFactor()Gets the table's maximum load factor
getMaxRows()Gets the maximum number of rows that this table may contain
getMinLoadFactor()Gets the table's minimum load factor
getMinRows()Gets the minimum number of rows in the table (for calculating partitions)
getName()Gets the table's name
getNoOfAutoIncrementColumns()Gets the number of auto-increment columns in the table
getNoOfColumns()Gets the number of columns in the table
getNoOfPrimaryKeys()Gets the number of columns in the table's primary key
getObjectId()Gets the table's object ID
getObjectStatus()Gets the table's object status
getObjectType()Removed in NDB 7.5.0 (Bug #47960, Bug #11756088)
getObjectVersion()Gets the table's object version
getPartitionBalance()Gets partition balance (fragment count type) used for this table (NDB 7.5 and later)
getPartitionBalanceString()Gets partition balance used for this table, as a string (NDB 7.5 and later)
getPartitionId()Gets a partition ID from a hash value
getPrimaryKey()Gets the name of the table's primary key
getRangeListData()Gets aRANGE orLIST array
getRangeListDataLen()Gets the length of the tableRANGE orLIST array
getRowChecksumIndicator()Checks whether the row checksum indicator has been set
getRowGCIIndicator()Checks whether the row GCI indicator has been set
getRowGCIIndicator()Checks whether the row GCI indicator has been set
getRowSizeInBytes()Gets the size of a row of this table, in bytes
getSingleUserMode()Gets theSingleUserMode for this table
getTableId()Gets the table's ID
getTablespace()Gets the tablespace containing this table
getTablespaceData()Gets the ID and version of the tablespace containing the table
getTablespaceDataLen()Gets the length of the table's tablespace data
getTablespaceNames()Gets the names of the tablespaces used in the table fragments
hasDefaultValues()Determine whether table has any columns using default values
setDefaultNoPartitionsFlag()Toggles whether the default number of partitions should be used for the table
setExtraMetadata()Sets extra metadata for this table
setForceVarPart()Forces the table to allocate a variable part
getFragmentCount()Gets the number of fragments for this table
setFragmentData()Sets the fragment ID, node group ID, and fragment state
setFragmentType()Sets the table'sFragmentType
setFrm()Sets the.FRM file to be used for this table; deprecated in NDB 8.0.27
setHashMap()Sets the table's hash map.
setKValue()Set theKValue
setLinearFlag()Sets the table's linear hashing flag
setLogging()Toggle logging of the table to disk
setMaxLoadFactor()Set the table's maximum load factor (MaxLoadFactor)
setMaxRows()Sets the maximum number of rows in the table
setMinLoadFactor()Set the table's minimum load factor (MinLoadFactor)
setPartitionBalance()Sets the partition balance (fragment count type) for this table (NDB 7.5 and later)
setName()Sets the table's name
setObjectType()Removed in NDB 7.5.0 (Bug #47960, Bug #11756088)
setRangeListData()SetsLIST andRANGE partition data
setRowChecksumIndicator()Sets the row checksum indicator
setRowGCIIndicator()Sets the row GCI indicator
setSingleUserMode()Sets theSingleUserMode value for this table
setStatusInvalid()
setTablespace()Set the tablespace to use for this table
setTablespaceData()Sets the tablespace ID and version
setTablespaceNames()Sets the tablespace names for fragments
validate()Validates the definition for a new table prior to creating it

Types

TheTable class defines a single public typeSingleUserMode.

The assignment (=) operator is overloaded for this class, so that it always performs a deep copy.

As with other database objects,Table object creation and attribute changes to existing tables done using the NDB API are not visible from MySQL. For example, if you add a new column to a table usingTable::addColumn(), MySQL cannot see the new column. The only exception to this rule with regard to tables is that a change of name of an existingNDB table usingTable::setName() is visible to MySQL.

Calculating Table Sizes.  When calculating the data storage one should add the size of all attributes (each attribute consuming a minimum of 4 bytes) and well as 12 bytes overhead. Variable size attributes have a size of 12 bytes plus the actual data storage parts, with an additional overhead based on the size of the variable part. For example, consider a table with 5 attributes: one 64-bit attribute, one 32-bit attribute, two 16-bit attributes, and one array of 64 8-bit attributes. The amount of memory consumed per record by this table is the sum of the following:

  • 8 bytes for the 64-bit attribute

  • 4 bytes for the 32-bit attribute

  • 8 bytes for the two 16-bit attributes, each of these taking up 4 bytes due to right-alignment

  • 64 bytes for the array (64 * 1 byte per array element)

  • 12 bytes overhead

This totals 96 bytes per record. In addition, you should assume an overhead of about 2% for the allocation of page headers and wasted space. Thus, 1 million records should consume 96 MB, and the additional page header and other overhead comes to approximately 2 MB. Rounding up yields 100 MB.

Table::addColumn()

Description

Adds a column to a table.

Signature
void addColumn    (      const Column&column    )
Parameters

A reference to the column which is to be added to the table.

Return value

This method's return type isvoid, but it does create a copy of the originalColumn object.

Table::aggregate()

Description

This method computes aggregate data for the table. It is required in order for aggregate methods such asgetNoOfPrimaryKeys() to work properly before the table has been created and retrieved viagetTableId().

Signature
int aggregate    (      struct NdbError&error    )
Parameters

A reference to anNdbError object.

Return value

An integer, whose value is0 on success, and-1 if the table is in an inconsistent state. In the latter case, theerror is also set.

Table Constructor

Description

Creates aTable instance. There are two versions of theTable constructor, one for creating a new instance, and a copy constructor.

Tables created in the NDB API using this method are not accessible from MySQL.

Signature

New instance:

Table    (      const char*name = ""    )

Copy constructor:

Table    (      const Table&table    )
Parameters

For a new instance, the name of the table to be created. For a copy, a reference to the table to be copied.

Return value

ATable object.

Destructor
virtual ~Table()

Table::equal()

Description

This method is used to compare one instance ofTable with another.

Signature
bool equal    (      const Table&table    ) const
Parameters

A reference to theTable object with which the current instance is to be compared.

Return value

true if the two tables are the same, otherwisefalse.

Table::getColumn()

Description

This method is used to obtain a column definition, given either the index or the name of the column.

Signature

This method can be invoked using either the column ID or column name, as shown here:

Column* getColumn    (      const intAttributeId    )Column* getColumn    (      const char*name    )
Parameters

Either of: the column's index in the table (as it would be returned by the column'sgetColumnNo() method), or the name of the column.

Return value

A pointer to the column with the specified index or name. If there is no such column, then this method returnsNULL.

Table::getDefaultNoPartitionsFlag()

Description

This method is used to find out whether the default number of partitions is used for the table.

Signature
Uint32 getDefaultNoPartitionsFlag    (      void    ) const
Parameters

None.

Return value

A 32-bit unsigned integer.

Table::getExtraMetadata()

Description

Get and unpack extra metadata for this table.

This method was added in NDB 8.0.

Signature
int getExtraMetadata    (      Uint32&version,      void**data,      Uint32*length    ) const
Parameters

This method takes the following three parameters:

  • version: By convention, as used in NDB Cluster code,1 means that the extra metadata contains a.frm file (blob data) as in NDB 7.6 and earlier;2 indicates that it is serialized dictionary information as in NDB 8.0. The values are actually arbritrary, and application-specific.

  • data: The stored data retrieved as metadata.

  • length: The length of the stored data (metadata).

Return value

Returns0 on success, any other value on failure. A nonzer4o value should be interpreted as an error code for the type of error.

Table::getForceVarPart()

Description

Whether the table is forced to allocate a variable-size part, regardless of whether the table actually has any variable sized columns. This is needed to allow subsequent adding of columns to the table online (seeOnline Operations with ALTER TABLE in NDB Cluster).

Signature
bool getForceVarPart    (      void    ) const
Parameters

None.

Return value

true when the table is forced to allocate a variable size part.

Table::getFragmentCount()

Description

This method gets the number of fragments in the table.

Signature
Uint32 getFragmentCount    (      void    ) const
Parameters

None.

Return value

The number of table fragments, as a 32-bit unsigned integer.

Table::getFragmentData()

Description

This method gets the table's fragment data (ID, state, and node group).

Signature
const void* getFragmentData    (      void    ) const
Parameters

None.

Return value

A pointer to the data to be read.

Table::getFragmentDataLen()

Description

Gets the length of the table fragment data to be read, in bytes.

Signature
Uint32 getFragmentDataLen    (      void    ) const
Parameters

None.

Return value

The number of bytes to be read, as an unsigned 32-bit integer.

Table::getFragmentNodes()

Description

This method retrieves a list of nodes storing a given fragment.

Signature
Uint32 getFragmentNodes    (      Uint32fragmentId,      Uint32*nodeIdArrayPtr,      Uint32arraySize    ) const
Parameters

This method takes the following three parameters:

  • fragmentId: The ID of the desired fragment.

  • nodeIdArrayPtr: Pointer to an array of node IDs of the nodes containing this fragment.

    Note

    Normally, the primary fragment is entry 0 in this array.

  • arraySize: The size of the array containing the node IDs. If this is less than the number of fragments, then only the firstarraySize entries are written to this array.

Return value

A return value of0 indicates an error; otherwise, this is the number of table fragments, as a 32-bit unsigned integer.

Table::getFragmentType()

Description

This method gets the table's fragmentation type.

Signature
FragmentType getFragmentType    (      void    ) const
Parameters

None.

Return value

AnObject::FragmentType value.

Table::getFrmData()

Note

This feature is deprecated and should be avoided. It is subject to removal in a future version of NDB Cluster.

Description

Gets the data from the.FRM file associated with the table.

MySQL 8.0 and NDB 8.0 no longer use.FRM files but rather the MySQL data dictionary to store table metadata; thus this method is deprecated as of NDB 8.0.27, and subject to removal in a future NDB release. For reading and writing table metadata, usegetExtraMetadata() andsetExtraMetadata() instead.

Signature
const void* getFrmData    (      void    ) const
Parameters

None.

Return value

A pointer to the.FRM data.

Table::getFrmLength()

Note

This feature is deprecated and should be avoided. It is subject to removal in a future version of NDB Cluster.

Description

Gets the length of the table's.FRM file data, in bytes.

MySQL 8.0 and NDB 8.0 no longer use.FRM files but rather the MySQL data dictionary to store table metadata; thus this method is deprecated as of NDB 8.0.27, and subject to removal in a future NDB release. For reading and writing table metadata, usegetExtraMetadata() andsetExtraMetadata() instead.

Signature
Uint32 getFrmLength    (      void    ) const
Parameters

None.

Return value

The length of the.FRM file data (an unsigned 32-bit integer).

Table::getHashMap()

Description

Get the hash map used for this table.

Signature
bool getHashMap    (      Uint32*id = 0,      Uint32*version = 0    ) const
Parameters

The table ID and version.

Return value

True if the table has a hash map, otherwise false.

Table::getKValue()

Description

This method gets the KValue, a hashing parameter which is currently restricted to the value6. In a future release, it may become feasible to set this parameter to other values.

Signature
int getKValue    (      void    ) const
Parameters

None.

Return value

An integer (currently always6).

Table::getLinearFlag()

Description

This method retrieves the value of the table's linear hashing flag.

Signature
bool getLinearFlag    (      void    ) const
Parameters

None.

Return value

true if the flag is set, andfalse if it is not.

Table::getLogging()

Description

This class is used to check whether a table is logged to disk—that is, whether it is permanent or temporary.

Signature
bool getLogging    (      void    ) const
Parameters

None.

Return value

Returns a Boolean value. If this method returnstrue, then full checkpointing and logging are done on the table. Iffalse, then the table is a temporary table and is not logged to disk; in the event of a system restart the table still exists and retains its definition, but it will be empty. The default logging value istrue.

Table::getMaxLoadFactor()

Description

This method returns the load factor (a hashing parameter) when splitting of the containers in the local hash tables begins.

Signature
int getMaxLoadFactor    (      void    ) const
Parameters

None.

Return value

An integer whose maximum value is 100. When the maximum value is returned, this means that memory usage is optimised. Smaller values indicate that less data is stored in each container, which means that keys are found more quickly but more memory is consumed.

Table::getMaxRows()

Description

This method gets the maximum number of rows that the table can hold. This is used for calculating the number of partitions.

Signature
Uint64 getMaxRows    (      void    ) const
Parameters

None.

Return value

The maximum number of table rows, as a 64-bit unsigned integer.

Table::getMinLoadFactor()

Description

This method gets the value of the load factor when reduction of the hash table begins. This should always be less than the value returned bygetMaxLoadFactor().

Signature
int getMinLoadFactor    (      void    ) const
Parameters

None.

Return value

A percentage expressed as an integer; seeTable::getMaxLoadFactor().

Table::getMinRows()

Description

This method gets the minimum number of rows that the table can hold, for use in calculating the number of partitions.

Signature
Uint64 getMinRows    (      void    ) const
Parameters

None.

Return value

The minimum number of table rows, as a 64-bit unsigned integer.

Table:getName()

Description

Gets the name of a table.

Signature
const char* getName    (      void    ) const
Parameters

None.

Return value

The name of the table (a string).

Table::getNoOfAutoIncrementColumns()

Description

This method is used to obtain the number of auto-incrment columns in a table.

Signature
int getNoOfAutoIncrementColumns    (      void    ) const
Parameters

None.

Return value

An integer representing the number of auto-increment columns in the table.

Table::getNoOfColumns()

Description

This method is used to obtain the number of columns in a table.

Signature
int getNoOfColumns    (      void    ) const
Parameters

None.

Return value

An integer representing the number of columns in the table.

Table::getNoOfPrimaryKeys()

Description

This method finds the number of primary key columns in the table.

Signature
int getNoOfPrimaryKeys    (      void    ) const
Parameters

None.

Return value

An integer representing the number of primary key columns in the table.

Table::getObjectId()

Description

This method gets the table's object ID.

Signature
virtual int getObjectId    (      void    ) const
Parameters

None.

Return value

The object ID is returned as an integer.

Table::getObjectStatus()

Description

This method gets the table's status..

Signature
virtual Object::Status getObjectStatus    (      void    ) const
Parameters

None.

Return value

AnObject::Status value.

Table::getObjectType() (OBSOLETE)

Description

This method did not work as intended, and was removed in NDB 7.5.0 (Bug #47960, Bug #11756088).

Signature
Object::Type getObjectType    (      void    ) const
Parameters

None.

Return value

Returns anObject::Type value.

Table::getObjectVersion()

Description

This method gets the table's object version (seeNDB Schema Object Versions).

Signature
virtual int getObjectVersion    (      void    ) const
Parameters

None.

Return value

The table's object version, as an integer.

Table::getPartitionBalance()

Description

This method gets the table' partition balance scheme (fragment count type).

Prior to NDB 7.5, this method was known asgetFragmentCountType().

Signature
Object::PartitionBalance getPartitionBalance    (      void    ) const
Parameters

None.

Return value

The partition balancing scheme, as a value of typeObject::PartitionBalance.

Table::getPartitionBalanceString()

Description

This method gets the table' partition balance scheme (fragment count type), and returns it as a string.

Prior to NDB 7.5, this method was known asgetFragmentCountTypeString().

Signature
const char* getPartitionBalanceString    (      void    ) const
Parameters

None.

Return value

The partition balancing scheme, as a string value.

Table::getPartitionId()

Description

Gets a table partition ID, given its hash value.

Signature
Uint32 getPartitionId    (      Uint32hashvalue    ) const
Parameters

Ahashvalue. Note that if the table has not actually been retrieved (using, for example,getTableId()), then the result is likely not to be accurate or useful.

Return value

The identifier of the partition corresponding to thehashvalue.

Table::getPrimaryKey()

Description

This method is used to obtain the name of the table's primary key.

Signature
const char* getPrimaryKey    (      intno    ) const
Parameters

None.

Return value

The name of the primary key, a string (character pointer).

Table::getRangeListData()

Description

This method gets the range or list data associated with the table.

Signature
const void* getRangeListData    (      void    ) const
Parameters

None.

Return value

A pointer to the data.

Table::getRangeListDataLen()

Description

This method gets the size of the table's range or list array.

Signature
Uint32 getRangeListDataLen    (      void    ) const
Parameters

None.

Return value

The length of the list or range array, as an integer.

Table::getRowChecksumIndicator()

Description

Check whether the row checksum indicator has been set.

Signature
bool getRowChecksumIndicator    (      void    ) const
Parameters

None.

Return value

Atrue orfalse value.

Table::getRowGCIIndicator()

Description

Checks whether the row GCI indicator has been set.

Signature
bool getRowGCIIndicator    (      void    ) const
Parameters

None.

Return value

Atrue orfalse value.

Table::getRowSizeInBytes()

Description

Gets the size of a row in this table. This is the (maximum) amount of data that can be stored in a single row of the table, exclusive of any blob data stored external to the table.

Signature
int getRowSizeInBytes    (      void    ) const
Parameters

None.

Return value

The size of the row, in bytes.

Table::getSingleUserMode()

Description

Gets the single user mode of the table.

Signature
enum SingleUserMode getSingleUserMode    (      void    ) const
Parameters

None.

Return value

ASingleUserMode value.

Table::getTableId()

Description

This method gets a table's ID.

Signature
int getTableId    (      void    ) const
Parameters

None.

Return value

The table ID, as an integer.

Table::getTablespace()

Description

This method is used in two ways: to obtain the name of the tablespace to which this table is assigned; to verify that a given tablespace is the one being used by this table.

Signatures

To obtain the name of the tablespace, invoke without any arguments:

const char* getTablespace    (      void    ) const

To determine whether the tablespace is the one indicated by the given ID and version, supply these as arguments, as shown here:

bool getTablespace    (      Uint32*id      = 0,      Uint32*version = 0    ) const
Parameters

The number and types of parameters depend on how this method is being used:

  1. When used to obtain the name of the tablespace in use by the table, it is called without any arguments.

  2. When used to determine whether the given tablespace is the one being used by this table, then getTablespace() takes two parameters:

    • The tablespaceid, given as a pointer to a 32-bit unsigned integer

    • The tablespaceversion, also given as a pointer to a 32-bit unsigned integer

    The default value for bothid andversion is0.

Return value

The return type depends on how the method is called:

  1. WhengetTablespace() is called without any arguments, it returns aTablespace object instance.

  2. When called with two arguments, it returnstrue if the tablespace is the same as the one having the ID and version indicated; otherwise, it returnsfalse.

Table::getTablespaceData()

Description

This method gets the table's tablespace data (ID and version).

Signature
const void* getTablespaceData    (      void    ) const
Parameters

None.

Return value

A pointer to the data.

Table::getTablespaceDataLen()

Description

This method is used to get the length of the table's tablespace data.

Signature
Uint32 getTablespaceDataLen    (      void    ) const
Parameters

None.

Return value

The length of the data, as a 32-bit unsigned integer.

Table::getTablespaceNames()

Description

This method gets a pointer to the names of the tablespaces used in the table fragments.

Signature
const void* getTablespaceNames    (      void    )
Parameters

None.

Return value

Returns a pointer to the tablespace name data.

Table::getTablespaceNamesLen()

Description

This method gets the length of the tablespace name data returned bygetTablespaceNames(). (SeeTable::getTablespaceNames().)

Signature
Uint32 getTablespaceNamesLen    (      void    ) const
Parameters

None.

Return value

Returns the length of the name data, in bytes, as a 32-but unsigned integer.

Table::hasDefaultValues()

Description

Used to determine whether the table has any columns that are defined with default values other thanNULL.

To read and write default column values, useColumn::getDefaultValue() andColumn::setDefaultValue().

Signature
bool hasDefaultValues    (      void    ) const
Parameters

None.

Return value

Returnstrue if the table has any non-NULL columns with default values, otherwisefalse.

Table::setDefaultNoPartitionsFlag()

Description

This method sets an indicator that determines whether the default number of partitions is used for the table.

Signature
void setDefaultNoPartitionsFlag    (      Uint32indicator    ) const
Parameters

This method takes a single argumentindicator, a 32-bit unsigned integer.

Return value

None.

Table::setExtraMetadata()

Description

Store packed extra metadata for this table. The data is packed without any modification into the buffer of the givenTable object.

Added in NDB 8.0.

Signature
int setExtraMetadata    (      Uint32version,      const void*data,      Uint32length    )
Parameters

The three parameters used by this method are listed here:

  • version: As used in NDB Cluster code,1 means that the extra metadata contains a.frm file (blob data) as in NDB 7.6 and earlier;2 indicates that it is serialized dictionary information as in NDB 8.0. You should be aware that this is merely a convention, and the values can be application-specific, as desired.

  • data: The actual data to be stored as metadata.

  • length: The length of the data to be stored.

Return value

0 on success. Any other value indicates failure; in this case, the value is an error code indicating indicating the type of error.

Table::setForceVarPart()

Description

Forces the table to allocate a variable sized part, to permit online operations on the table even when it has no variable sized columns. SeeOnline Operations with ALTER TABLE in NDB Cluster, for more information about online operations in NDB Cluster.

Signature
void setForceVarPart    (      boolforce    )
Parameters

Use withforce set totrue to cause the table to have a variable size part.

Return value

None.

Table::setFragmentCount()

Description

Sets the number of table fragments.

Signature
void setFragmentCount    (      Uint32count    )
Parameters

count is the number of fragments to be used for the table.

Return value

None.

Table::setFragmentData()

Description

This method writes an array containing the following fragment information:

  • Fragment ID

  • Node group ID

  • Fragment State

Signature
void setFragmentData    (      const void*data,      Uint32len    )
Parameters

This method takes the following two parameters:

  • A pointer to the fragment data to be written

  • The length (len) of this data, in bytes, as a 32-bit unsigned integer

Return value

None.

Table::setFragmentType()

Description

This method sets the table's fragmentation type.

Signature
void setFragmentType    (      FragmentTypefragmentType    )
Parameters

This method takes one argument, anObject::FragmentType value.

Return value

None.

Table::setFrm()

Note

This feature is deprecated and should be avoided. It is subject to removal in a future version of NDB Cluster.

Description

This method is used to write data to this table's.FRM file.

MySQL 8.0 and NDB 8.0 no longer use.FRM files but rather the MySQL data dictionary to store table metadata; thus this method is deprecated as of NDB 8.0.27, and subject to removal in a future NDB release. For reading and writing table metadata, usegetExtraMetadata() andsetExtraMetadata() instead.

Signature
void setFrm    (      const void*data,      Uint32len    )
Parameters

This method takes the following two arguments:

  • A pointer to thedata to be written.

  • The length (len) of the data.

Return value

None.

Table::setHashMap()

Description

Set a hash map for the table.

Signature
int setHashMap    (      const class HashMap &    )
Parameters

A reference to the hash map.

Return value

Returns 0 on success; on failure, returns -1 and sets error.

Table::setKValue()

Description

This sets theKValue, a hashing parameter.

Signature
void setKValue    (      intkValue    )
Parameters

kValue is an integer. Currently the only permitted value is6. In a future version this may become a variable parameter.

Return value

None.

Table::setLinearFlag()

Description

Set the table's linear hash flag. SeeTable::getLinearFlag().

Signature
void setLinearFlag    (      Uint32flag    )
Parameters

Theflag is a 32-bit unsigned integer.

Return value

None.

Table::setLogging()

Description

Toggles the table's logging state. SeeTable::getLogging().

Signature
void setLogging    (      boolenable    )
Parameters

Ifenable istrue, then logging for this table is enabled; if it isfalse, then logging is disabled.

Return value

None.

Table::setMaxLoadFactor()

Description

This method sets the maximum load factor when splitting the containers in the local hash tables.

Signature
void setMaxLoadFactor    (      intmax    )
Parameters

This method takes a single parametermax, an integer representation of a percentage (for example,45 represents 45 percent). For more information, seeTable::getMaxLoadFactor().

This should never be greater than the minimum load factor.

Return value

None.

Table::setMaxRows()

Description

This method sets the maximum number of rows that can be held by the table.

Signature
void setMaxRows    (      Uint64maxRows    )
Parameters

maxRows is a 64-bit unsigned integer that represents the maximum number of rows to be held in the table.

Return value

None.

Table::setMinLoadFactor()

Description

This method sets the minimum load factor when reduction of the hash table begins.

Signature
void setMinLoadFactor    (      intmin    )
Parameters

This method takes a single parametermin, an integer representation of a percentage (for example,45 represents 45 percent). For more information, seeTable::getMinLoadFactor().

Return value

None.

Table::setName()

Description

This method sets the name of the table.

This is the onlyset*() method ofTable whose effects are visible to MySQL.

Signature
void setName    (      const char*name    )
Parameters

name is the (new) name of the table.

Return value

None.

Table::setObjectType() (OBSOLETE)

Description

This method did not work as intended, and was removed in NDB 7.5.0 (Bug #47960, Bug #11756088).

Signature
void setObjectType    (      Object::Typetype    )
Parameters

The desired objecttype. This must be one of theType values listed inObject::Type.

Return value

None.

Table::setPartitionBalance()

Description

Sets the table's partition balancing scheme.

Prior to NDB 7.5, this method was known assetFragmentCountType().

Signature
void setPartitionBalance    (      Object::PartitionBalancescheme    )
Parameters

scheme is the partition balancing scheme to be used for the table. This is a value of typePartitionBalance.

Return value

None.

Table::setRangeListData()

Description

This method sets an array containing information that maps range values and list values to fragments. This is essentially a sorted map consisting of fragment-ID/value pairs. For range partitions there is one pair per fragment. For list partitions it could be any number of pairs, but at least as many pairs as there are fragments.

Signature
void setRangeListData    (      const void*data,      Uint32len    )
Parameters

This method requires the following two parameters:

  • A pointer to the range or listdata containing the ID/value pairs

  • The length (len) of this data, as a 32-bit unsigned integer.

Return value

None.

Table::setRowChecksumIndicator()

Description

Set the row checksum indicator.

Signature
void setRowChecksumIndicator    (      boolvalue    ) const
Parameters

Atrue orfalsevalue.

Return value

None.

Table::setRowGCIIndicator()

Description

Sets the row GCI indicator.

Signature
void setRowGCIIndicator    (      boolvalue    ) const
Parameters

Atrue orfalsevalue.

Return value

None.

Table::setSingleUserMode()

Description

Sets aSingleUserMode for the table.

Signature
void setSingleUserMode    (      enumSingleUserMode    )
Parameters

ASingleUserMode value.

Return value

None.

Table::setStatusInvalid()

Description

Forces the table's status to be invalidated.

Signature
void setStatusInvalid    (      void    ) const
Parameters

None.

Return value

None.

Table::setTablespace()

Description

This method sets the tablespace for the table.

SeeSection 2.3.28, “The Tablespace Class”.

Signatures

Using the name of the tablespace:

void setTablespace    (      const char*name    )

Using aTablespace object:

void setTablespace    (      const class Tablespace&tablespace    )
Parameters

This method can be called with a single argument, which can be of either one of these two types:

  • Thename of the tablespace (a string).

  • A reference to an existingTablespace instance.

Return value

None.

Table::setTablespaceData()

Description

This method sets the tablespace information for each fragment, and includes a tablespace ID and a tablespace version.

Signature
void setTablespaceData    (      const void*data,      Uint32len    )
Parameters

This method requires the following two parameters:

  • A pointer to thedata containing the tablespace ID and version

  • The length (len) of this data, as a 32-bit unsigned integer.

Return value

None.

Table::setTablespaceNames()

Description

Sets the names of the tablespaces used by the table fragments.

Signature
void setTablespaceNames    (      const void*data      Uint32len    )
Parameters

This method takes the following two parameters:

  • A pointer to the tablespace namesdata

  • The length (len) of the names data, as a 32-bit unsigned integer.

Return value

None.

Table::SingleUserMode

This section provides information about theSingleUserMode data type.

Description

SingleUserMode specifies access rights to the table when single user mode is in effect.

Enumeration values

Possible values forSingleUserMode are shown, along with descriptions, in the following table:

Table 2.80 Table::SingleUserMode values and descriptions

NameDescription
SingleUserModeLockedThe table is locked (unavailable).
SingleUserModeReadOnlyThe table is available in read-only mode.
SingleUserModeReadWriteThe table is available in read-write mode.

Table::validate()

Description

This method validates the definition for a new table prior to creating it, executes theTable::aggregate() method, and performs additional checks.validate() is called automatically when a table is created or retrieved. For this reason, it is usually not necessary to callaggregate() orvalidate() directly.

You should be aware that, even after thevalidate() method is called, there may still exist errors which can be detected only by theNDB kernel when the table is actually created.

Signature
int validate    (      struct NdbError&error    )
Parameters

A reference to anNdbError object.

Return value

An integer, whose value is0 on success, and-1 if the table is in an inconsistent state. In the latter case, theerror is also set.