~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/src/ndbapi/NdbEventOperation.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

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