1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
#include <ndb_global.h>
20
#include <NdbTransaction.hpp>
21
#include <NdbOperation.hpp>
22
#include <NdbScanOperation.hpp>
23
#include "NdbApiSignal.hpp"
24
#include "TransporterFacade.hpp"
25
#include "NdbUtil.hpp"
27
#include "NdbImpl.hpp"
29
#include <signaldata/ScanTab.hpp>
34
/***************************************************************************
35
* int receiveSCAN_TABREF(NdbApiSignal* aSignal)
37
* This means the scan could not be started, set status(s) to indicate
40
****************************************************************************/
42
NdbTransaction::receiveSCAN_TABREF(NdbApiSignal* aSignal){
43
const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr());
45
if(checkState_TransId(&ref->transId1)){
46
theScanningOp->setErrorCode(ref->errorCode);
47
theScanningOp->execCLOSE_SCAN_REP();
48
if(!ref->closeNeeded){
53
* Setup so that close_impl will actually perform a close
54
* and not "close scan"-optimze it away
56
theScanningOp->m_conf_receivers_count++;
57
theScanningOp->m_conf_receivers[0] = theScanningOp->m_receivers[0];
58
theScanningOp->m_conf_receivers[0]->m_tcPtrI = ~0;
61
#ifdef NDB_NO_DROPPED_SIGNAL
69
/*****************************************************************************
70
* int receiveSCAN_TABCONF(NdbApiSignal* aSignal)
72
* Receive SCAN_TABCONF
73
* If scanStatus == 0 there is more records to read. Since signals may be
74
* received in any order we have to go through the lists with saved signals
75
* and check if all expected signals are there so that we can start to
78
* If scanStatus > 0 this indicates that the scan is finished and there are
79
* no more data to be read.
81
*****************************************************************************/
83
NdbTransaction::receiveSCAN_TABCONF(NdbApiSignal* aSignal,
84
const Uint32 * ops, Uint32 len)
86
const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr());
87
if(checkState_TransId(&conf->transId1)){
89
if (conf->requestInfo == ScanTabConf::EndOfData) {
90
theScanningOp->execCLOSE_SCAN_REP();
94
for(Uint32 i = 0; i<len; i += 3){
95
Uint32 opCount, totalLen;
96
Uint32 ptrI = * ops++;
97
Uint32 tcPtrI = * ops++;
98
Uint32 info = * ops++;
99
opCount = ScanTabConf::getRows(info);
100
totalLen = ScanTabConf::getLength(info);
102
void * tPtr = theNdb->int2void(ptrI);
103
assert(tPtr); // For now
104
NdbReceiver* tOp = theNdb->void2rec(tPtr);
105
if (tOp && tOp->checkMagicNumber())
107
if (tcPtrI == RNIL && opCount == 0)
108
theScanningOp->receiver_completed(tOp);
109
else if (tOp->execSCANOPCONF(tcPtrI, totalLen, opCount))
110
theScanningOp->receiver_delivered(tOp);
115
#ifdef NDB_NO_DROPPED_SIGNAL