MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbEventOperation.cpp
1 /*
2  Copyright (C) 2003-2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
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 
20 #include <Ndb.hpp>
21 #include <NdbError.hpp>
22 #include <portlib/NdbMem.h>
23 #include "NdbEventOperationImpl.hpp"
24 #include "NdbDictionaryImpl.hpp"
25 
26 NdbEventOperation::NdbEventOperation(Ndb *theNdb,const char* eventName)
27  : m_impl(* new NdbEventOperationImpl(*this,theNdb,eventName))
28 {
29 }
30 
31 NdbEventOperation::~NdbEventOperation()
32 {
33  NdbEventOperationImpl * tmp = &m_impl;
34  if (this != tmp)
35  delete tmp;
36 }
37 
39 {
40  return m_impl.getState();
41 }
42 
44 {
45  m_impl.m_mergeEvents = flag;
46 }
47 
48 NdbRecAttr *
49 NdbEventOperation::getValue(const char *colName, char *aValue)
50 {
51  return m_impl.getValue(colName, aValue, 0);
52 }
53 
54 NdbRecAttr *
55 NdbEventOperation::getPreValue(const char *colName, char *aValue)
56 {
57  return m_impl.getValue(colName, aValue, 1);
58 }
59 
60 NdbBlob *
62 {
63  return m_impl.getBlobHandle(colName, 0);
64 }
65 
66 NdbBlob *
67 NdbEventOperation::getPreBlobHandle(const char *colName)
68 {
69  return m_impl.getBlobHandle(colName, 1);
70 }
71 
72 int
74 {
75  return m_impl.execute();
76 }
77 
78 int
79 NdbEventOperation::isOverrun() const
80 {
81  return 0; // ToDo
82 }
83 
84 bool
86 {
87  return true;
88 }
89 
90 void
91 NdbEventOperation::clearError()
92 {
93  m_impl.m_has_error= 0;
94 }
95 
96 int
97 NdbEventOperation::hasError() const
98 {
99  return m_impl.m_has_error;
100 }
101 
103 {
104  return m_impl.tableNameChanged();
105 }
106 
108 {
109  return m_impl.tableFrmChanged();
110 }
111 
113 {
114  return m_impl.tableFragmentationChanged();
115 }
116 
118 {
119  return m_impl.tableRangeListChanged();
120 }
121 
122 Uint64
124 {
125  return m_impl.getGCI();
126 }
127 
128 Uint32
130 {
131  return m_impl.getAnyValue();
132 }
133 
134 Uint64
136 {
137  return m_impl.getLatestGCI();
138 }
139 
140 Uint64
142 {
143  return m_impl.getTransId();
144 }
145 
148 {
149  return m_impl.getEventType();
150 }
151 
152 void
153 NdbEventOperation::print()
154 {
155  m_impl.print();
156 }
157 
158 /*
159  * Internal for the mysql server
160  */
162 {
163  return m_impl.m_eventImpl->m_tableImpl->m_facade;
164 }
165 const NdbDictionary::Event *NdbEventOperation::getEvent() const
166 {
167  return m_impl.m_eventImpl->m_facade;
168 }
169 const NdbRecAttr* NdbEventOperation::getFirstPkAttr() const
170 {
171  return m_impl.theFirstPkAttrs[0];
172 }
173 const NdbRecAttr* NdbEventOperation::getFirstPkPreAttr() const
174 {
175  return m_impl.theFirstPkAttrs[1];
176 }
177 const NdbRecAttr* NdbEventOperation::getFirstDataAttr() const
178 {
179  return m_impl.theFirstDataAttrs[0];
180 }
181 const NdbRecAttr* NdbEventOperation::getFirstDataPreAttr() const
182 {
183  return m_impl.theFirstDataAttrs[1];
184 }
185 /*
186 bool NdbEventOperation::validateTable(NdbDictionary::Table &table) const
187 {
188  DBUG_ENTER("NdbEventOperation::validateTable");
189  bool res = true;
190  if (table.getObjectVersion() != m_impl.m_eventImpl->m_tableVersion)
191  {
192  DBUG_PRINT("info",("invalid version"));
193  res= false;
194  }
195  DBUG_RETURN(res);
196 }
197 */
198 void NdbEventOperation::setCustomData(void * data)
199 {
200  m_impl.m_custom_data= data;
201 }
202 void * NdbEventOperation::getCustomData() const
203 {
204  return m_impl.m_custom_data;
205 }
206 
207 int NdbEventOperation::getReqNodeId() const
208 {
209  return SubTableData::getReqNodeId(m_impl.m_data_item->sdata->requestInfo);
210 }
211 
212 int NdbEventOperation::getNdbdNodeId() const
213 {
214  return SubTableData::getNdbdNodeId(m_impl.m_data_item->sdata->requestInfo);
215 }
216 
217 /*
218  * Private members
219  */
220 
221 NdbEventOperation::NdbEventOperation(NdbEventOperationImpl& impl)
222  : m_impl(impl) {}
223 
224 const struct NdbError &
226  return m_impl.getNdbError();
227 }