NullableArray overrides the Array methods allowing for null values in the array.
For an overview see page C++ Classes
NullableArray overrides all public methods of base class Array using the nullBitmap to determine which array elements have null values. The nullBitmap is an array of unsigned 64 bit integers whose set bits indicate elements having null values.
NullableArray(Array* payload, ScalarArray<uint64_t>* bitmap = NULL) Constructor taking an array argument payload and optional null bitmap McoSql::ValueRef getAt( size_t index ) Return the reference to the Value object at
index
returned by Array methodgetAt()
, orMcoSql::Null
if the corresponding bit in the nullBitmap is setMcoSql::Value *getCopyAt( size_t index ) Get a copy of the Value object at
index
returned by Array methodgetCopyAt()
, orMcoSql::Null
if the corresponding bit in the nullBitmap is set. Note that, when usinggetCopyAt()
, the application is responsible for explicitly freeing (deallocating) the copy.void setAt( size_t index, McoSql::Value* value) Set the array element at position index
tovalue
and clear the corresponding bit in the nullBitmap or, ifvalue
is null, set the corresponding bit in the nullBitmapValue * updateAt( int index ) This method throws an "Invalid Operation" exception; to change the value of an array element use method setAt()
size_t size() Return the number of elements in the allocated array void setSize(size_t newSize); Set the number of elements in the array to operate on. Note that the specified size must not exceed the size of the allocated array (returned by method size()
) and it is necessary to later restore it to the original value (by calling again methodsetSize()
) after the desired operation is completed; otherwise deallocation will be performed incorrectlyvoid getBody( void * dst, size_t offs, size_t len ) Return the specified number of elements len
from the array body to the bufferdst
returned by Array methodgetBody()
void setBody( void * src, size_t offs, size_t len ) Set the specified number of elements len
from the buffersrc
to the array body and, for null elements, set the corresponding bit in the nullBitmapsize_t getElemSize( void ) Return the size in bytes of an array element McoSql::Type getElemType() Return the type of the type of the array elements size_t toString( char * buf , size_t & size ) Serialize the current Value to the specified buffer. Only size
bytes are copied (Note that if the terminating null does not fit in size bytes, the resulting buffer will NOT be null-terminated)Value * clone( McoSql::Allocator* allocator ) Create a copy of the array using the specified memory allocator
Array * getNullBitmap() Return the mullBitmap