MySQL 8.0.30
Source Code Documentation
pfs_plugin_table_service.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, 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 */
83struct PFS_string {
84 char *str;
85 unsigned int length;
86};
87typedef struct PFS_string PFS_string;
88
89/**
90 This is an opaque structure to denote filed in plugin/component code.
91*/
92typedef 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*/
101typedef 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
111struct PSI_long {
112 long val; /* Column value */
113 bool is_null; /* If Column value is NULL */
114};
115typedef struct PSI_long PSI_long;
116
117struct PSI_ulong {
118 unsigned long val; /* Column value */
119 bool is_null; /* If Column value is NULL */
120};
121typedef struct PSI_ulong PSI_ulong;
122
124 long long val; /* Column value */
125 bool is_null /* If Column value is NULL */;
126};
128
130 unsigned long long val; /* Column value */
131 bool is_null /* If Column value is NULL */;
132};
134
136 double val; /* Column value */
137 bool is_null /* If Column value is NULL */;
138};
139typedef 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 */
166 /* value of the key column */
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 */
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 */
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 */
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 */
232 /* buffer to store key column value */
234 // FIXME: size_t
235 /* length of the key value in buffer */
237 /* buffer size = number of characters * max multibyte length */
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*/
262typedef 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 True if he index is sorted (typically a BTREE), false if not
280 sorted (typically a HASH)
281 @param index Initialized index handle.
282
283 @return Operation status
284 @retval 0 Success
285 @retval !=0 Error
286*/
287typedef int (*index_init_t)(PSI_table_handle *handle, unsigned int idx,
288 bool sorted, PSI_index_handle **index);
289/**
290 API to read keys in index.
291 @param index Index handle.
292 @param reader Key reader.
293 @param idx Index of the index to be read.
294 @param find_flag find flag.
295
296 @return Operation status
297 @retval 0 Success
298 @retval !=0 Error
299*/
300typedef int (*index_read_t)(PSI_index_handle *index, PSI_key_reader *reader,
301 unsigned int idx, int find_flag);
302
303/**
304 API to read next record with matching index.
305 @param handle Table handle.
306
307 @return Operation status
308 @retval 0 Success
309 @retval !=0 Error
310*/
312
313/**
314 API to reset cursor position
315 @param handle Table handle.
316*/
318
319/**
320 API to read a column value from table.
321 @param handle Table handle.
322 @param field Field for which value is to be read.
323 @param index Index of field in table column.
324
325 @return Operation status
326 @retval 0 Success
327 @retval !=0 Error
328*/
330 unsigned int index);
331
332/**
333 API to write a column value in table.
334 @param handle Table handle.
335 @param field Field for which value is to be written.
336 @param index Index of field in table column.
337
338 @return Operation status
339 @retval 0 Success
340 @retval !=0 Error
341*/
343 unsigned int index);
344/**
345 API to write a record in table.
346 @param handle Table handle having new record to be written.
347*/
349
350/**
351 API to update a column value in table.
352 @param handle Table handle.
353 @param field Field for which value is to be updated.
354 @param index Index of field in table column.
355
356 @return Operation status
357 @retval 0 Success
358 @retval !=0 Error
359*/
361 unsigned int index);
362/**
363 API to write a record in table.
364 @param handle Table handle having updated record to be updated.
365*/
367
368/**
369 API to delete record from table.
370 @param handle Table handle having record to be deleted.
371*/
373
374/**
375 API to Open a table handle in plugin/component code and reset position
376 pointer when a new table handle in opened in Performance Schema.
377 @param pos pos pointer to be updated.
378
379 @return initialized table handle.
380*/
381typedef PSI_table_handle *(*open_table_t)(PSI_pos **pos);
382
383/**
384 API to Close a table handle in plugin/component code and reset position
385 pointer when a table handle in closed in Performance Schema.
386 @param handle table handle
387*/
389
390/**
391 A structure to keep callback functions to be implemented by
392 plugin/component.
393*/
411};
413
414/**
415 Types of access allowed to tables.
416*/
418 /* Only Read is allowed */
420 /* Read/Truncate allowed but no Update/Insert/Delete. */
422 /* Read/Truncate/Update allowed but no Insert/Delete. */
424 /* Read/Truncate/Insert/UPDATE/Delete allowed. */
427
428/**
429 API to delete/truncate all the rows in a table
430*/
431typedef int (*delete_all_rows_t)(void);
432
433/**
434 API to give number of rows in a table
435
436 @return number of rows.
437*/
438typedef unsigned long long (*get_row_count_t)(void);
439
440/**
441 A share to be initialized by plugin/component code and to be provided
442 to add_table() service method of pfs_plugin_table service.
443 */
445 public:
446 /* Callback functions list of APIs */
448
449 /* Name of the table to be added */
450 const char *m_table_name;
451 /* Length of the table name */
453
454 /* Table Columns definition */
456 unsigned int m_ref_length;
457
458 /* Access allowed on the table */
460
463};
465
466/**
467 Definition of pfs_plugin_table service and its methods.
468 @deprecated
469 This service is functional but incomplete,
470 as many apis are missing.
471 Please use pfs_plugin_table_v1
472 and pfs_plugin_column_*_v1 instead.
473*/
475/* Methods to add tables in Performance Schema */
476DECLARE_METHOD(int, add_tables,
477 (PFS_engine_table_share_proxy * *st_share,
478 unsigned int share_count));
479
480/* Methods to delete tables in Performance Schema */
481DECLARE_METHOD(int, delete_tables,
482 (PFS_engine_table_share_proxy * *st_share,
483 unsigned int share_count));
484
485/* TINYINT */
486DECLARE_METHOD(void, set_field_tinyint, (PSI_field * f, PSI_tinyint value));
487DECLARE_METHOD(void, set_field_utinyint, (PSI_field * f, PSI_utinyint value));
488DECLARE_METHOD(void, get_field_tinyint, (PSI_field * f, PSI_tinyint *value));
489
490/* SMALLINT */
491DECLARE_METHOD(void, set_field_smallint, (PSI_field * f, PSI_smallint value));
492DECLARE_METHOD(void, set_field_usmallint, (PSI_field * f, PSI_usmallint value));
493DECLARE_METHOD(void, get_field_smallint, (PSI_field * f, PSI_smallint *value));
494
495/* MEDIUMINT */
496DECLARE_METHOD(void, set_field_mediumint, (PSI_field * f, PSI_mediumint value));
497DECLARE_METHOD(void, set_field_umediumint,
499DECLARE_METHOD(void, get_field_mediumint,
500 (PSI_field * f, PSI_mediumint *value));
501
502/* INTEGER(INT) */
503DECLARE_METHOD(void, set_field_integer, (PSI_field * f, PSI_int value));
504DECLARE_METHOD(void, set_field_uinteger, (PSI_field * f, PSI_uint value));
505DECLARE_METHOD(void, get_field_integer, (PSI_field * f, PSI_int *value));
506DECLARE_METHOD(void, read_key_integer,
508 int find_flag));
509DECLARE_METHOD(bool, match_key_integer,
510 (bool record_null, long record_value,
512
513/* BIGINT */
514DECLARE_METHOD(void, set_field_bigint, (PSI_field * f, PSI_bigint value));
515DECLARE_METHOD(void, set_field_ubigint, (PSI_field * f, PSI_ubigint value));
516DECLARE_METHOD(void, get_field_bigint, (PSI_field * f, PSI_bigint *value));
517
518/* DECIMAL */
521
522/* FLOAT */
525
526/* DOUBLE */
529
530/* CHAR */
532 (PSI_field * f, const char *value, unsigned int length));
534 (PSI_field * f, char *str, unsigned int *length));
535DECLARE_METHOD(void, read_key_string,
537 int find_flag));
538DECLARE_METHOD(bool, match_key_string,
539 (bool record_null, const char *record_string_value,
540 unsigned int record_string_length, PSI_plugin_key_string *key));
541
542/* VARCHAR */
544DECLARE_METHOD(void, set_field_varchar_utf8_len,
545 (PSI_field * f, const char *str, unsigned int len));
547 (PSI_field * f, char *str, unsigned int *length));
548
550 (PSI_field * f, const char *str));
551DECLARE_METHOD(void, set_field_varchar_utf8mb4_len,
552 (PSI_field * f, const char *str, unsigned int len));
553
554/* BLOB/TEXT */
556 (PSI_field * f, const char *val, unsigned int len));
558 (PSI_field * f, char *val, unsigned int *len));
559
560/* ENUM */
563
564/* DATE */
566 (PSI_field * f, const char *str, unsigned int length));
568 (PSI_field * f, char *val, unsigned int *len));
569
570/* TIME */
572 (PSI_field * f, const char *str, unsigned int length));
574 (PSI_field * f, char *val, unsigned int *len));
575
576/* DATETIME */
578 (PSI_field * f, const char *str, unsigned int length));
580 (PSI_field * f, char *val, unsigned int *len));
581
582/* TIMESTAMP */
584 (PSI_field * f, const char *str, unsigned int length));
586 (PSI_field * f, char *val, unsigned int *len));
587
588/* YEAR */
591
592/* NULL */
593DECLARE_METHOD(void, set_field_null, (PSI_field * f));
594
595END_SERVICE_DEFINITION(pfs_plugin_table)
596
597/**
598 Definition of pfs_plugin_table_v1 service and its methods.
599*/
600BEGIN_SERVICE_DEFINITION(pfs_plugin_table_v1)
601DECLARE_METHOD(int, add_tables,
602 (PFS_engine_table_share_proxy * *st_share,
603 unsigned int share_count));
604
605DECLARE_METHOD(int, delete_tables,
606 (PFS_engine_table_share_proxy * *st_share,
607 unsigned int share_count));
608DECLARE_METHOD(unsigned int, get_parts_found, (PSI_key_reader * reader));
609END_SERVICE_DEFINITION(pfs_plugin_table_v1)
610
611BEGIN_SERVICE_DEFINITION(pfs_plugin_column_tiny_v1)
613DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_utinyint value));
615DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_utinyint *value));
616DECLARE_METHOD(void, read_key,
618 int find_flag));
619DECLARE_METHOD(void, read_key_unsigned,
621 int find_flag));
622DECLARE_METHOD(bool, match_key,
623 (bool record_null, long record_value,
625DECLARE_METHOD(bool, match_key_unsigned,
626 (bool record_null, unsigned long record_value,
628
629END_SERVICE_DEFINITION(pfs_plugin_column_tiny_v1)
630
631BEGIN_SERVICE_DEFINITION(pfs_plugin_column_small_v1)
633DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_usmallint value));
635DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_usmallint *value));
636DECLARE_METHOD(void, read_key,
638 int find_flag));
639DECLARE_METHOD(void, read_key_unsigned,
641 int find_flag));
642DECLARE_METHOD(bool, match_key,
643 (bool record_null, long record_value,
645DECLARE_METHOD(bool, match_key_unsigned,
646 (bool record_null, unsigned long record_value,
648END_SERVICE_DEFINITION(pfs_plugin_column_small_v1)
649
650BEGIN_SERVICE_DEFINITION(pfs_plugin_column_medium_v1)
652DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_umediumint value));
654DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_umediumint *value));
655DECLARE_METHOD(void, read_key,
657 int find_flag));
658DECLARE_METHOD(void, read_key_unsigned,
660 int find_flag));
661DECLARE_METHOD(bool, match_key,
662 (bool record_null, long record_value,
664DECLARE_METHOD(bool, match_key_unsigned,
665 (bool record_null, unsigned long record_value,
667END_SERVICE_DEFINITION(pfs_plugin_column_medium_v1)
668
669BEGIN_SERVICE_DEFINITION(pfs_plugin_column_integer_v1)
670DECLARE_METHOD(void, set, (PSI_field * f, PSI_int value));
671DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_uint value));
672DECLARE_METHOD(void, get, (PSI_field * f, PSI_int *value));
673DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_int *value));
674DECLARE_METHOD(void, read_key,
676 int find_flag));
677DECLARE_METHOD(void, read_key_unsigned,
679 int find_flag));
680DECLARE_METHOD(bool, match_key,
681 (bool record_null, long record_value,
683DECLARE_METHOD(bool, match_key_unsigned,
684 (bool record_null, unsigned long record_value,
686END_SERVICE_DEFINITION(pfs_plugin_column_integer_v1)
687
688BEGIN_SERVICE_DEFINITION(pfs_plugin_column_bigint_v1)
690DECLARE_METHOD(void, set_unsigned, (PSI_field * f, PSI_ubigint value));
692DECLARE_METHOD(void, get_unsigned, (PSI_field * f, PSI_ubigint *value));
693DECLARE_METHOD(void, read_key,
695 int find_flag));
696DECLARE_METHOD(void, read_key_unsigned,
698 int find_flag));
699DECLARE_METHOD(bool, match_key,
700 (bool record_null, long long record_value,
702DECLARE_METHOD(bool, match_key_unsigned,
703 (bool record_null, unsigned long long record_value,
705END_SERVICE_DEFINITION(pfs_plugin_column_bigint_v1)
706
707BEGIN_SERVICE_DEFINITION(pfs_plugin_column_decimal_v1)
710/* No support for indexes. */
711END_SERVICE_DEFINITION(pfs_plugin_column_decimal_v1)
712
713BEGIN_SERVICE_DEFINITION(pfs_plugin_column_float_v1)
715DECLARE_METHOD(void, get, (PSI_field * f, PSI_float *value));
716/* No support for indexes. */
717END_SERVICE_DEFINITION(pfs_plugin_column_float_v1)
718
719BEGIN_SERVICE_DEFINITION(pfs_plugin_column_double_v1)
722/* No support for indexes. */
723END_SERVICE_DEFINITION(pfs_plugin_column_double_v1)
724
725BEGIN_SERVICE_DEFINITION(pfs_plugin_column_string_v1)
726/* CHAR */
727DECLARE_METHOD(void, set_char_utf8,
728 (PSI_field * f, const char *value, unsigned int length));
729DECLARE_METHOD(void, get_char_utf8,
730 (PSI_field * f, char *str, unsigned int *length));
731DECLARE_METHOD(void, read_key_string,
733 int find_flag));
734DECLARE_METHOD(bool, match_key_string,
735 (bool record_null, const char *record_string_value,
736 unsigned int record_string_length, PSI_plugin_key_string *key));
737/* VARCHAR */
738DECLARE_METHOD(void, set_varchar_utf8, (PSI_field * f, const char *str));
739DECLARE_METHOD(void, set_varchar_utf8_len,
740 (PSI_field * f, const char *str, unsigned int len));
741DECLARE_METHOD(void, get_varchar_utf8,
742 (PSI_field * f, char *str, unsigned int *length));
743DECLARE_METHOD(void, set_varchar_utf8mb4, (PSI_field * f, const char *str));
744DECLARE_METHOD(void, set_varchar_utf8mb4_len,
745 (PSI_field * f, const char *str, unsigned int len));
746END_SERVICE_DEFINITION(pfs_plugin_column_string_v1)
747
748BEGIN_SERVICE_DEFINITION(pfs_plugin_column_blob_v1)
749DECLARE_METHOD(void, set, (PSI_field * f, const char *val, unsigned int len));
750DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
751/* No support for indexes. */
752END_SERVICE_DEFINITION(pfs_plugin_column_blob_v1)
753
754BEGIN_SERVICE_DEFINITION(pfs_plugin_column_enum_v1)
756DECLARE_METHOD(void, get, (PSI_field * f, PSI_enum *value));
757/* No support for indexes. */
758END_SERVICE_DEFINITION(pfs_plugin_column_enum_v1)
759
760BEGIN_SERVICE_DEFINITION(pfs_plugin_column_date_v1)
761DECLARE_METHOD(void, set,
762 (PSI_field * f, const char *str, unsigned int length));
763DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
764/* No support for indexes. */
765END_SERVICE_DEFINITION(pfs_plugin_column_date_v1)
766
767BEGIN_SERVICE_DEFINITION(pfs_plugin_column_time_v1)
768DECLARE_METHOD(void, set,
769 (PSI_field * f, const char *str, unsigned int length));
770DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
771/* No support for indexes. */
772END_SERVICE_DEFINITION(pfs_plugin_column_time_v1)
773
774BEGIN_SERVICE_DEFINITION(pfs_plugin_column_datetime_v1)
775DECLARE_METHOD(void, set,
776 (PSI_field * f, const char *str, unsigned int length));
777DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
778/* No support for indexes. */
779END_SERVICE_DEFINITION(pfs_plugin_column_datetime_v1)
780
781/*
782 SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
783 Introduced in MySQL 8.0.14
784 Deprecated in MySQL 8.0.17
785 Status: Deprecated, use version 2 instead.
786*/
787BEGIN_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
788DECLARE_METHOD(void, set,
789 (PSI_field * f, const char *str, unsigned int length));
790DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
791/* No support for indexes. */
792END_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v1)
793
794/*
795 SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
796 Introduced in MySQL 8.0.17
797 Status: Active.
798*/
799BEGIN_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
800DECLARE_METHOD(void, set,
801 (PSI_field * f, const char *str, unsigned int length));
802/* Set time stamp value in microseconds as returned by my_micro_time(). */
803DECLARE_METHOD(void, set2, (PSI_field * f, unsigned long long val));
804DECLARE_METHOD(void, get, (PSI_field * f, char *val, unsigned int *len));
805/* No support for indexes. */
806END_SERVICE_DEFINITION(pfs_plugin_column_timestamp_v2)
807
808BEGIN_SERVICE_DEFINITION(pfs_plugin_column_year_v1)
810DECLARE_METHOD(void, get, (PSI_field * f, PSI_year *value));
811/* No support for indexes. */
812END_SERVICE_DEFINITION(pfs_plugin_column_year_v1)
813
814#endif
char * pos
Definition: do_ctype.cc:76
double get_field_double(Field *f)
Helper, read a value from a double field.
Definition: table_helper.cc:214
void set_field_float(Field *f, double value)
Helper, assign a value to a float field.
Definition: table_helper.cc:195
void set_field_varchar_utf8mb4(Field *f, const char *str)
Helper, assign a value to a.
Definition: table_helper.cc:280
ulonglong get_field_enum(Field *f)
Helper, read a value from an enum field.
Definition: table_helper.cc:324
void set_field_date(Field *f, const char *value, uint len)
Helper, assign a value to a date field.
Definition: table_helper.cc:344
char * get_field_timestamp(Field *f, char *val, uint *len)
Helper, read a value from an timestamp field.
Definition: table_helper.cc:401
void set_field_time(Field *f, const char *value, uint len)
Helper, assign a value to a time field.
Definition: table_helper.cc:361
char * get_field_blob(Field *f, char *val, uint *len)
Helper, read a value from a blob field.
Definition: table_helper.cc:307
void set_field_decimal(Field *f, double value)
Helper, assign a value to a decimal field.
Definition: table_helper.cc:182
void set_field_enum(Field *f, ulonglong value)
Helper, assign a value to an enum field.
Definition: table_helper.cc:318
char * get_field_datetime(Field *f, char *val, uint *len)
Helper, read a value from an datetime field.
Definition: table_helper.cc:384
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:293
char * get_field_time(Field *f, char *val, uint *len)
Helper, read a value from an time field.
Definition: table_helper.cc:367
String * get_field_char_utf8(Field *f, String *val)
Helper, read a value from a.
Definition: table_helper.cc:227
void set_field_timestamp(Field *f, const char *value, uint len)
Helper, assign a value to a timestamp field.
Definition: table_helper.cc:395
void set_field_year(Field *f, ulong value)
Helper, assign a value to a year field.
Definition: table_helper.cc:420
void set_field_double(Field *f, double value)
Helper, assign a value to a double field.
Definition: table_helper.cc:208
void set_field_char_utf8(Field *f, const char *str, uint len)
Helper, assign a value to a.
Definition: table_helper.cc:221
String * get_field_varchar_utf8(Field *f, String *val)
Helper, read a value from a.
Definition: table_helper.cc:264
void set_field_datetime(Field *f, const char *value, uint len)
Helper, assign a value to a datetime field.
Definition: table_helper.cc:378
double get_field_float(Field *f)
Helper, read a value from a float field.
Definition: table_helper.cc:201
ulong get_field_year(Field *f)
Helper, read a value from an year field.
Definition: table_helper.cc:426
char * get_field_date(Field *f, char *val, uint *len)
Helper, read a value from an date field.
Definition: table_helper.cc:350
void set_field_varchar_utf8(Field *f, const char *str)
Helper, assign a value to a.
Definition: table_helper.cc:252
double get_field_decimal(Field *f)
Helper, read a value from a decimal field.
Definition: table_helper.cc:188
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1055
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
static mysql_service_status_t get(reference_caching_cache cache, unsigned service_name_index, const my_h_service **refs) noexcept
Definition: component.cc:113
static int handle(int sql_errno, const char *sqlstate, const char *message, void *state)
Bridge function between the C++ API offered by this module and the C API of the parser service.
Definition: services.cc:64
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2863
Access_control
Types of access allowed to tables.
Definition: pfs_plugin_table_service.h:417
@ READONLY
Definition: pfs_plugin_table_service.h:419
@ EDITABLE
Definition: pfs_plugin_table_service.h:425
@ UPDATABLE
Definition: pfs_plugin_table_service.h:423
@ TRUNCATABLE
Definition: pfs_plugin_table_service.h:421
int(* write_row_values_t)(PSI_table_handle *handle)
API to write a record in table.
Definition: pfs_plugin_table_service.h:348
PSI_plugin_key_uinteger PSI_plugin_key_usmallint
Definition: pfs_plugin_table_service.h:189
PSI_plugin_key_integer PSI_plugin_key_tinyint
Definition: pfs_plugin_table_service.h:170
int(* delete_row_values_t)(PSI_table_handle *handle)
API to delete record from table.
Definition: pfs_plugin_table_service.h:372
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:300
int(* update_row_values_t)(PSI_table_handle *handle)
API to write a record in table.
Definition: pfs_plugin_table_service.h:366
PSI_plugin_key_integer PSI_plugin_key_smallint
Definition: pfs_plugin_table_service.h:171
#define PSI_float
Definition: pfs_plugin_table_service.h:154
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
#define PSI_tinyint
Definition: pfs_plugin_table_service.h:141
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_uinteger PSI_plugin_key_utinyint
Definition: pfs_plugin_table_service.h:188
int(* rnd_next_t)(PSI_table_handle *handle)
Api to read the next record.
Definition: pfs_plugin_table_service.h:250
#define PSI_int
Definition: pfs_plugin_table_service.h:147
#define PSI_smallint
Definition: pfs_plugin_table_service.h:143
int(* update_column_value_t)(PSI_table_handle *handle, PSI_field *field, unsigned int index)
API to update a column value in table.
Definition: pfs_plugin_table_service.h:360
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:329
int(* index_next_t)(PSI_table_handle *handle)
API to read next record with matching index.
Definition: pfs_plugin_table_service.h:311
#define PSI_enum
Definition: pfs_plugin_table_service.h:152
PSI_plugin_key_uinteger PSI_plugin_key_umediumint
Definition: pfs_plugin_table_service.h:190
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:388
#define PSI_decimal
Definition: pfs_plugin_table_service.h:153
#define PSI_bigint
Definition: pfs_plugin_table_service.h:149
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:381
#define PSI_year
Definition: pfs_plugin_table_service.h:151
PSI_plugin_key_integer PSI_plugin_key_mediumint
Definition: pfs_plugin_table_service.h:172
int(* write_column_value_t)(PSI_table_handle *handle, PSI_field *field, unsigned int index)
API to write a column value in table.
Definition: pfs_plugin_table_service.h:342
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
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
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
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
unsigned long long(* get_row_count_t)(void)
API to give number of rows in a table.
Definition: pfs_plugin_table_service.h:438
#define PSI_utinyint
Definition: pfs_plugin_table_service.h:142
void(* reset_position_t)(PSI_table_handle *handle)
API to reset cursor position.
Definition: pfs_plugin_table_service.h:317
#define PSI_mediumint
Definition: pfs_plugin_table_service.h:145
#define PSI_umediumint
Definition: pfs_plugin_table_service.h:146
int(* delete_all_rows_t)(void)
API to delete/truncate all the rows in a table.
Definition: pfs_plugin_table_service.h:431
#define PSI_uint
Definition: pfs_plugin_table_service.h:148
int(* index_init_t)(PSI_table_handle *handle, unsigned int idx, bool sorted, PSI_index_handle **index)
API to initialize index(es).
Definition: pfs_plugin_table_service.h:287
struct PSI_field PSI_field
This is an opaque structure to denote filed in plugin/component code.
Definition: pfs_plugin_table_service.h:92
#define PSI_usmallint
Definition: pfs_plugin_table_service.h:144
#define PSI_ubigint
Definition: pfs_plugin_table_service.h:150
required string key
Definition: replication_asynchronous_connection_failover.proto:59
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:102
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
Specifies macros to define Service Implementations.
A structure to keep callback functions to be implemented by plugin/component.
Definition: pfs_plugin_table_service.h:394
index_next_t index_next
Definition: pfs_plugin_table_service.h:400
PFS_engine_table_proxy()=default
close_table_t close_table
Definition: pfs_plugin_table_service.h:409
rnd_next_t rnd_next
Definition: pfs_plugin_table_service.h:395
reset_position_t reset_position
Definition: pfs_plugin_table_service.h:402
write_row_values_t write_row_values
Definition: pfs_plugin_table_service.h:404
rnd_pos_t rnd_pos
Definition: pfs_plugin_table_service.h:397
write_column_value_t write_column_value
Definition: pfs_plugin_table_service.h:403
read_column_value_t read_column_value
Definition: pfs_plugin_table_service.h:401
update_column_value_t update_column_value
Definition: pfs_plugin_table_service.h:405
rnd_init_t rnd_init
Definition: pfs_plugin_table_service.h:396
update_row_values_t update_row_values
Definition: pfs_plugin_table_service.h:406
index_read_t index_read
Definition: pfs_plugin_table_service.h:399
open_table_t open_table
Definition: pfs_plugin_table_service.h:408
delete_row_values_t delete_row_values
Definition: pfs_plugin_table_service.h:407
index_init_t index_init
Definition: pfs_plugin_table_service.h:398
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:444
delete_all_rows_t delete_all_rows
Definition: pfs_plugin_table_service.h:461
const char * m_table_name
Definition: pfs_plugin_table_service.h:450
const char * m_table_definition
Definition: pfs_plugin_table_service.h:455
PFS_engine_table_proxy m_proxy_engine_table
Definition: pfs_plugin_table_service.h:447
unsigned int m_table_name_length
Definition: pfs_plugin_table_service.h:452
enum Access_control m_acl
Definition: pfs_plugin_table_service.h:459
get_row_count_t get_row_count
Definition: pfs_plugin_table_service.h:462
unsigned int m_ref_length
Definition: pfs_plugin_table_service.h:456
Definition: pfs_plugin_table_service.h:83
unsigned int length
Definition: pfs_plugin_table_service.h:85
char * str
Definition: pfs_plugin_table_service.h:84
Definition: pfs_plugin_table_service.h:135
bool is_null
Definition: pfs_plugin_table_service.h:137
double val
Definition: pfs_plugin_table_service.h:136
Definition: pfs_plugin_table_service.h:111
bool is_null
Definition: pfs_plugin_table_service.h:113
long val
Definition: pfs_plugin_table_service.h:112
Definition: pfs_plugin_table_service.h:123
long long val
Definition: pfs_plugin_table_service.h:124
bool is_null
Definition: pfs_plugin_table_service.h:125
A structure to denote a key of type long long in an index.
Definition: pfs_plugin_table_service.h:195
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:199
long long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:203
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:201
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:197
A structure to denote a key of type long in an index.
Definition: pfs_plugin_table_service.h:159
const char * m_name
Definition: pfs_plugin_table_service.h:161
bool m_is_null
Definition: pfs_plugin_table_service.h:165
long m_value
Definition: pfs_plugin_table_service.h:167
int m_find_flags
Definition: pfs_plugin_table_service.h:163
A structure to denote a key of type string in an index.
Definition: pfs_plugin_table_service.h:225
unsigned int m_value_buffer_length
Definition: pfs_plugin_table_service.h:236
bool m_is_null
Definition: pfs_plugin_table_service.h:231
unsigned int m_value_buffer_capacity
Definition: pfs_plugin_table_service.h:238
int m_find_flags
Definition: pfs_plugin_table_service.h:229
const char * m_name
Definition: pfs_plugin_table_service.h:227
char * m_value_buffer
Definition: pfs_plugin_table_service.h:233
A structure to denote a key of type unsigned long long in an index.
Definition: pfs_plugin_table_service.h:210
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:214
unsigned long long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:218
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:216
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:212
A structure to denote a key of type ulong in an index.
Definition: pfs_plugin_table_service.h:177
const char * m_name
Name of the key column.
Definition: pfs_plugin_table_service.h:179
bool m_is_null
Column is NULL.
Definition: pfs_plugin_table_service.h:183
int m_find_flags
Find flags.
Definition: pfs_plugin_table_service.h:181
unsigned long m_value
Value of the key column.
Definition: pfs_plugin_table_service.h:185
Definition: pfs_plugin_table_service.h:117
bool is_null
Definition: pfs_plugin_table_service.h:119
unsigned long val
Definition: pfs_plugin_table_service.h:118
Definition: pfs_plugin_table_service.h:129
unsigned long long val
Definition: pfs_plugin_table_service.h:130
bool is_null
Definition: pfs_plugin_table_service.h:131