MySQL  8.0.18
Source Code Documentation
pfs_plugin_table_service.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 2019, 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, version 2.0,
5 as published by the Free Software Foundation.
6 
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef PFS_PLUGIN_TABLE_SERVICE_H
24 #define PFS_PLUGIN_TABLE_SERVICE_H
25 
28 
29 /**
30  @page EXAMPLE_PLUGIN_COMPONENT Example plugin/component to use this service.
31 
32  Any plugin/component, which exposes tables in performance schema,
33  has to provide an implementation of interface PFS_engine_table_proxy.
34 
35  As there is no storage engine here to handle table data, plugin/component has
36  to:
37  - maintain storage for table being exposed,
38  - take care of handling any duplicate check (Primary/Unique Key, etc.)
39 
40  The following table describes datatypes exposed to plugin/component
41  which should be used to implement columns.
42 
43  COLUMN TYPE | TO BE USED | NULL VALUE INDICATION
44  ----------- | ------------ | ---------------------
45  INTEGER | PSI_int | is_null=true
46  TINYINT | PSI_tinyint | -do-
47  SMALLINT | PSI_smallint | -do-
48  BIGINT | PSI_bigint | -do-
49  MEDIUMINT | PSI_mediumint| -do-
50  DECIMAL | PSI_decimal | -do-
51  FLOAT | PSI_float | -do-
52  DOUBLE | PSI_double | -do-
53  ENUM | PSI_enum | -do-
54  YEAR | PSI_year | -do-
55  DATE | char array | length=0
56  TIME | char array | -do-
57  DATETIME | char array | -do-
58  TIMESTAMP | char array | -do-
59  CHAR | char array | -do-
60  VARCHAR | char array | -do-
61  BLOB | char array | -do-
62 
63  @section STEPS How to write a plugin/component exposing tables in Performance
64  Schema
65 
66  Following are the example implementations of a plugin and a component which
67  uses this pfs_plugin_table service.
68 
69  @subpage EXAMPLE_PLUGIN
70 
71  @subpage EXAMPLE_COMPONENT
72 */
73 
74 /* Define ERRORS */
75 #define PFS_HA_ERR_WRONG_COMMAND 131
76 #define PFS_HA_ERR_RECORD_DELETED 134
77 #define PFS_HA_ERR_END_OF_FILE 137
78 #define PFS_HA_ERR_NO_REFERENCED_ROW 151
79 #define PFS_HA_ERR_FOUND_DUPP_KEY 121
80 #define PFS_HA_ERR_RECORD_FILE_FULL 135
81 
82 /* Helper macro */
83 struct PFS_string {
84  char *str;
85  unsigned int length;
86 };
87 typedef struct PFS_string PFS_string;
88 
89 /**
90  This is an opaque structure to denote filed in plugin/component code.
91 */
92 typedef struct PSI_field PSI_field;
93 /**
94  This is an opaque structure to denote table handle in plugin/component code.
95 */
97 /**
98  This is an opaque structure to denote cursor position in plugin/component
99  code.
100 */
101 typedef struct PSI_pos PSI_pos;
102 /**
103  This is an opaque structure to denote Key Reader in plugin/component code.
104 */
106 /**
107  This is an opaque structure to denote Index Handle in plugin/component code.
108 */
110 
111 struct PSI_long {
112  long val; /* Column value */
113  bool is_null; /* If Column value is NULL */
114 };
115 typedef struct PSI_long PSI_long;
116 
117 struct PSI_ulong {
118  unsigned long val; /* Column value */
119  bool is_null; /* If Column value is NULL */
120 };
121 typedef struct PSI_ulong PSI_ulong;
122 
123 struct PSI_longlong {
124  long long val; /* Column value */
125  bool is_null /* If Column value is NULL */;
126 };
127 typedef struct PSI_longlong PSI_longlong;
128 
130  unsigned long long val; /* Column value */
131  bool is_null /* If Column value is NULL */;
132 };
134 
135 struct PSI_double {
136  double val; /* Column value */
137  bool is_null /* If Column value is NULL */;
138 };
139 typedef struct PSI_double PSI_double;
140 
141 #define PSI_tinyint PSI_long
142 #define PSI_utinyint PSI_ulong
143 #define PSI_smallint PSI_long
144 #define PSI_usmallint PSI_ulong
145 #define PSI_mediumint PSI_long
146 #define PSI_umediumint PSI_ulong
147 #define PSI_int PSI_long
148 #define PSI_uint PSI_ulong
149 #define PSI_bigint PSI_longlong
150 #define PSI_ubigint PSI_ulonglong
151 #define PSI_year PSI_ulong
152 #define PSI_enum PSI_ulonglong
153 #define PSI_decimal PSI_double
154 #define PSI_float PSI_double
155 
156 /**
157  A structure to denote a key of type long in an index.
158 */
160  /* name of the key column */
161  const char *m_name;
162  /* find flags */
164  /* is column NULL */
165  bool m_is_null;
166  /* value of the key column */
167  long m_value;
168 };
173 
174 /**
175  A structure to denote a key of type ulong in an index.
176 */
178  /** Name of the key column */
179  const char *m_name;
180  /** Find flags */
182  /** Column is NULL */
183  bool m_is_null;
184  /** Value of the key column */
185  unsigned long m_value;
186 };
191 
192 /**
193  A structure to denote a key of type long long in an index.
194 */
196  /** Name of the key column */
197  const char *m_name;
198  /** Find flags */
200  /** Column is NULL */
201  bool m_is_null;
202  /** Value of the key column */
203  long long m_value;
204 };
206 
207 /**
208  A structure to denote a key of type unsigned long long in an index.
209 */
211  /** Name of the key column */
212  const char *m_name;
213  /** Find flags */
215  /** Column is NULL */
216  bool m_is_null;
217  /** Value of the key column */
218  unsigned long long m_value;
219 };
221 
222 /**
223  A structure to denote a key of type string in an index.
224 */
226  /* name of the key column */
227  const char *m_name;
228  /* find flags */
230  /* is column null */
231  bool m_is_null;
232  /* buffer to store key column value */
234  // FIXME: size_t
235  /* length of the key value in buffer */
236  unsigned int m_value_buffer_length;
237  /* Maximum size of buffer */
239 };
241 
242 /**
243  Api to read the next record.
244  @param handle Table handle.
245 
246  @return Operation status
247  @retval 0 Success
248  @retval !=0 Error
249 */
251 
252 /**
253  API to initialize for random scan or read.
254  @param handle Table handle.
255  @param scan True, if its a random scan.
256  False, if its a random read.
257 
258  @return Operation status
259  @retval 0 Success
260  @retval !=0 Error
261 */
262 typedef int (*rnd_init_t)(PSI_table_handle *handle, bool scan);
263 
264 /**
265  API to read row from a position which is set in table handle.
266  @param handle Table handle.
267 
268  @return Operation status
269  @retval 0 Success
270  @retval !=0 Error
271 */
273 
274 /**
275  API to initialize index(es).
276  @param handle Table handle.
277  @param idx Index of the index to be initialized (in case of multiple
278  indexes on table)
279  @param sorted
280  @param index Initialized index handle.
281 
282  @return Operation status
283  @retval 0 Success
284  @retval !=0 Error
285 */
286 typedef int (*index_init_t)(PSI_table_handle *table, unsigned int idx,
287  bool sorted, PSI_index_handle **index);
288 /**
289  API to read keys in index.
290  @param index Index handle.
291  @param reader Key reader.
292  @param idx Index of the index to be read.
293  @param find_flag find flag.
294 
295  @return Operation status
296  @retval 0 Success
297  @retval !=0 Error
298 */
300  unsigned int idx, int find_flag);
301 
302 /**
303  API to read next record with matching index.
304  @param handle Table handle.
305 
306  @return Operation status
307  @retval 0 Success
308  @retval !=0 Error
309 */
310 typedef int (*index_next_t)(PSI_table_handle *table);
311 
312 /**
313  API to reset cursor position
314  @param handle Table handle.
315 */
317 
318 /**
319  API to read a column value from table.
320  @param handle Table handle.
321  @param field Field for which value is to be read.
322  @param index Index of field in table column.
323 
324  @return Operation status
325  @retval 0 Success
326  @retval !=0 Error
327 */
329  unsigned int index);
330 
331 /**
332  API to write a column value in table.
333  @param handle Table handle.
334  @param field Field for which value is to be written.
335  @param index Index of field in table column.
336 
337  @return Operation status
338  @retval 0 Success
339  @retval !=0 Error
340 */
342  unsigned int index);
343 /**
344  API to write a record in table.
345  @param handle Table handle having new record to be written.
346 */
348 
349 /**
350  API to update a column value in table.
351  @param handle Table handle.
352  @param field Field for which value is to be updated.
353  @param index Index of field in table column.
354 
355  @return Operation status
356  @retval 0 Success
357  @retval !=0 Error
358 */
360  PSI_field *fields, unsigned int index);
361 /**
362  API to write a record in table.
363  @param handle Table handle having updated record to be updated.
364 */
366 
367 /**
368  API to delete record from table.
369  @param handle Table handle having record to be deleted.
370 */
372 
373 /**
374  API to Open a table handle in plugin/component code and reset position
375  pointer when a new table handle in opened in Performance Schema.
376  @param pos pos pointer to be updated.
377 
378  @return initialized table handle.
379 */
380 typedef PSI_table_handle *(*open_table_t)(PSI_pos **pos);
381 
382 /**
383  API to Close a table handle in plugin/component code and reset position
384  pointer when a table handle in closed in Performance Schema.
385  @param handle table handle
386 */
388 
389 /**
390  A structure to keep callback functions to be implemented by
391  plugin/component.
392 */
409  PFS_engine_table_proxy() = default;
410 };
412 
413 /**
414  Types of access allowed to tables.
415 */
417  /* Only Read is allowed */
418  READONLY = 0,
419  /* Read/Truncate allowed but no Update/Insert/Delete. */
421  /* Read/Truncate/Update allowed but no Insert/Delete. */
423  /* Read/Truncate/Insert/UPDATE/Delete allowed. */
425 };
426 
427 /**
428  API to delete/truncate all the rows in a table
429 */
430 typedef int (*delete_all_rows_t)(void);
431 
432 /**
433  API to give number of rows in a table
434 
435  @return number of rows.
436 */
437 typedef unsigned long long (*get_row_count_t)(void);
438 
439 /**
440  A share to be initialized by plugin/component code and to be provided
441  to add_table() service method of pfs_plugin_table service.
442  */
444  public:
445  /* Callback functions list of APIs */
447 
448  /* Name of the table to be added */
449  const char *m_table_name;
450  /* Length of the table name */
451  unsigned int m_table_name_length;
452 
453  /* Table Columns definition */
454  const char *m_table_definition;
455  unsigned int m_ref_length;
456 
457  /* Access allowed on the table */
459 
462 };
464 
465 /**
466  Definition of pfs_plugin_table service and its methods.
467  @deprecated
468  This service is functional but incomplete,
469  as many apis are missing.
470  Please use pfs_plugin_table_v1
471  and pfs_plugin_column_*_v1 instead.
472 */
473 BEGIN_SERVICE_DEFINITION(pfs_plugin_table)
474 /* Methods to add tables in Performance Schema */
475 DECLARE_METHOD(int, add_tables,
476  (PFS_engine_table_share_proxy * *st_share,
477  unsigned int share_count));
478 
479 /* Methods to delete tables in Performance Schema */
480 DECLARE_METHOD(int, delete_tables,
481  (PFS_engine_table_share_proxy * *st_share,
482  unsigned int share_count));
483 
484 /* TINYINT */
485 DECLARE_METHOD(void, set_field_tinyint, (PSI_field * f, PSI_tinyint value));
486 DECLARE_METHOD(void, set_field_utinyint, (PSI_field * f, PSI_utinyint value));
487 DECLARE_METHOD(void, get_field_tinyint, (PSI_field * f, PSI_tinyint *value));
488 
489 /* SMALLINT */
490 DECLARE_METHOD(void, set_field_smallint, (PSI_field * f, PSI_smallint value));
491 DECLARE_METHOD(void, set_field_usmallint, (PSI_field * f, PSI_usmallint value));
492 DECLARE_METHOD(void, get_field_smallint, (PSI_field * f, PSI_smallint *value));
493 
494 /* MEDIUMINT */
495 DECLARE_METHOD(void, set_field_mediumint, (PSI_field * f, PSI_mediumint value));
496 DECLARE_METHOD(void, set_field_umediumint,
498 DECLARE_METHOD(void, get_field_mediumint,
500 
501 /* INTEGER(INT) */
502 DECLARE_METHOD(void, set_field_integer, (PSI_field * f, PSI_int value));
503 DECLARE_METHOD(void, set_field_uinteger, (PSI_field * f, PSI_uint value));
504 DECLARE_METHOD(void, get_field_integer, (PSI_field * f, PSI_int *value));
505 DECLARE_METHOD(void, read_key_integer,
507  int find_flag));
508 DECLARE_METHOD(bool, match_key_integer,
509  (bool record_null, long record_value,
511 
512 /* BIGINT */
513 DECLARE_METHOD(void, set_field_bigint, (PSI_field * f, PSI_bigint value));
514 DECLARE_METHOD(void, set_field_ubigint, (PSI_field * f, PSI_ubigint value));
515 DECLARE_METHOD(void, get_field_bigint, (PSI_field * f, PSI_bigint *value));
516 
517 /* DECIMAL */
520 
521 /* FLOAT */
524 
525 /* DOUBLE */
528 
529 /* CHAR */
531  (PSI_field * f, const char *value, unsigned int length));
533  (PSI_field * f, char *str, unsigned int *length));
534 DECLARE_METHOD(void, read_key_string,
536  int find_flag));
537 DECLARE_METHOD(bool, match_key_string,
538  (bool record_null, const char *record_string_value,
539  unsigned int record_string_length, PSI_plugin_key_string *key));
540 
541 /* VARCHAR */
542 DECLARE_METHOD(void, set_field_varchar_utf8, (PSI_field * f, const char *str));
543 DECLARE_METHOD(void, set_field_varchar_utf8_len,
544  (PSI_field * f, const char *str, unsigned int len));
546  (PSI_field * f, char *str, unsigned int *length));
547 
549  (PSI_field * f, const char *str));
550 DECLARE_METHOD(void, set_field_varchar_utf8mb4_len,
551  (PSI_field * f, const char *str, unsigned int len));
552 
553 /* BLOB/TEXT */
555  (PSI_field * f, const char *val, unsigned int len));
557  (PSI_field * f, char *val, unsigned int *len));
558 
559 /* ENUM */
562 
563 /* DATE */
565  (PSI_field * f, const char *str, unsigned int length));
567  (PSI_field * f, char *val, unsigned int *len));
568 
569 /* TIME */
571  (PSI_field * f, const char *str, unsigned int length));
573  (PSI_field * f, char *val, unsigned int *len));
574 
575 /* DATETIME */
577  (PSI_field * f, const char *str, unsigned int length));
579  (PSI_field * f, char *val, unsigned int *len));
580 
581 /* TIMESTAMP */
583  (PSI_field * f, const char *str, unsigned int length));
585  (PSI_field * f, char *val, unsigned int *len));
586 
587 /* YEAR */
590 
591 /* NULL */
592 DECLARE_METHOD(void, set_field_null, (PSI_field * f));
593 
594 END_SERVICE_DEFINITION(pfs_plugin_table)
595 
596 /**
597  Definition of pfs_plugin_table_v1 service and its methods.
598 */
599 BEGIN_SERVICE_DEFINITION(pfs_plugin_table_v1)
600 DECLARE_METHOD(int, add_tables,
601  (PFS_engine_table_share_proxy * *st_share,
602  unsigned int share_count));
603 
604 DECLARE_METHOD(int, delete_tables,
605  (PFS_engine_table_share_proxy * *st_share,
606  unsigned int share_count));
607 DECLARE_METHOD(unsigned int, get_parts_found, (PSI_key_reader * reader));
608 END_SERVICE_DEFINITION(pfs_plugin_table_v1)
609 
610 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_tiny_v1)
612 DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_utinyint value));
614 DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_utinyint *value));
615 DECLARE_METHOD(void, read_key,
617  int find_flag));
618 DECLARE_METHOD(void, read_key_unsigned,
620  int find_flag));
621 DECLARE_METHOD(bool, match_key,
622  (bool record_null, long record_value,
624 DECLARE_METHOD(bool, match_key_unsigned,
625  (bool record_null, unsigned long record_value,
627 
628 END_SERVICE_DEFINITION(pfs_plugin_column_tiny_v1)
629 
630 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_small_v1)
632 DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_usmallint value));
634 DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_usmallint *value));
635 DECLARE_METHOD(void, read_key,
637  int find_flag));
638 DECLARE_METHOD(void, read_key_unsigned,
640  int find_flag));
641 DECLARE_METHOD(bool, match_key,
642  (bool record_null, long record_value,
644 DECLARE_METHOD(bool, match_key_unsigned,
645  (bool record_null, unsigned long record_value,
647 END_SERVICE_DEFINITION(pfs_plugin_column_small_v1)
648 
649 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_medium_v1)
651 DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_umediumint value));
653 DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_umediumint *value));
654 DECLARE_METHOD(void, read_key,
656  int find_flag));
657 DECLARE_METHOD(void, read_key_unsigned,
659  int find_flag));
660 DECLARE_METHOD(bool, match_key,
661  (bool record_null, long record_value,
663 DECLARE_METHOD(bool, match_key_unsigned,
664  (bool record_null, unsigned long record_value,
666 END_SERVICE_DEFINITION(pfs_plugin_column_medium_v1)
667 
668 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_integer_v1)
670 DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_uint value));
672 DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_int *value));
673 DECLARE_METHOD(void, read_key,
675  int find_flag));
676 DECLARE_METHOD(void, read_key_unsigned,
678  int find_flag));
679 DECLARE_METHOD(bool, match_key,
680  (bool record_null, long record_value,
682 DECLARE_METHOD(bool, match_key_unsigned,
683  (bool record_null, unsigned long record_value,
685 END_SERVICE_DEFINITION(pfs_plugin_column_integer_v1)
686 
687 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_bigint_v1)
689 DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_ubigint value));
691 DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_ubigint *value));
692 DECLARE_METHOD(void, read_key,
694  int find_flag));
695 DECLARE_METHOD(void, read_key_unsigned,
697  int find_flag));
698 DECLARE_METHOD(bool, match_key,
699  (bool record_null, long long record_value,
701 DECLARE_METHOD(bool, match_key_unsigned,
702  (bool record_null, unsigned long long record_value,
704 END_SERVICE_DEFINITION(pfs_plugin_column_bigint_v1)
705 
706 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_decimal_v1)
709 /* No support for indexes. */
710 END_SERVICE_DEFINITION(pfs_plugin_column_decimal_v1)
711 
712 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_float_v1)
715 /* No support for indexes. */
716 END_SERVICE_DEFINITION(pfs_plugin_column_float_v1)
717 
718 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_double_v1)
721 /* No support for indexes. */
722 END_SERVICE_DEFINITION(pfs_plugin_column_double_v1)
723 
724 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_string_v1)
725 /* CHAR */
726 DECLARE_METHOD(void, set_char_utf8,
727  (PSI_field * f, const char *value, unsigned int length));
728 DECLARE_METHOD(void, get_char_utf8,
729  (PSI_field * f, char *str, unsigned int *length));
730 DECLARE_METHOD(void, read_key_string,
732  int find_flag));
733 DECLARE_METHOD(bool, match_key_string,
734  (bool record_null, const char *record_string_value,
735  unsigned int record_string_length, PSI_plugin_key_string *key));
736 /* VARCHAR */
737 DECLARE_METHOD(void, set_varchar_utf8, (PSI_field * f, const char *str));
738 DECLARE_METHOD(void, set_varchar_utf8_len,
739  (PSI_field * f, const char *str, unsigned int len));
740 DECLARE_METHOD(void, get_varchar_utf8,
741  (PSI_field * f, char *str, unsigned int *length));
742 DECLARE_METHOD(void, set_varchar_utf8mb4, (PSI_field * f, const char *str));
743 DECLARE_METHOD(void, set_varchar_utf8mb4_len,
744  (PSI_field * f, const char *str, unsigned int len));
745 END_SERVICE_DEFINITION(pfs_plugin_column_string_v1)
746 
747 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_blob_v1)
748 DECLARE_METHOD(void, set, (PSI_field * f, const char *val, unsigned int len));
749 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
750 /* No support for indexes. */
751 END_SERVICE_DEFINITION(pfs_plugin_column_blob_v1)
752 
753 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_enum_v1)
756 /* No support for indexes. */
757 END_SERVICE_DEFINITION(pfs_plugin_column_enum_v1)
758 
759 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_date_v1)
760 DECLARE_METHOD(void, set,
761  (PSI_field * f, const char *str, unsigned int length));
762 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
763 /* No support for indexes. */
764 END_SERVICE_DEFINITION(pfs_plugin_column_date_v1)
765 
766 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_time_v1)
767 DECLARE_METHOD(void, set,
768  (PSI_field * f, const char *str, unsigned int length));
769 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
770 /* No support for indexes. */
771 END_SERVICE_DEFINITION(pfs_plugin_column_time_v1)
772 
773 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_datetime_v1)
774 DECLARE_METHOD(void, set,
775  (PSI_field * f, const char *str, unsigned int length));
776 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
777 /* No support for indexes. */
778 END_SERVICE_DEFINITION(pfs_plugin_column_datetime_v1)
779 
780 /*
781  SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
782  Introduced in MySQL 8.0.14
783  Deprecated in MySQL 8.0.17
784  Status: Deprecated, use version 2 instead.
785 */
786 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
787 DECLARE_METHOD(void, set,
788  (PSI_field * f, const char *str, unsigned int length));
789 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
790 /* No support for indexes. */
791 END_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
792 
793 /*
794  SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
795  Introduced in MySQL 8.0.17
796  Status: Active.
797 */
798 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
799 DECLARE_METHOD(void, set,
800  (PSI_field * f, const char *str, unsigned int length));
801 /* Set time stamp value in microseconds as returned by my_micro_time(). */
802 DECLARE_METHOD(void, set2, (PSI_field * f, unsigned long long val));
803 DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
804 /* No support for indexes. */
805 END_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
806 
807 BEGIN_SERVICE_DEFINITION(pfs_plugin_column_year_v1)
810 /* No support for indexes. */
811 END_SERVICE_DEFINITION(pfs_plugin_column_year_v1)
812 
813 #endif
Definition: pfs_plugin_table_service.h:422
A share to be initialized by plugin/component code and to be provided to add_table() service method o...
Definition: pfs_plugin_table_service.h:443
#define PSI_smallint
Definition: pfs_plugin_table_service.h:143
reset_position_t reset_position
Definition: pfs_plugin_table_service.h:401
update_column_value_t update_column_value
Definition: pfs_plugin_table_service.h:404
struct PSI_table_handle PSI_table_handle
This is an opaque structure to denote table handle in plugin/component code.
Definition: pfs_plugin_table_service.h:96
struct PSI_index_handle PSI_index_handle
This is an opaque structure to denote Index Handle in plugin/component code.
Definition: pfs_plugin_table_service.h:109
void set(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1)
Definition: suite_stubs.c:105
Definition: pfs_plugin_table_service.h:424
char * get_field_time(Field *f, char *val, uint *len)
Helper, read a value from an time field.
Definition: table_helper.cc:364
const char * m_name
Definition: pfs_plugin_table_service.h:161
rnd_next_t rnd_next
Definition: pfs_plugin_table_service.h:394
void set_field_date(Field *f, const char *value, uint len)
Helper, assign a value to a date field.
Definition: table_helper.cc:341
double get_field_double(Field *f)
Helper, read a value from a double field.
Definition: table_helper.cc:211
Definition: pfs_plugin_table_service.h:117
PSI_plugin_key_uinteger PSI_plugin_key_usmallint
Definition: pfs_plugin_table_service.h:189
void * handle
Definition: engine_loader.c:19
unsigned long long(* get_row_count_t)(void)
API to give number of rows in a table.
Definition: pfs_plugin_table_service.h:437
bool m_is_null
Definition: pfs_plugin_table_service.h:165
void set_field_char_utf8(Field *f, const char *str, uint len)
Helper, assign a value to a.
Definition: table_helper.cc:218
char * get_field_datetime(Field *f, char *val, uint *len)
Helper, read a value from an datetime field.
Definition: table_helper.cc:381
rnd_init_t rnd_init
Definition: pfs_plugin_table_service.h:395
void set_field_decimal(Field *f, double value)
Helper, assign a value to a decimal field.
Definition: table_helper.cc:179
#define PSI_float
Definition: pfs_plugin_table_service.h:154
delete_row_values_t delete_row_values
Definition: pfs_plugin_table_service.h:406
int(* index_read_t)(PSI_index_handle *index, PSI_key_reader *reader, unsigned int idx, int find_flag)
API to read keys in index.
Definition: pfs_plugin_table_service.h:299
enum Access_control m_acl
Definition: pfs_plugin_table_service.h:458
PSI_table_handle *(* open_table_t)(PSI_pos **pos)
API to Open a table handle in plugin/component code and reset position pointer when a new table handl...
Definition: pfs_plugin_table_service.h:380
long long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:203
struct PSI_pos PSI_pos
This is an opaque structure to denote cursor position in plugin/component code.
Definition: pfs_plugin_table_service.h:101
PSI_plugin_key_integer PSI_plugin_key_tinyint
Definition: pfs_plugin_table_service.h:170
int m_find_flags
Definition: pfs_plugin_table_service.h:229
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:214
open_table_t open_table
Definition: pfs_plugin_table_service.h:407
PSI_plugin_key_uinteger PSI_plugin_key_utinyint
Definition: pfs_plugin_table_service.h:188
int(* index_next_t)(PSI_table_handle *table)
API to read next record with matching index.
Definition: pfs_plugin_table_service.h:310
#define PSI_ubigint
Definition: pfs_plugin_table_service.h:150
A structure to denote a key of type string in an index.
Definition: pfs_plugin_table_service.h:225
void set_field_varchar_utf8(Field *f, const char *str)
Helper, assign a value to a.
Definition: table_helper.cc:249
void set_field_year(Field *f, ulong value)
Helper, assign a value to a year field.
Definition: table_helper.cc:418
int(* delete_all_rows_t)(void)
API to delete/truncate all the rows in a table.
Definition: pfs_plugin_table_service.h:430
void set_field_time(Field *f, const char *value, uint len)
Helper, assign a value to a time field.
Definition: table_helper.cc:358
unsigned int m_table_name_length
Definition: pfs_plugin_table_service.h:451
write_row_values_t write_row_values
Definition: pfs_plugin_table_service.h:403
unsigned int m_ref_length
Definition: pfs_plugin_table_service.h:455
void(* close_table_t)(PSI_table_handle *handle)
API to Close a table handle in plugin/component code and reset position pointer when a table handle i...
Definition: pfs_plugin_table_service.h:387
int(* update_column_value_t)(PSI_table_handle *handle, PSI_field *fields, unsigned int index)
API to update a column value in table.
Definition: pfs_plugin_table_service.h:359
update_row_values_t update_row_values
Definition: pfs_plugin_table_service.h:405
double get_field_float(Field *f)
Helper, read a value from a float field.
Definition: table_helper.cc:198
A structure to keep callback functions to be implemented by plugin/component.
Definition: pfs_plugin_table_service.h:393
delete_all_rows_t delete_all_rows
Definition: pfs_plugin_table_service.h:460
ulonglong get_field_enum(Field *f)
Helper, read a value from an enum field.
Definition: table_helper.cc:321
index_init_t index_init
Definition: pfs_plugin_table_service.h:397
#define PSI_mediumint
Definition: pfs_plugin_table_service.h:145
PFS_engine_table_proxy()=default
void set_field_double(Field *f, double value)
Helper, assign a value to a double field.
Definition: table_helper.cc:205
PSI_plugin_key_integer PSI_plugin_key_smallint
Definition: pfs_plugin_table_service.h:171
int(* rnd_init_t)(PSI_table_handle *handle, bool scan)
API to initialize for random scan or read.
Definition: pfs_plugin_table_service.h:262
char * index(const char *, int c)
Definition: mysql.cc:2862
char * pos
Definition: do_ctype.cc:76
write_column_value_t write_column_value
Definition: pfs_plugin_table_service.h:402
char * get_field_timestamp(Field *f, char *val, uint *len)
Helper, read a value from an timestamp field.
Definition: table_helper.cc:398
unsigned long long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:218
#define DECLARE_METHOD(retval, name, args)
ulong get_field_year(Field *f)
Helper, read a value from an year field.
Definition: table_helper.cc:424
close_table_t close_table
Definition: pfs_plugin_table_service.h:408
int(* index_init_t)(PSI_table_handle *table, unsigned int idx, bool sorted, PSI_index_handle **index)
API to initialize index(es).
Definition: pfs_plugin_table_service.h:286
#define PSI_utinyint
Definition: pfs_plugin_table_service.h:142
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:179
bool m_is_null
Definition: pfs_plugin_table_service.h:231
get_row_count_t get_row_count
Definition: pfs_plugin_table_service.h:461
read_column_value_t read_column_value
Definition: pfs_plugin_table_service.h:400
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:181
unsigned long val
Definition: pfs_plugin_table_service.h:118
#define PSI_enum
Definition: pfs_plugin_table_service.h:152
PSI_plugin_key_integer PSI_plugin_key_mediumint
Definition: pfs_plugin_table_service.h:172
A structure to denote a key of type unsigned long long in an index.
Definition: pfs_plugin_table_service.h:210
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:216
bool is_null
Definition: pfs_plugin_table_service.h:119
void set_field_varchar_utf8mb4(Field *f, const char *str)
Helper, assign a value to a.
Definition: table_helper.cc:277
const char * m_table_name
Definition: pfs_plugin_table_service.h:449
bool is_null
Definition: pfs_plugin_table_service.h:125
void set_field_timestamp(Field *f, const char *value, uint len)
Helper, assign a value to a timestamp field.
Definition: table_helper.cc:392
index_read_t index_read
Definition: pfs_plugin_table_service.h:398
long long val
Definition: pfs_plugin_table_service.h:124
String * get_field_char_utf8(Field *f, String *val)
Helper, read a value from a.
Definition: table_helper.cc:224
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:183
#define BEGIN_SERVICE_DEFINITION(name)
char * get_field_date(Field *f, char *val, uint *len)
Helper, read a value from an date field.
Definition: table_helper.cc:347
bool is_null
Definition: pfs_plugin_table_service.h:137
Definition: pfs_plugin_table_service.h:135
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:199
String * get_field_varchar_utf8(Field *f, String *val)
Helper, read a value from a.
Definition: table_helper.cc:261
long val
Definition: pfs_plugin_table_service.h:112
void(* reset_position_t)(PSI_table_handle *handle)
API to reset cursor position.
Definition: pfs_plugin_table_service.h:316
void set_field_blob(Field *f, const char *val, size_t len)
Helper, assign a value to a text/blob field.
Definition: table_helper.cc:290
Definition: pfs_plugin_table_service.h:111
#define PSI_uint
Definition: pfs_plugin_table_service.h:148
PSI_plugin_key_uinteger PSI_plugin_key_umediumint
Definition: pfs_plugin_table_service.h:190
double val
Definition: pfs_plugin_table_service.h:136
static const char * key
Definition: suite_stubs.c:14
long m_value
Definition: pfs_plugin_table_service.h:167
index_next_t index_next
Definition: pfs_plugin_table_service.h:399
Type get(const Shards< COUNT > &shards, size_t id)
Get the counter value for a shard.
Definition: ut0counter.h:272
rnd_pos_t rnd_pos
Definition: pfs_plugin_table_service.h:396
bool is_null
Definition: pfs_plugin_table_service.h:113
int m_find_flags
Definition: pfs_plugin_table_service.h:163
void set_field_datetime(Field *f, const char *value, uint len)
Helper, assign a value to a datetime field.
Definition: table_helper.cc:375
Definition: pfs_plugin_table_service.h:83
int(* delete_row_values_t)(PSI_table_handle *handle)
API to delete record from table.
Definition: pfs_plugin_table_service.h:371
Access_control
Types of access allowed to tables.
Definition: pfs_plugin_table_service.h:416
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:201
A structure to denote a key of type long long in an index.
Definition: pfs_plugin_table_service.h:195
Definition: pfs_plugin_table_service.h:418
char * get_field_blob(Field *f, char *val, uint *len)
Helper, read a value from a blob field.
Definition: table_helper.cc:304
int(* update_row_values_t)(PSI_table_handle *handle)
API to write a record in table.
Definition: pfs_plugin_table_service.h:365
unsigned int length
Definition: pfs_plugin_table_service.h:85
unsigned long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:185
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:197
A structure to denote a key of type ulong in an index.
Definition: pfs_plugin_table_service.h:177
Definition: pfs_plugin_table_service.h:420
const char * m_name
Definition: pfs_plugin_table_service.h:227
#define PSI_umediumint
Definition: pfs_plugin_table_service.h:146
Definition: pfs_plugin_table_service.h:123
struct PSI_field PSI_field
This is an opaque structure to denote filed in plugin/component code.
Definition: pfs_plugin_table_service.h:92
const string value("\alue\)
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:212
struct PSI_key_reader PSI_key_reader
This is an opaque structure to denote Key Reader in plugin/component code.
Definition: pfs_plugin_table_service.h:105
void set_field_float(Field *f, double value)
Helper, assign a value to a float field.
Definition: table_helper.cc:192
#define END_SERVICE_DEFINITION(name)
bool is_null
Definition: pfs_plugin_table_service.h:131
#define PSI_bigint
Definition: pfs_plugin_table_service.h:149
int(* rnd_pos_t)(PSI_table_handle *handle)
API to read row from a position which is set in table handle.
Definition: pfs_plugin_table_service.h:272
void set_field_enum(Field *f, ulonglong value)
Helper, assign a value to an enum field.
Definition: table_helper.cc:315
#define PSI_usmallint
Definition: pfs_plugin_table_service.h:144
char * str
Definition: pfs_plugin_table_service.h:84
A structure to denote a key of type long in an index.
Definition: pfs_plugin_table_service.h:159
#define PSI_year
Definition: pfs_plugin_table_service.h:151
int(* write_row_values_t)(PSI_table_handle *handle)
API to write a record in table.
Definition: pfs_plugin_table_service.h:347
Specifies macros to define Service Implementations.
Definition: pfs_plugin_table_service.h:129
int(* write_column_value_t)(PSI_table_handle *handle, PSI_field *fields, unsigned int index)
API to write a column value in table.
Definition: pfs_plugin_table_service.h:341
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
unsigned int m_value_buffer_capacity
Definition: pfs_plugin_table_service.h:238
PFS_engine_table_proxy m_proxy_engine_table
Definition: pfs_plugin_table_service.h:446
#define PSI_tinyint
Definition: pfs_plugin_table_service.h:141
double get_field_decimal(Field *f)
Helper, read a value from a decimal field.
Definition: table_helper.cc:185
int(* read_column_value_t)(PSI_table_handle *handle, PSI_field *field, unsigned int index)
API to read a column value from table.
Definition: pfs_plugin_table_service.h:328
const char * m_table_definition
Definition: pfs_plugin_table_service.h:454
unsigned long long val
Definition: pfs_plugin_table_service.h:130
unsigned int m_value_buffer_length
Definition: pfs_plugin_table_service.h:236
#define PSI_decimal
Definition: pfs_plugin_table_service.h:153
char * m_value_buffer
Definition: pfs_plugin_table_service.h:233
#define PSI_int
Definition: pfs_plugin_table_service.h:147
int(* rnd_next_t)(PSI_table_handle *handle)
Api to read the next record.
Definition: pfs_plugin_table_service.h:250