summaryrefslogtreecommitdiff
path: root/storage/federatedx/federatedx_io_null.cc
blob: b1058dbd2f5d546272797fe58e1c50d9e78e386f (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
/* 
Copyright (c) 2007, Antony T Curtis
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

    * Neither the name of FederatedX nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


/*#define MYSQL_SERVER 1*/
#include <my_global.h>
#include "sql_priv.h"

#include "ha_federatedx.h"

#include "m_string.h"

#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation                          // gcc: Class implementation
#endif


#define SAVEPOINT_REALIZED  1
#define SAVEPOINT_RESTRICT  2
#define SAVEPOINT_EMITTED 4


typedef struct federatedx_savepoint
{
  ulong level;
  uint  flags;
} SAVEPT;


class federatedx_io_null :public federatedx_io
{
public:
  federatedx_io_null(FEDERATEDX_SERVER *);
  ~federatedx_io_null();

  int query(const char *buffer, size_t length);
  virtual FEDERATEDX_IO_RESULT *store_result();

  virtual size_t max_query_size() const;

  virtual my_ulonglong affected_rows() const;
  virtual my_ulonglong last_insert_id() const;

  virtual int error_code();
  virtual const char *error_str();
  
  void reset();
  int commit();
  int rollback();
  
  int savepoint_set(ulong sp);
  ulong savepoint_release(ulong sp);
  ulong savepoint_rollback(ulong sp);
  void savepoint_restrict(ulong sp);
  
  ulong last_savepoint() const;
  ulong actual_savepoint() const;
  bool is_autocommit() const;

  bool table_metadata(ha_statistics *stats, const char *table_name,
                      uint table_name_length, uint flag);
  
  /* resultset operations */
  
  virtual void free_result(FEDERATEDX_IO_RESULT *io_result);
  virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result);
  virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result);
  virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result,
                                       FEDERATEDX_IO_ROWS **current= NULL);
  virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result);
  virtual const char *get_column_data(FEDERATEDX_IO_ROW *row,
                                      unsigned int column);
  virtual bool is_column_null(const FEDERATEDX_IO_ROW *row,
                              unsigned int column) const;
  virtual size_t get_ref_length() const;
  virtual void mark_position(FEDERATEDX_IO_RESULT *io_result,
                             void *ref, FEDERATEDX_IO_ROWS *current);
  virtual int seek_position(FEDERATEDX_IO_RESULT **io_result,
                            const void *ref);
};


federatedx_io *instantiate_io_null(MEM_ROOT *server_root,
                                   FEDERATEDX_SERVER *server)
{
  return new (server_root) federatedx_io_null(server);
}


federatedx_io_null::federatedx_io_null(FEDERATEDX_SERVER *aserver)
  : federatedx_io(aserver)
{
}


federatedx_io_null::~federatedx_io_null()
{
}


void federatedx_io_null::reset()
{
}


int federatedx_io_null::commit()
{
  return 0;
}

int federatedx_io_null::rollback()
{
  return 0;
}


ulong federatedx_io_null::last_savepoint() const
{
  return 0;
}


ulong federatedx_io_null::actual_savepoint() const
{
  return 0;
}

bool federatedx_io_null::is_autocommit() const
{
  return 0;
}


int federatedx_io_null::savepoint_set(ulong sp)
{
  return 0;
}


ulong federatedx_io_null::savepoint_release(ulong sp)
{
  return 0;
}


ulong federatedx_io_null::savepoint_rollback(ulong sp)
{
  return 0;
}


void federatedx_io_null::savepoint_restrict(ulong sp)
{
}


int federatedx_io_null::query(const char *buffer, size_t length)
{
  return 0;
}


size_t federatedx_io_null::max_query_size() const
{
  return INT_MAX;
}


my_ulonglong federatedx_io_null::affected_rows() const
{
  return 0;
}


my_ulonglong federatedx_io_null::last_insert_id() const
{
  return 0;
}


int federatedx_io_null::error_code()
{
  return 0;
}


const char *federatedx_io_null::error_str()
{
  return "";
}


FEDERATEDX_IO_RESULT *federatedx_io_null::store_result()
{
  FEDERATEDX_IO_RESULT *result;
  DBUG_ENTER("federatedx_io_null::store_result");
  
  result= NULL;
  
  DBUG_RETURN(result);
}


void federatedx_io_null::free_result(FEDERATEDX_IO_RESULT *)
{
}


unsigned int federatedx_io_null::get_num_fields(FEDERATEDX_IO_RESULT *)
{
  return 0;
}


my_ulonglong federatedx_io_null::get_num_rows(FEDERATEDX_IO_RESULT *)
{
  return 0;
}


FEDERATEDX_IO_ROW *federatedx_io_null::fetch_row(FEDERATEDX_IO_RESULT *,
                                                 FEDERATEDX_IO_ROWS **current)
{
  return NULL;
}


ulong *federatedx_io_null::fetch_lengths(FEDERATEDX_IO_RESULT *)
{
  return NULL;
}


const char *federatedx_io_null::get_column_data(FEDERATEDX_IO_ROW *,
                                                 unsigned int)
{
  return "";
}


bool federatedx_io_null::is_column_null(const FEDERATEDX_IO_ROW *,
                                         unsigned int) const
{
  return true;
}

bool federatedx_io_null::table_metadata(ha_statistics *stats,
                                        const char *table_name,
                                        uint table_name_length, uint flag)
{
  stats->records= (ha_rows) 0;
  stats->mean_rec_length= (ulong) 0;
  stats->data_file_length= 0;

  stats->update_time= (time_t) 0;
  stats->check_time= (time_t) 0;

  return 0;
}

size_t federatedx_io_null::get_ref_length() const
{
  return sizeof(int);
}


void federatedx_io_null::mark_position(FEDERATEDX_IO_RESULT *io_result,
                                       void *ref, FEDERATEDX_IO_ROWS *current)
{
}

int federatedx_io_null::seek_position(FEDERATEDX_IO_RESULT **io_result,
                                      const void *ref)
{
  return 0;
}