1 /*
2    Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 
25 #include <signaldata/CreateTrig.hpp>
26 #include <signaldata/DictSignal.hpp>
27 #include <trigger_definitions.h>
28 
29 bool
printCREATE_TRIG_REQ(FILE * output,const Uint32 * theData,Uint32 len,Uint16)30 printCREATE_TRIG_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16)
31 {
32   const CreateTrigReq* sig = (const CreateTrigReq*)theData;
33   const Uint32 triggerType =
34     TriggerInfo::getTriggerType(sig->triggerInfo);
35   const Uint32 triggerActionTime =
36     TriggerInfo::getTriggerActionTime(sig->triggerInfo);
37   const Uint32 triggerEvent =
38     TriggerInfo::getTriggerEvent(sig->triggerInfo);
39   const Uint32 monitorReplicas =
40     TriggerInfo::getMonitorReplicas(sig->triggerInfo);
41   const Uint32 monitorAllAttributes =
42     TriggerInfo::getMonitorAllAttributes(sig->triggerInfo);
43   const Uint32 reportAllMonitoredAttributes =
44     TriggerInfo::getReportAllMonitoredAttributes(sig->triggerInfo);
45   fprintf(output, " clientRef: 0x%x", sig->clientRef);
46   fprintf(output, " clientData: %u", sig->clientData);
47   fprintf(output, "\n");
48   fprintf(output, " transId: 0x%x", sig->transId);
49   fprintf(output, " transKey: %u", sig->transKey);
50   fprintf(output, "\n");
51   fprintf(output, " requestInfo: type: %u extra: %u flags: [%s]",
52                   DictSignal::getRequestType(sig->requestInfo),
53                   DictSignal::getRequestExtra(sig->requestInfo),
54                   DictSignal::getRequestFlagsText(sig->requestInfo));
55   fprintf(output, "\n");
56   fprintf(output, " tableId: %u", sig->tableId);
57   fprintf(output, " tableVersion: 0x%x", sig->tableVersion);
58   fprintf(output, " indexId: %u", sig->indexId);
59   fprintf(output, " indexVersion: 0x%x", sig->indexVersion);
60   fprintf(output, " triggerNo: %u", sig->triggerNo);
61   fprintf(output, "\n");
62   if (sig->forceTriggerId == RNIL)
63     fprintf(output, " forceTriggerId: RNIL");
64   else
65     fprintf(output, " forceTriggerId: %u", sig->forceTriggerId);
66   fprintf(output, "\n");
67   fprintf(output, " triggerInfo: 0x%x", sig->triggerInfo);
68   fprintf(output, "\n");
69   fprintf(output, "   triggerType: %u [%s]",
70                   triggerType,
71                   TriggerInfo::triggerTypeName(triggerType));
72   fprintf(output, "\n");
73   fprintf(output, "   triggerActionTime: %u [%s]",
74                   triggerActionTime,
75                   TriggerInfo::triggerActionTimeName(triggerActionTime));
76   fprintf(output, "\n");
77   fprintf(output, "   triggerEvent: %u [%s]",
78                   triggerEvent,
79                   TriggerInfo::triggerEventName(triggerEvent));
80   fprintf(output, "\n");
81   fprintf(output, "   monitorReplicas: %u",
82                   monitorReplicas);
83   fprintf(output, "\n");
84   fprintf(output, "   monitorAllAttributes: %u",
85                   monitorAllAttributes);
86   fprintf(output, "\n");
87   fprintf(output, "   reportAllMonitoredAttributes: %u",
88                   reportAllMonitoredAttributes);
89   fprintf(output, "\n");
90   fprintf(output, " receiverRef: 0x%x", sig->receiverRef);
91   fprintf(output, "\n");
92   return true;
93 }
94 
95 bool
printCREATE_TRIG_CONF(FILE * output,const Uint32 * theData,Uint32 len,Uint16)96 printCREATE_TRIG_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
97 {
98   const CreateTrigConf* sig = (const CreateTrigConf*)theData;
99   fprintf(output, " senderRef: 0x%x", sig->senderRef);
100   fprintf(output, " clientData: %x", sig->clientData);
101   fprintf(output, " transId: 0x%x", sig->transId);
102   fprintf(output, "\n");
103   fprintf(output, " tableId: %u", sig->tableId);
104   fprintf(output, " indexId: %u", sig->indexId);
105   fprintf(output, " triggerId: %u", sig->triggerId);
106   fprintf(output, " triggerInfo: 0x%x", sig->triggerInfo);
107   fprintf(output, "\n");
108   return true;
109 }
110 
111 bool
printCREATE_TRIG_REF(FILE * output,const Uint32 * theData,Uint32 len,Uint16)112 printCREATE_TRIG_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
113 {
114   const CreateTrigRef* sig = (CreateTrigRef*)theData;
115   fprintf(output, " senderRef: 0x%x", sig->senderRef);
116   fprintf(output, " clientData: %u", sig->clientData);
117   fprintf(output, " transId: 0x%x", sig->transId);
118   fprintf(output, "\n");
119   fprintf(output, " tableId: %u", sig->tableId);
120   fprintf(output, " indexId: %u", sig->indexId);
121   fprintf(output, " triggerInfo: 0x%x", sig->triggerInfo);
122   fprintf(output, "\n");
123   fprintf(output, " errorCode: %u", sig->errorCode);
124   fprintf(output, " errorLine: %u", sig->errorLine);
125   fprintf(output, " errorNodeId: %u", sig->errorNodeId);
126   fprintf(output, " masterNodeId: %u", sig->masterNodeId);
127   fprintf(output, "\n");
128   return true;
129 }
130