17 #ifndef NdbQueryOperationImpl_H
18 #define NdbQueryOperationImpl_H
20 #include "NdbQueryOperation.hpp"
21 #include "NdbQueryBuilderImpl.hpp"
22 #include "NdbIndexScanOperation.hpp"
23 #include <NdbError.hpp>
24 #include <ndb_limits.h>
58 int init(Uint32 maxObjs);
70 static const char endMarker = -15;
73 const size_t m_objSize;
104 const NdbQueryDefImpl& queryDef);
148 int close(
bool forceSend);
156 {
return m_transaction; }
158 const NdbError& getNdbError()
const;
181 int doSend(
int aNodeId,
bool lastFlag);
184 {
return m_interface; }
211 {
return (m_state == Closed);
221 m_startIndicator =
true;
232 m_commitIndicator =
true;
248 {
return m_rootFragCount; }
251 {
return m_resultStreamAlloc; }
254 {
return m_tupleSetAlloc; }
257 {
return m_rowBufferAlloc; }
265 FetchResult_gotError = -4,
266 FetchResult_sendFail = -3,
267 FetchResult_nodeFail = -2,
268 FetchResult_timeOut = -1,
270 FetchResult_noMoreData = 1,
271 FetchResult_noMoreCache = 2
281 class OrderedFragSet{
284 static const Uint32 pointersPerFragment = 2;
286 explicit OrderedFragSet();
339 int m_activeFragCount;
341 int m_fetchMoreFragCount;
346 int m_finalFragCount;
376 bool verifySortOrder()
const;
379 OrderedFragSet(
const OrderedFragSet&);
380 OrderedFragSet& operator=(
const OrderedFragSet&);
405 const NdbQueryDefImpl* m_queryDef;
428 Uint32 m_countOperations;
433 Uint32 m_globalCursor;
438 Uint32 m_pendingFrags;
442 Uint32 m_rootFragCount;
455 OrderedFragSet m_applFrags;
462 Uint32 m_finalBatchFrags;
471 Uint32 m_shortestBound;
476 Uint32Buffer m_attrInfo;
477 Uint32Buffer m_keyInfo;
480 bool m_startIndicator;
483 bool m_commitIndicator;
499 Uint32 m_pruneHashVal;
519 const NdbQueryDefImpl& queryDef);
524 void postFetchRelease();
540 FetchResult awaitMoreResults(
bool forceSend);
545 bool hasReceivedError();
547 void setFetchTerminated(
int aErrorCode,
bool needClose);
550 int closeTcCursor(
bool forceSend);
555 int sendClose(
int nodeId);
557 const NdbQuery& getInterface()
const
558 {
return m_interface; }
561 {
return getQueryOperation(0
U); }
571 {
return m_pointerAlloc; }
588 Uint32 getNoOfParentOperations()
const;
592 Uint32 getNoOfChildOperations()
const;
597 {
return m_queryImpl.getRoot(); }
602 const NdbQueryOperationDefImpl& getQueryOperationDef()
const
603 {
return m_operationDef; }
607 {
return m_queryImpl; }
609 NdbRecAttr* getValue(
const char* anAttrName,
char* resultBuffer);
610 NdbRecAttr* getValue(Uint32 anAttrId,
char* resultBuffer);
615 const unsigned char* result_mask);
618 const char* & bufRef,
619 const unsigned char* result_mask);
625 bool isRowNULL()
const;
627 bool isRowChanged()
const;
648 {
return m_interface; }
650 {
return m_interface; }
662 {
return m_ordering; }
707 bool hasInterpretedCode()
const;
711 {
return m_magic == MAGIC; }
717 {
return m_maxBatchRows; }
723 {
return m_ndbRecord; }
727 STATIC_CONST (MAGIC = 0xfade1234);
732 const Uint32 m_magic;
737 const NdbQueryOperationDefImpl& m_operationDef;
746 Uint32 m_maxBatchRows;
749 Uint32Buffer m_params;
752 char* m_resultBuffer;
756 const char** m_resultRef;
762 const unsigned char* m_read_mask;
777 bool m_diskInUserProjection;
781 Uint32 m_parallelism;
784 mutable Uint32 m_rowSize;
787 const NdbQueryOperationDefImpl& def);
796 void nullifyResult();
799 void postFetchRelease();
802 Int32 getNoOfDescendantOperations()
const;
813 int serializeProject(Uint32Buffer& attrInfo);
816 void setBatchedRows(Uint32 batchedRows);
820 int prepareAttrInfo(Uint32Buffer& attrInfo);
829 int prepareKeyInfo(Uint32Buffer& keyInfo,
832 int prepareLookupKeyInfo(
833 Uint32Buffer& keyInfo,
834 const NdbQueryOperandImpl*
const keys[],
837 int prepareIndexKeyInfo(
838 Uint32Buffer& keyInfo,
839 const NdbQueryOperationDefImpl::IndexBound* bounds,
846 Uint32 getIdOfReceiver()
const;
853 int prepareInterpretedCode(Uint32Buffer& attrInfo)
const;
856 bool diskInUserProjection()
const
857 {
return m_diskInUserProjection; }