📄 ndboperation.hpp
字号:
*/ int incValue(const char* anAttrName, Uint32 aValue); int incValue(const char* anAttrName, Uint64 aValue); int incValue(Uint32 anAttrId, Uint32 aValue); int incValue(Uint32 anAttrId, Uint64 aValue); /** * Interpreted program instruction: * Subtract a value from an attribute in an interpreted operation. * * @note Destroys the contents of registers 6 and 7. * (The instruction uses these registers for its operation.) * * @note There are four versions of NdbOperation::subValue with * slightly different parameters. * * @param anAttrName Attribute name. * @param aValue Value to subtract. * @return -1 if unsuccessful. */ int subValue(const char* anAttrName, Uint32 aValue); int subValue(const char* anAttrName, Uint64 aValue); int subValue(Uint32 anAttrId, Uint32 aValue); int subValue(Uint32 anAttrId, Uint64 aValue); /** * Interpreted program instruction: * Define a jump label in an interpreted operation. * * @note The labels are automatically numbered starting with 0. * The parameter used by NdbOperation::def_label should * match the automatic numbering to make it easier to * debug the interpreted program. * * @param labelNumber Label number. * @return -1 if unsuccessful. */ int def_label(int labelNumber); /** * Interpreted program instruction: * Add two registers into a third. * * @param RegSource1 First register. * @param RegSource2 Second register. * @param RegDest Destination register where the result will be stored. * @return -1 if unsuccessful. */ int add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest); /** * Interpreted program instruction: * Substract RegSource2 from RegSource1 and put the result in RegDest. * * @param RegSource1 First register. * @param RegSource2 Second register. * @param RegDest Destination register where the result will be stored. * @return -1 if unsuccessful. */ int sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest); /** * Interpreted program instruction: * Load a constant into a register. * * @param RegDest Destination register. * @param Constant Value to load. * @return -1 if unsuccessful. */ int load_const_u32(Uint32 RegDest, Uint32 Constant); int load_const_u64(Uint32 RegDest, Uint64 Constant); /** * Interpreted program instruction: * Load NULL value into a register. * * @param RegDest Destination register. * @return -1 if unsuccessful. */ int load_const_null(Uint32 RegDest); /** * Interpreted program instruction: * Read an attribute into a register. * * @param anAttrName Attribute name. * @param RegDest Destination register. * @return -1 if unsuccessful. */ int read_attr(const char* anAttrName, Uint32 RegDest); /** * Interpreted program instruction: * Write an attribute from a register. * * @param anAttrName Attribute name. * @param RegSource Source register. * @return -1 if unsuccessful. */ int write_attr(const char* anAttrName, Uint32 RegSource); /** * Interpreted program instruction: * Read an attribute into a register. * * @param anAttrId the attribute id. * @param RegDest the destination register. * @return -1 if unsuccessful. */ int read_attr(Uint32 anAttrId, Uint32 RegDest); /** * Interpreted program instruction: * Write an attribute from a register. * * @param anAttrId the attribute id. * @param RegSource the source register. * @return -1 if unsuccessful. */ int write_attr(Uint32 anAttrId, Uint32 RegSource); /** * Interpreted program instruction: * Define a search condition. Last two letters in the function name * describes the search condition. * The condition compares RegR with RegL and therefore appears * to be reversed. * * - ge RegR >= RegL * - gt RegR > RegL * - le RegR <= RegL * - lt RegR < RegL * - eq RegR = RegL * - ne RegR <> RegL * * @param RegLvalue left value. * @param RegRvalue right value. * @param Label the label to jump to. * @return -1 if unsuccessful. */ int branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); int branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); int branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); int branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); int branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); int branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label); /** * Interpreted program instruction: * Jump to Label if RegLvalue is not NULL. * * @param RegLvalue the value to check. * @param Label the label to jump to. * @return -1 if unsuccessful. */ int branch_ne_null(Uint32 RegLvalue, Uint32 Label); /** * Interpreted program instruction: * Jump to Label if RegLvalue is equal to NULL. * * @param RegLvalue Value to check. * @param Label Label to jump to. * @return -1 if unsuccessful. */ int branch_eq_null(Uint32 RegLvalue, Uint32 Label); /** * Interpreted program instruction: * Jump to Label. * * @param Label Label to jump to. * @return -1 if unsuccessful. */ int branch_label(Uint32 Label); /** * Interpreted program instruction: branch after memcmp * @param ColId Column to check * @param Label Label to jump to * @return -1 if unsuccessful */ int branch_col_eq_null(Uint32 ColId, Uint32 Label); int branch_col_ne_null(Uint32 ColId, Uint32 Label); /** * Interpreted program instruction: branch after memcmp * @param ColId column to check * @param val search value * @param len length of search value * @param nopad force non-padded comparison for a Char column * @param Label label to jump to * @return -1 if unsuccessful */ int branch_col_eq(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); int branch_col_ne(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); int branch_col_lt(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); int branch_col_le(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); int branch_col_gt(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); int branch_col_ge(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label); /** * The argument is always plain char, even if the field is varchar * (changed in 5.0.22). */ int branch_col_like(Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label); int branch_col_notlike(Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label); /** * Interpreted program instruction: Exit with Ok * * For scanning transactions, * end interpreted operation and return the row to the application. * * For non-scanning transactions, * exit interpreted program. * * @return -1 if unsuccessful. */ int interpret_exit_ok(); /** * Interpreted program instruction: Exit with Not Ok * * For scanning transactions, * continue with the next row without returning the current row. * * For non-scanning transactions, * abort the whole transaction. * * @note A method also exists without the error parameter. * * @param ErrorCode An error code given by the application programmer. * @return -1 if unsuccessful. */ int interpret_exit_nok(Uint32 ErrorCode); int interpret_exit_nok(); /** * Interpreted program instruction: * * For scanning transactions, * return this row, but no more from this fragment * * For non-scanning transactions, * abort the whole transaction. * * @return -1 if unsuccessful. */ int interpret_exit_last_row(); /** * Interpreted program instruction: * Define a subroutine in an interpreted operation. * * @param SubroutineNumber the subroutine number. * @return -1 if unsuccessful. */ int def_subroutine(int SubroutineNumber); /** * Interpreted program instruction: * Call a subroutine. * * @param Subroutine the subroutine to call. * @return -1 if unsuccessful. */ int call_sub(Uint32 Subroutine); /** * Interpreted program instruction: * End a subroutine. * * @return -1 if unsuccessful. */ int ret_sub();#endif /** @} *********************************************************************/ /** * @name Error Handling * @{ */ /** * Get the latest error code. * * @return error code. */ const NdbError & getNdbError() const; /** * Get the method number where the error occured. * * @return method number where the error occured. */ int getNdbErrorLine(); /** * Get table name of this operation. */ const char* getTableName() const; /** * Get table object for this operation */ const NdbDictionary::Table * getTable() const; /** * Get the type of access for this operation */ const Type getType() const; /** @} *********************************************************************/#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL /** * Type of operation */ enum OperationType { ReadRequest = 0, ///< Read operation UpdateRequest = 1, ///< Update Operation InsertRequest = 2, ///< Insert Operation DeleteRequest = 3, ///< Delete Operation WriteRequest = 4, ///< Write Operation ReadExclusive = 5, ///< Read exclusive OpenScanRequest, ///< Scan Operation OpenRangeScanRequest, ///< Range scan operation NotDefined2, ///< Internal for debugging NotDefined ///< Internal for debugging };#endif /** * Return lock mode for operation */ LockMode getLockMode() const { return theLockMode; }#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL void setAbortOption(Int8 ao) { m_abortOption = ao; } /** * Set/get partition key */ void setPartitionId(Uint32 id); void setPartitionHash(Uint32 key); void setPartitionHash(const Uint64 *, Uint32 len); Uint32 getPartitionId() const;#endifprotected: int handle_distribution_key(const Uint64 *, Uint32 len);protected:/****************************************************************************** * These are the methods used to create and delete the NdbOperation objects. *****************************************************************************/ bool needReply();/****************************************************************************** * These methods are service routines used by the other NDB API classes. *****************************************************************************///--------------------------------------------------------------// Initialise after allocating operation to a transaction //-------------------------------------------------------------- int init(const class NdbTableImpl*, NdbTransaction* aCon); void initInterpreter(); NdbOperation(Ndb* aNdb, Type aType = PrimaryKeyAccess); virtual ~NdbOperation(); void next(NdbOperation*); // Set next pointer NdbOperation* next(); // Get next pointer public:#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL const NdbOperation* next() const; const NdbRecAttr* getFirstRecAttr() const;#endifprotected: enum OperationStatus { Init, OperationDefined, TupleKeyDefined, GetValue, SetValue, ExecInterpretedValue, SetValueInterpreted, FinalGetValue, SubroutineExec, SubroutineEnd, WaitResponse, WaitCommitResponse, Finished, ReceiveFinished }; OperationStatus Status(); // Read the status information void Status(OperationStatus); // Set the status information void NdbCon(NdbTransaction*); // Set reference to connection // object. virtual void release(); // Release all operations // connected to // the operations object. void setStartIndicator();/****************************************************************************** * The methods below is the execution part of the NdbOperation * class. This is where the NDB signals are sent and received. The * operation can send TC[KEY/INDX]REQ, [INDX]ATTRINFO. * It can receive TC[KEY/INDX]CONF, TC[KEY/INDX]REF, [INDX]ATTRINFO. * When an operation is received in its fulness or a refuse message * was sent, then the connection object is told about this situation. *****************************************************************************/ int doSend(int ProcessorId, Uint32 lastFlag);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -