MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_engine_table.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
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 Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #ifndef PFS_ENGINE_TABLE_H
17 #define PFS_ENGINE_TABLE_H
18 
19 #include "sql_acl.h" /* struct ACL_* */
25 #include "pfs_instr_class.h"
26 class Field;
28 struct time_normalizer;
29 
41 {
42 public:
43  static const PFS_engine_table_share*
44  find_engine_table_share(const char *name);
45 
46  int read_row(TABLE *table, unsigned char *buf, Field **fields);
47 
48  int update_row(TABLE *table, const unsigned char *old_buf,
49  unsigned char *new_buf, Field **fields);
50 
58  int delete_row(TABLE *table, const unsigned char *buf, Field **fields);
59 
61  virtual int rnd_init(bool scan){return 0;};
62 
64  virtual int rnd_next(void)= 0;
69  virtual int rnd_pos(const void *pos)= 0;
70 
71  void get_position(void *ref);
72  void set_position(const void *ref);
74  virtual void reset_position(void)= 0;
75 
77  void get_normalizer(PFS_instr_class *instr_class);
78 
81  {}
82 
88  static void set_field_ulong(Field *f, ulong value);
94  static void set_field_ulonglong(Field *f, ulonglong value);
101  static void set_field_char_utf8(Field *f, const char *str, uint len);
108  static void set_field_varchar_utf8(Field *f, const char *str, uint len);
115  static void set_field_longtext_utf8(Field *f, const char *str, uint len);
121  static void set_field_enum(Field *f, ulonglong value);
127  static void set_field_timestamp(Field *f, ulonglong value);
133  static ulonglong get_field_enum(Field *f);
140  static String *get_field_char_utf8(Field *f, String *val);
147  static String *get_field_varchar_utf8(Field *f, String *val);
148 
149 protected:
157  virtual int read_row_values(TABLE *table, unsigned char *buf,
158  Field **fields, bool read_all)= 0;
159 
167  virtual int update_row_values(TABLE *table, const unsigned char *old_buf,
168  unsigned char *new_buf, Field **fields);
169 
176  virtual int delete_row_values(TABLE *table, const unsigned char *buf,
177  Field **fields);
178 
184  PFS_engine_table(const PFS_engine_table_share *share, void *pos)
185  : m_share_ptr(share), m_pos_ptr(pos),
186  m_normalizer(NULL), m_class_type(PFS_CLASS_NONE)
187  {}
188 
192  void *m_pos_ptr;
196  enum PFS_class_type m_class_type;
197 };
198 
200 typedef PFS_engine_table* (*pfs_open_table_t)(void);
202 typedef int (*pfs_write_row_t)(TABLE *table,
203  unsigned char *buf, Field **fields);
205 typedef int (*pfs_delete_all_rows_t)(void);
207 typedef ha_rows (*pfs_get_row_count_t)(void);
208 
214 {
215  static void check_all_tables(THD *thd);
216  void check_one_table(THD *thd);
217  static void init_all_locks(void);
218  static void delete_all_locks(void);
220  ha_rows get_row_count(void) const;
222  int write_row(TABLE *table, unsigned char *buf, Field **fields) const;
223 
242  ha_rows m_records;
250  bool m_checked;
251 };
252 
258 {
259 public:
261  {}
262 
264  {}
265 
266  virtual ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
267 };
268 
271 
277 {
278 public:
280  {}
281 
283  {}
284 
285  ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
286 };
287 
290 
296 {
297 public:
299  {}
300 
302  {}
303 
304  ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
305 };
306 
309 
315 {
316 public:
318  {}
319 
321  {}
322 
323  ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
324 };
325 
328 
333 {
334 public:
336  {}
337 
338  ~PFS_unknown_acl()
339  {}
340 
341  ACL_internal_access_result check(ulong want_access, ulong *save_priv) const;
342 };
343 
346 
349 {
351  uint m_index;
352 
358  : m_index(index)
359  {}
360 
365  void set_at(const struct PFS_simple_index *other)
366  { m_index= other->m_index; }
367 
372  void set_after(const struct PFS_simple_index *other)
373  { m_index= other->m_index + 1; }
374 
376  void next(void)
377  { m_index++; }
378 };
379 
382 {
384  uint m_index_1;
386  uint m_index_2;
387 
393  PFS_double_index(uint index_1, uint index_2)
394  : m_index_1(index_1), m_index_2(index_2)
395  {}
396 
401  void set_at(const struct PFS_double_index *other)
402  {
403  m_index_1= other->m_index_1;
404  m_index_2= other->m_index_2;
405  }
406 
411  void set_after(const struct PFS_double_index *other)
412  {
413  m_index_1= other->m_index_1;
414  m_index_2= other->m_index_2 + 1;
415  }
416 };
417 
420 {
422  uint m_index_1;
424  uint m_index_2;
426  uint m_index_3;
427 
434  PFS_triple_index(uint index_1, uint index_2, uint index_3)
435  : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3)
436  {}
437 
442  void set_at(const struct PFS_triple_index *other)
443  {
444  m_index_1= other->m_index_1;
445  m_index_2= other->m_index_2;
446  m_index_3= other->m_index_3;
447  }
448 
453  void set_after(const struct PFS_triple_index *other)
454  {
455  m_index_1= other->m_index_1;
456  m_index_2= other->m_index_2;
457  m_index_3= other->m_index_3 + 1;
458  }
459 };
460 
461 bool pfs_show_status(handlerton *hton, THD *thd,
462  stat_print_fn *print, enum ha_stat_type stat);
463 
465 #endif