33
33
#include <drizzled/field.h>
34
34
#include <drizzled/table.h>
35
35
#include <drizzled/plugin/info_schema_table.h>
36
#include <drizzled/time_functions.h>
36
37
#include "drizzled/global_charset_info.h"
72
75
#define STRUCT_FLD(name, value) value
74
drizzled::plugin::InfoSchemaTable *innodb_trx_schema_table= NULL;
75
drizzled::plugin::InfoSchemaTable *innodb_locks_schema_table= NULL;
76
drizzled::plugin::InfoSchemaTable *innodb_lock_waits_schema_table= NULL;
77
drizzled::plugin::InfoSchemaTable *innodb_cmp_schema_table= NULL;
78
drizzled::plugin::InfoSchemaTable *innodb_cmp_reset_schema_table= NULL;
79
drizzled::plugin::InfoSchemaTable *innodb_cmpmem_schema_table= NULL;
80
drizzled::plugin::InfoSchemaTable *innodb_cmpmem_reset_schema_table= NULL;
77
plugin::InfoSchemaTable *innodb_trx_schema_table= NULL;
78
plugin::InfoSchemaTable *innodb_locks_schema_table= NULL;
79
plugin::InfoSchemaTable *innodb_lock_waits_schema_table= NULL;
80
plugin::InfoSchemaTable *innodb_cmp_schema_table= NULL;
81
plugin::InfoSchemaTable *innodb_cmp_reset_schema_table= NULL;
82
plugin::InfoSchemaTable *innodb_cmpmem_schema_table= NULL;
83
plugin::InfoSchemaTable *innodb_cmpmem_reset_schema_table= NULL;
82
85
static TrxISMethods trx_methods;
83
86
static CmpISMethods cmp_methods;
113
116
---------------------------------
116
/* XXX these are defined in mysql_priv.h inside #ifdef DRIZZLE_SERVER */
117
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
119
119
/*******************************************************************//**
120
120
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
200
200
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
201
static drizzled::plugin::ColumnInfo innodb_trx_fields_info[] =
201
static plugin::ColumnInfo innodb_trx_fields_info[] =
203
203
#define IDX_TRX_ID 0
204
drizzled::plugin::ColumnInfo("trx_id",
204
plugin::ColumnInfo("trx_id",
205
205
TRX_ID_MAX_LEN + 1,
206
206
DRIZZLE_TYPE_VARCHAR,
211
211
#define IDX_TRX_STATE 1
212
drizzled::plugin::ColumnInfo("trx_state",
212
plugin::ColumnInfo("trx_state",
213
213
TRX_QUE_STATE_STR_MAX_LEN + 1,
214
214
DRIZZLE_TYPE_VARCHAR,
227
227
#define IDX_TRX_REQUESTED_LOCK_ID 3
228
drizzled::plugin::ColumnInfo("trx_requested_lock_id",
228
plugin::ColumnInfo("trx_requested_lock_id",
229
229
TRX_I_S_LOCK_ID_MAX_LEN + 1,
230
230
DRIZZLE_TYPE_VARCHAR,
243
243
#define IDX_TRX_WEIGHT 5
244
drizzled::plugin::ColumnInfo("trx_weight",
244
plugin::ColumnInfo("trx_weight",
245
245
MY_INT64_NUM_DECIMAL_DIGITS,
246
246
DRIZZLE_TYPE_LONGLONG,
251
251
#define IDX_TRX_DRIZZLE_THREAD_ID 6
252
drizzled::plugin::ColumnInfo("trx_mysql_thread_id",
252
plugin::ColumnInfo("trx_mysql_thread_id",
253
253
MY_INT64_NUM_DECIMAL_DIGITS,
254
254
DRIZZLE_TYPE_LONGLONG,
259
259
#define IDX_TRX_QUERY 7
260
drizzled::plugin::ColumnInfo("trx_query",
260
plugin::ColumnInfo("trx_query",
261
261
TRX_I_S_TRX_QUERY_MAX_LEN,
262
262
DRIZZLE_TYPE_VARCHAR,
264
264
MY_I_S_MAYBE_NULL,
267
drizzled::plugin::ColumnInfo()
270
270
/*******************************************************************//**
277
277
/*=======================*/
278
278
trx_i_s_cache_t* cache, /*!< in: cache to read from */
279
279
Table* table, /*!< in/out: fill this table */
280
drizzled::plugin::InfoSchemaTable *schema_table)
280
plugin::InfoSchemaTable *schema_table)
370
370
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
371
static drizzled::plugin::ColumnInfo innodb_locks_fields_info[] =
371
static plugin::ColumnInfo innodb_locks_fields_info[] =
373
373
#define IDX_LOCK_ID 0
374
drizzled::plugin::ColumnInfo("lock_id",
374
plugin::ColumnInfo("lock_id",
375
375
TRX_I_S_LOCK_ID_MAX_LEN + 1,
376
376
DRIZZLE_TYPE_VARCHAR,
389
389
#define IDX_LOCK_MODE 2
390
drizzled::plugin::ColumnInfo("lock_mode",
390
plugin::ColumnInfo("lock_mode",
391
391
/* S[,GAP] X[,GAP] IS[,GAP] IX[,GAP] AUTO_INC UNKNOWN */
393
393
DRIZZLE_TYPE_VARCHAR,
398
398
#define IDX_LOCK_TYPE 3
399
drizzled::plugin::ColumnInfo("lock_type",
399
plugin::ColumnInfo("lock_type",
400
400
32, /* RECORD|TABLE|UNKNOWN */
401
401
DRIZZLE_TYPE_VARCHAR,
422
422
#define IDX_LOCK_SPACE 6
423
drizzled::plugin::ColumnInfo("lock_space",
423
plugin::ColumnInfo("lock_space",
424
424
MY_INT64_NUM_DECIMAL_DIGITS,
425
425
DRIZZLE_TYPE_LONGLONG,
430
430
#define IDX_LOCK_PAGE 7
431
drizzled::plugin::ColumnInfo("lock_page",
431
plugin::ColumnInfo("lock_page",
432
432
MY_INT64_NUM_DECIMAL_DIGITS,
433
433
DRIZZLE_TYPE_LONGLONG,
446
446
#define IDX_LOCK_DATA 9
447
drizzled::plugin::ColumnInfo("lock_data",
447
plugin::ColumnInfo("lock_data",
448
448
TRX_I_S_LOCK_DATA_MAX_LEN,
449
449
DRIZZLE_TYPE_VARCHAR,
451
451
MY_I_S_MAYBE_NULL,
454
drizzled::plugin::ColumnInfo()
457
457
/*******************************************************************//**
465
465
trx_i_s_cache_t* cache, /*!< in: cache to read from */
466
466
Session* session,/*!< in: MySQL client connection */
467
467
Table* table, /*!< in/out: fill this table */
468
drizzled::plugin::InfoSchemaTable *schema_table)
468
plugin::InfoSchemaTable *schema_table)
582
582
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
583
static drizzled::plugin::ColumnInfo innodb_lock_waits_fields_info[] =
583
static plugin::ColumnInfo innodb_lock_waits_fields_info[] =
585
585
#define IDX_REQUESTING_TRX_ID 0
586
drizzled::plugin::ColumnInfo("requesting_trx_id",
586
plugin::ColumnInfo("requesting_trx_id",
587
587
TRX_ID_MAX_LEN + 1,
588
588
DRIZZLE_TYPE_VARCHAR,
593
593
#define IDX_REQUESTED_LOCK_ID 1
594
drizzled::plugin::ColumnInfo("requested_lock_id",
594
plugin::ColumnInfo("requested_lock_id",
595
595
TRX_I_S_LOCK_ID_MAX_LEN + 1,
596
596
DRIZZLE_TYPE_VARCHAR,
609
609
#define IDX_BLOCKING_LOCK_ID 3
610
drizzled::plugin::ColumnInfo("blocking_lock_id",
610
plugin::ColumnInfo("blocking_lock_id",
611
611
TRX_I_S_LOCK_ID_MAX_LEN + 1,
612
612
DRIZZLE_TYPE_VARCHAR,
617
drizzled::plugin::ColumnInfo()
620
620
/*******************************************************************//**
627
627
/*==============================*/
628
628
trx_i_s_cache_t* cache, /*!< in: cache to read from */
629
629
Table* table, /*!< in/out: fill this table */
630
drizzled::plugin::InfoSchemaTable *schema_table)
630
plugin::InfoSchemaTable *schema_table)
716
716
/*======================*/
717
717
Session* session,/*!< in: thread */
718
718
Table* table, /*!< in/out: tables to fill */
719
drizzled::plugin::InfoSchemaTable *schema_table)
719
plugin::InfoSchemaTable *schema_table)
721
721
const char* table_name;
802
802
/* Fields of the dynamic table information_schema.innodb_cmp. */
803
static drizzled::plugin::ColumnInfo i_s_cmp_fields_info[] =
803
static plugin::ColumnInfo i_s_cmp_fields_info[] =
805
drizzled::plugin::ColumnInfo("page_size",
805
plugin::ColumnInfo("page_size",
807
807
DRIZZLE_TYPE_LONG,
810
810
"Compressed Page Size"),
812
drizzled::plugin::ColumnInfo("compress_ops",
812
plugin::ColumnInfo("compress_ops",
813
813
MY_INT32_NUM_DECIMAL_DIGITS,
814
814
DRIZZLE_TYPE_LONG,
817
817
"Total Number of Compressions"),
819
drizzled::plugin::ColumnInfo("compress_ops_ok",
819
plugin::ColumnInfo("compress_ops_ok",
820
820
MY_INT32_NUM_DECIMAL_DIGITS,
821
821
DRIZZLE_TYPE_LONG,
824
824
"Total Number of Successful Compressions"),
826
drizzled::plugin::ColumnInfo("compress_time",
826
plugin::ColumnInfo("compress_time",
827
827
MY_INT32_NUM_DECIMAL_DIGITS,
828
828
DRIZZLE_TYPE_LONG,
831
831
"Total Duration of Compressions in Seconds"),
833
drizzled::plugin::ColumnInfo("uncompress_ops",
833
plugin::ColumnInfo("uncompress_ops",
834
834
MY_INT32_NUM_DECIMAL_DIGITS,
835
835
DRIZZLE_TYPE_LONG,
838
838
"Total Number of Decompressions"),
840
drizzled::plugin::ColumnInfo("uncompress_time",
840
plugin::ColumnInfo("uncompress_time",
841
841
MY_INT32_NUM_DECIMAL_DIGITS,
842
842
DRIZZLE_TYPE_LONG,
845
845
"Total Duration of Decompressions in Seconds"),
847
drizzled::plugin::ColumnInfo()
858
858
/*=============*/
859
859
Session* session,/*!< in: thread */
860
860
Table* table, /*!< in/out: tables to fill */
861
drizzled::plugin::InfoSchemaTable *schema_table,
861
plugin::InfoSchemaTable *schema_table,
862
862
ibool reset) /*!< in: TRUE=reset cumulated counts */
905
905
Session* session,/*!< in: thread */
906
906
Table* table, /*!< in/out: tables to fill */
907
drizzled::plugin::InfoSchemaTable *schema_table)
907
plugin::InfoSchemaTable *schema_table)
909
909
return(i_s_cmp_fill_low(session, table, schema_table, FALSE));
917
917
/*===============*/
918
918
Session* session,/*!< in: thread */
919
919
Table* table, /*!< in/out: tables to fill */
920
drizzled::plugin::InfoSchemaTable *schema_table)
920
plugin::InfoSchemaTable *schema_table)
922
922
return(i_s_cmp_fill_low(session, table, schema_table, TRUE));
961
961
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
962
static drizzled::plugin::ColumnInfo i_s_cmpmem_fields_info[] =
962
static plugin::ColumnInfo i_s_cmpmem_fields_info[] =
964
drizzled::plugin::ColumnInfo("page_size",
964
plugin::ColumnInfo("page_size",
966
966
DRIZZLE_TYPE_LONG,
969
969
"Buddy Block Size"),
971
drizzled::plugin::ColumnInfo("pages_used",
971
plugin::ColumnInfo("pages_used",
972
972
MY_INT32_NUM_DECIMAL_DIGITS,
973
973
DRIZZLE_TYPE_LONG,
976
976
"Currently in Use"),
978
drizzled::plugin::ColumnInfo("pages_free",
978
plugin::ColumnInfo("pages_free",
979
979
MY_INT32_NUM_DECIMAL_DIGITS,
980
980
DRIZZLE_TYPE_LONG,
983
983
"Currently Available"),
985
drizzled::plugin::ColumnInfo("relocation_ops",
985
plugin::ColumnInfo("relocation_ops",
986
986
MY_INT64_NUM_DECIMAL_DIGITS,
987
987
DRIZZLE_TYPE_LONGLONG,
990
990
"Total Number of Relocations"),
992
drizzled::plugin::ColumnInfo("relocation_time",
992
plugin::ColumnInfo("relocation_time",
993
993
MY_INT32_NUM_DECIMAL_DIGITS,
994
994
DRIZZLE_TYPE_LONG,
997
997
"Total Duration of Relocations, in Seconds"),
999
drizzled::plugin::ColumnInfo()
1002
1002
/*******************************************************************//**
1009
1009
/*================*/
1010
1010
Session* session,/*!< in: thread */
1011
1011
Table* table, /*!< in/out: tables to fill */
1012
drizzled::plugin::InfoSchemaTable *schema_table,
1012
plugin::InfoSchemaTable *schema_table,
1013
1013
ibool reset) /*!< in: TRUE=reset cumulated counts */
1015
1015
int status = 0;
1052
1052
/*============*/
1053
1053
Session* session,/*!< in: thread */
1054
1054
Table* table, /*!< in/out: tables to fill */
1055
drizzled::plugin::InfoSchemaTable *schema_table)
1055
plugin::InfoSchemaTable *schema_table)
1057
1057
return(i_s_cmpmem_fill_low(session, table, schema_table, FALSE));
1065
1065
/*==================*/
1066
1066
Session* session,/*!< in: thread */
1067
1067
Table* table, /*!< in/out: tables to fill */
1068
drizzled::plugin::InfoSchemaTable *schema_table)
1068
plugin::InfoSchemaTable *schema_table)
1070
1070
return(i_s_cmpmem_fill_low(session, table, schema_table, TRUE));
1110
1110
i_s_common_deinit(
1111
1111
/*==============*/
1112
drizzled::plugin::Registry ®istry) /*!< in/out: table schema object */
1112
plugin::Registry ®istry) /*!< in/out: table schema object */
1114
1114
registry.remove(innodb_trx_schema_table);
1115
1115
registry.remove(innodb_locks_schema_table);