#include <NdbOperation.hpp>
enum NdbOperation::Type |
Different access types (supported by sub-classes of NdbOperation)
virtual int NdbOperation::insertTuple | ( | ) | [virtual] |
Define the NdbOperation to be a standard operation of type insertTuple. When calling NdbTransaction::execute, this operation adds a new tuple to the table.
Reimplemented in NdbIndexOperation.
virtual int NdbOperation::updateTuple | ( | ) | [virtual] |
Define the NdbOperation to be a standard operation of type updateTuple. When calling NdbTransaction::execute, this operation updates a tuple in the table.
Reimplemented in NdbIndexOperation.
virtual int NdbOperation::writeTuple | ( | ) | [virtual] |
Define the NdbOperation to be a standard operation of type writeTuple. When calling NdbTransaction::execute, this operation writes a tuple to the table. If the tuple exists, it updates it, otherwise an insert takes place.
virtual int NdbOperation::deleteTuple | ( | ) | [virtual] |
Define the NdbOperation to be a standard operation of type deleteTuple. When calling NdbTransaction::execute, this operation delete a tuple.
Reimplemented in NdbIndexOperation.
virtual int NdbOperation::readTuple | ( | LockMode | ) | [virtual] |
Define the NdbOperation to be a standard operation of type readTuple. When calling NdbTransaction::execute, this operation reads a tuple.
Reimplemented in NdbIndexOperation.
int NdbOperation::equal | ( | const char * | anAttrName, | |
const char * | aValue, | |||
Uint32 | len = 0 | |||
) |
Define a search condition with equality. The condition is true if the attribute has the given value. To set search conditions on multiple attributes, use several equals (then all of them must be satisfied for the tuple to be selected).
There are 10 versions of equal() with slightly different parameters.
When using equal() with a string (char *) as second argument, the string needs to be padded with zeros in the following sense:
// Equal needs strings to be padded with zeros strncpy(buf, str, sizeof(buf)); NdbOperation->equal("Attr1", buf);
anAttrName | Attribute name | |
aValue | Attribute value. | |
len | Attribute length expressed in bytes. |
NdbRecAttr* NdbOperation::getValue | ( | const char * | anAttrName, | |
char * | aValue = 0 | |||
) |
Defines a retrieval operation of an attribute value. The NDB API allocate memory for the NdbRecAttr object that will hold the returned attribute value.
There are two versions of NdbOperation::getValue with slightly different parameters.
This method does not fetch the attribute value from the database! The NdbRecAttr object returned by this method is not readable/printable before the transaction has been executed with NdbTransaction::execute.
anAttrName | Attribute name | |
aValue | If this is non-NULL, then the attribute value will be returned in this parameter. If NULL, then the attribute value will only be stored in the returned NdbRecAttr object. |
virtual int NdbOperation::setValue | ( | const char * | anAttrName, | |
const char * | aValue, | |||
Uint32 | len = 0 | |||
) | [virtual] |
Define an attribute to set or update in query.
To set a NULL value, use the following construct:
setValue("ATTR_NAME", (char*)NULL);
There are a number of NdbOperation::setValue methods that take a certain type as input (pass by value rather than passing a pointer). As the interface is currently implemented it is the responsibility of the application programmer to use the correct types.
The NDB API will however check that the application sends a correct length to the interface as given in the length parameter. The passing of char* as the value can contain any type or any type of array. If length is not provided or set to zero, then the API will assume that the pointer is correct and not bother with checking it.
For insertTuple() it is not necessary to use setValue() on key attributes before other attributes.
There are 14 versions of NdbOperation::setValue with slightly different parameters.
anAttrName | Name (or Id) of attribute. | |
aValue | Attribute value to set. | |
len | Attribute length expressed in bytes. |
virtual NdbBlob* NdbOperation::getBlobHandle | ( | const char * | anAttrName | ) | [virtual] |
const NdbError& NdbOperation::getNdbError | ( | ) | const |
Get the latest error code.
int NdbOperation::getNdbErrorLine | ( | ) |
Get the method number where the error occured.
const char* NdbOperation::getTableName | ( | ) | const |
Get table name of this operation.
const NdbDictionary::Table* NdbOperation::getTable | ( | ) | const |
Get table object for this operation
const Type NdbOperation::getType | ( | ) | const |
Get the type of access for this operation
LockMode NdbOperation::getLockMode | ( | ) | const [inline] |
Return lock mode for operation