summaryrefslogtreecommitdiff
path: root/ndb/src/common/debugger/signaldata/TcKeyReq.cpp
blob: 3918bd5db2684183e4cc69e347e20922c435a234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */



#include <signaldata/TcKeyReq.hpp>

bool
printTCKEYREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
  
  const TcKeyReq * const sig = (TcKeyReq *) theData;
  
  UintR requestInfo = sig->requestInfo;

  fprintf(output, " apiConnectPtr: H\'%.8x, apiOperationPtr: H\'%.8x\n", 
	  sig->apiConnectPtr, sig->apiOperationPtr);
  fprintf(output, " Operation: %s, Flags: ", 
	  sig->getOperationType(requestInfo) == ZREAD    ? "Read" :
	  sig->getOperationType(requestInfo) == ZREAD_EX ? "Read-Ex" :
	  sig->getOperationType(requestInfo) == ZUPDATE  ? "Update" :
	  sig->getOperationType(requestInfo) == ZINSERT  ? "Insert" :
	  sig->getOperationType(requestInfo) == ZDELETE  ? "Delete" :
	  sig->getOperationType(requestInfo) == ZWRITE   ? "Write" :
	  "Unknown");
  {
    if(sig->getDirtyFlag(requestInfo)){
      fprintf(output, "Dirty ");
    }    
    if(sig->getStartFlag(requestInfo)){
      fprintf(output, "Start ");
    }    
    if(sig->getExecuteFlag(requestInfo)){
      fprintf(output, "Execute ");
    }
    if(sig->getCommitFlag(requestInfo)){
      fprintf(output, "Commit ");
    }
    if (sig->getExecutingTrigger(requestInfo)) {
      fprintf(output, "Trigger ");
    }
   
    UintR TcommitType = sig->getAbortOption(requestInfo);
    if (TcommitType == TcKeyReq::AbortOnError) {
      fprintf(output, "AbortOnError ");
    } else if (TcommitType == TcKeyReq::IgnoreError) {
      fprintf(output, "IgnoreError ");
    }//if

    if(sig->getSimpleFlag(requestInfo)){
      fprintf(output, "Simple ");
    }   
    if(sig->getScanIndFlag(requestInfo)){
      fprintf(output, "ScanInd ");
    }   
    if(sig->getInterpretedFlag(requestInfo)){
      fprintf(output, "Interpreted ");
    }
    if(sig->getDistributionKeyFlag(sig->requestInfo)){
      fprintf(output, " d-key");
    }
    fprintf(output, "\n");
  }
  
  const int keyLen     = sig->getKeyLength(requestInfo);
  const int attrInThis = sig->getAIInTcKeyReq(requestInfo);
  const int attrLen = sig->getAttrinfoLen(sig->attrLen);
  const int apiVer = sig->getAPIVersion(sig->attrLen);
  fprintf(output, 
	  " keyLen: %d, attrLen: %d, AI in this: %d, tableId: %d, "
	  "tableSchemaVer: %d, API Ver: %d\n",
	  keyLen, attrLen, attrInThis, 
	  sig->tableId, sig->tableSchemaVersion, apiVer);
    
  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n -- Variable Data --\n", 
	  sig->transId1, sig->transId2);
  
  if (len >= TcKeyReq::StaticLength) {
    Uint32 restLen = (len - TcKeyReq::StaticLength);
    const Uint32 * rest = &sig->scanInfo;
    while(restLen >= 7){
      fprintf(output, 
              " H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
              rest[0], rest[1], rest[2], rest[3], 
              rest[4], rest[5], rest[6]);
      restLen -= 7;
      rest += 7;
    }
    if(restLen > 0){
      for(Uint32 i = 0; i<restLen; i++)
        fprintf(output, " H\'%.8x", rest[i]);
      fprintf(output, "\n");
    }
  } else {
    fprintf(output, "*** invalid len %u ***\n", len);
  }
  return true;
}