MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UtilSequence.cpp
1 /*
2  Copyright (C) 2003, 2005, 2006, 2008 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include <signaldata/UtilSequence.hpp>
20 
21 inline
22 const char *
23 type2string(UtilSequenceReq::RequestType type){
24  switch(type){
25  case UtilSequenceReq::NextVal:
26  return "NextVal";
27  case UtilSequenceReq::CurrVal:
28  return "CurrVal";
29  case UtilSequenceReq::Create:
30  return "Create";
31  case UtilSequenceReq::SetVal:
32  return "SetVal";
33  default:
34  return "Unknown";
35  }
36 }
37 
38 bool
39 printUTIL_SEQUENCE_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 b){
40  UtilSequenceReq* sig = (UtilSequenceReq*)data;
41  fprintf(out, " senderData: %d sequenceId: %d RequestType: %s\n",
42  sig->senderData,
43  sig->sequenceId,
44  type2string((UtilSequenceReq::RequestType)sig->requestType));
45  return true;
46 }
47 
48 bool
49 printUTIL_SEQUENCE_CONF(FILE * out, const Uint32 * data, Uint32 l, Uint16 b){
50  UtilSequenceConf* sig = (UtilSequenceConf*)data;
51  fprintf(out, " senderData: %d sequenceId: %d RequestType: %s\n",
52  sig->senderData,
53  sig->sequenceId,
54  type2string((UtilSequenceReq::RequestType)sig->requestType));
55  fprintf(out, " val: [ %d %d ]\n",
56  sig->sequenceValue[0],
57  sig->sequenceValue[1]);
58  return true;
59 }
60 
61 bool
62 printUTIL_SEQUENCE_REF(FILE * out, const Uint32 * data, Uint32 l, Uint16 b){
63  UtilSequenceRef* sig = (UtilSequenceRef*)data;
64  fprintf(out, " senderData: %d sequenceId: %d RequestType: %s\n",
65  sig->senderData,
66  sig->sequenceId,
67  type2string((UtilSequenceReq::RequestType)sig->requestType));
68  fprintf(out, " errorCode: %d, TCErrorCode: %d\n",
69  sig->errorCode, sig->TCErrorCode);
70  return true;
71 }