Merge lp:~posulliv/drizzle/info-schema-plugin into lp:~drizzle-trunk/drizzle/development

Proposed by Padraig O'Sullivan
Status: Merged
Approved by: Jay Pipes
Approved revision: no longer in the revision history of the source branch.
Merged at revision: not available
Proposed branch: lp:~posulliv/drizzle/info-schema-plugin
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~posulliv/drizzle/info-schema-plugin
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Review via email: mp+8249@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

This patch completes the work on extracting the current I_S into a plugin by extracting the final 6 I_S tables into the I_S plugin. No I_S tables are created in show.cc anymore.

-Padraig

1090. By Brian Aker <brian@gaz>

Merge from Monty

1091. By Brian Aker <brian@gaz>

Collection of patches from new-cleanup (includes asserts for field in debug)

1092. By Brian Aker <brian@gaz>

Merge Monty

1093. By Brian Aker <brian@gaz>

Merge Brian

1094. By Brian Aker <brian@gaz>

Merge Stewart

1095. By Brian Aker <brian@gaz>

Merge Jay

1096. By Brian Aker <brian@gaz>

Merge Monty

1097. By Brian Aker <brian@gaz>

Merge Jay

1098. By Brian Aker <brian@gaz>

Merge Jay

Revision history for this message
Jay Pipes (jaypipes) wrote :

Merged into my captain branch...all tests pass. Looks good.

review: Approve
1099. By Brian Aker <brian@gaz>

Mege Jay

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/info_schema.h'
2--- drizzled/info_schema.h 2009-07-01 03:36:14 +0000
3+++ drizzled/info_schema.h 2009-07-05 17:44:13 +0000
4@@ -199,22 +199,6 @@
5 InfoSchemaTable *schema_table) const;
6 };
7
8-class StatusISMethods : public InfoSchemaMethods
9-{
10-public:
11- virtual int fillTable(Session *session,
12- TableList *tables,
13- COND *cond);
14-};
15-
16-class VariablesISMethods : public InfoSchemaMethods
17-{
18-public:
19- virtual int fillTable(Session *session,
20- TableList *tables,
21- COND *cond);
22-};
23-
24 /**
25 * @class InfoSchemaTable
26 * @brief
27
28=== modified file 'drizzled/show.cc'
29--- drizzled/show.cc 2009-07-03 19:45:58 +0000
30+++ drizzled/show.cc 2009-07-05 17:44:13 +0000
31@@ -1005,6 +1005,11 @@
32 }
33 };
34
35+SHOW_VAR *getFrontOfStatusVars()
36+{
37+ return all_status_vars.front();
38+}
39+
40 /*
41 Adds an array of SHOW_VAR entries to the output of SHOW STATUS
42
43@@ -1143,172 +1148,6 @@
44 }
45 }
46
47-inline void make_upper(char *buf)
48-{
49- for (; *buf; buf++)
50- *buf= my_toupper(system_charset_info, *buf);
51-}
52-
53-static bool show_status_array(Session *session, const char *wild,
54- SHOW_VAR *variables,
55- enum enum_var_type value_type,
56- struct system_status_var *status_var,
57- const char *prefix, Table *table,
58- bool ucase_names)
59-{
60- MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, int64_t);
61- char * const buff= (char *) &buff_data;
62- char *prefix_end;
63- /* the variable name should not be longer than 64 characters */
64- char name_buffer[64];
65- int len;
66- SHOW_VAR tmp, *var;
67-
68- prefix_end= strncpy(name_buffer, prefix, sizeof(name_buffer)-1);
69- prefix_end+= strlen(prefix);
70-
71- if (*prefix)
72- *prefix_end++= '_';
73- len=name_buffer + sizeof(name_buffer) - prefix_end;
74-
75- for (; variables->name; variables++)
76- {
77- strncpy(prefix_end, variables->name, len);
78- name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
79- if (ucase_names)
80- make_upper(name_buffer);
81-
82- /*
83- if var->type is SHOW_FUNC, call the function.
84- Repeat as necessary, if new var is again SHOW_FUNC
85- */
86- for (var=variables; var->type == SHOW_FUNC; var= &tmp)
87- ((mysql_show_var_func)((st_show_var_func_container *)var->value)->func)(&tmp, buff);
88-
89- SHOW_TYPE show_type=var->type;
90- if (show_type == SHOW_ARRAY)
91- {
92- show_status_array(session, wild, (SHOW_VAR *) var->value, value_type,
93- status_var, name_buffer, table, ucase_names);
94- }
95- else
96- {
97- if (!(wild && wild[0] && wild_case_compare(system_charset_info,
98- name_buffer, wild)))
99- {
100- char *value=var->value;
101- const char *pos, *end; // We assign a lot of const's
102- pthread_mutex_lock(&LOCK_global_system_variables);
103-
104- if (show_type == SHOW_SYS)
105- {
106- show_type= ((sys_var*) value)->show_type();
107- value= (char*) ((sys_var*) value)->value_ptr(session, value_type,
108- &null_lex_str);
109- }
110-
111- pos= end= buff;
112- /*
113- note that value may be == buff. All SHOW_xxx code below
114- should still work in this case
115- */
116- switch (show_type) {
117- case SHOW_DOUBLE_STATUS:
118- value= ((char *) status_var + (ulong) value);
119- /* fall through */
120- case SHOW_DOUBLE:
121- /* 6 is the default precision for '%f' in sprintf() */
122- end= buff + my_fcvt(*(double *) value, 6, buff, NULL);
123- break;
124- case SHOW_LONG_STATUS:
125- value= ((char *) status_var + (ulong) value);
126- /* fall through */
127- case SHOW_LONG:
128- end= int10_to_str(*(long*) value, buff, 10);
129- break;
130- case SHOW_LONGLONG_STATUS:
131- value= ((char *) status_var + (uint64_t) value);
132- /* fall through */
133- case SHOW_LONGLONG:
134- end= int64_t10_to_str(*(int64_t*) value, buff, 10);
135- break;
136- case SHOW_SIZE:
137- {
138- stringstream ss (stringstream::in);
139- ss << *(size_t*) value;
140-
141- string str= ss.str();
142- strncpy(buff, str.c_str(), str.length());
143- end= buff+ str.length();
144- }
145- break;
146- case SHOW_HA_ROWS:
147- end= int64_t10_to_str((int64_t) *(ha_rows*) value, buff, 10);
148- break;
149- case SHOW_BOOL:
150- end+= sprintf(buff,"%s", *(bool*) value ? "ON" : "OFF");
151- break;
152- case SHOW_MY_BOOL:
153- end+= sprintf(buff,"%s", *(bool*) value ? "ON" : "OFF");
154- break;
155- case SHOW_INT:
156- case SHOW_INT_NOFLUSH: // the difference lies in refresh_status()
157- end= int10_to_str((long) *(uint32_t*) value, buff, 10);
158- break;
159- case SHOW_HAVE:
160- {
161- SHOW_COMP_OPTION tmp_option= *(SHOW_COMP_OPTION *)value;
162- pos= show_comp_option_name[(int) tmp_option];
163- end= strchr(pos, '\0');
164- break;
165- }
166- case SHOW_CHAR:
167- {
168- if (!(pos= value))
169- pos= "";
170- end= strchr(pos, '\0');
171- break;
172- }
173- case SHOW_CHAR_PTR:
174- {
175- if (!(pos= *(char**) value))
176- pos= "";
177- end= strchr(pos, '\0');
178- break;
179- }
180- case SHOW_KEY_CACHE_LONG:
181- value= (char*) dflt_key_cache + (ulong)value;
182- end= int10_to_str(*(long*) value, buff, 10);
183- break;
184- case SHOW_KEY_CACHE_LONGLONG:
185- value= (char*) dflt_key_cache + (ulong)value;
186- end= int64_t10_to_str(*(int64_t*) value, buff, 10);
187- break;
188- case SHOW_UNDEF:
189- break; // Return empty string
190- case SHOW_SYS: // Cannot happen
191- default:
192- assert(0);
193- break;
194- }
195- table->restoreRecordAsDefault();
196- table->field[0]->store(name_buffer, strlen(name_buffer),
197- system_charset_info);
198- table->field[1]->store(pos, (uint32_t) (end - pos), system_charset_info);
199- table->field[1]->set_notnull();
200-
201- pthread_mutex_unlock(&LOCK_global_system_variables);
202-
203- if (schema_table_store_record(session, table))
204- return true;
205- }
206- }
207- }
208-
209- return false;
210-}
211-
212-
213 /* collect status for all running threads */
214
215 void calc_sum_of_all_status(STATUS_VAR *to)
216@@ -1329,10 +1168,6 @@
217 return;
218 }
219
220-
221-/* This is only used internally, but we need it here as a forward reference */
222-extern InfoSchemaTable schema_tables[];
223-
224 /*
225 Store record to I_S table, convert HEAP table
226 to MyISAM if necessary
227@@ -1773,39 +1608,14 @@
228
229 int schema_tables_add(Session *session, vector<LEX_STRING*> &files, const char *wild)
230 {
231- InfoSchemaTable *tmp_schema_table= schema_tables;
232-
233- for (; tmp_schema_table->getTableName().length() != 0; tmp_schema_table++)
234- {
235- if (tmp_schema_table->isHidden())
236- {
237- continue;
238- }
239-
240- const string &schema_table_name= tmp_schema_table->getTableName();
241-
242- if (wild && wild_case_compare(files_charset_info, schema_table_name.c_str(), wild))
243- {
244- continue;
245- }
246-
247- LEX_STRING *file_name= 0;
248- file_name= session->make_lex_string(file_name, schema_table_name.c_str(),
249- schema_table_name.length(), true);
250- if (file_name == NULL)
251- {
252- return 1;
253- }
254-
255- files.push_back(file_name);
256- }
257-
258 vector<InfoSchemaTable *>::iterator iter= find_if(all_schema_tables.begin(),
259 all_schema_tables.end(),
260 AddSchemaTable(session, files, wild));
261
262 if (iter != all_schema_tables.end())
263+ {
264 return 1;
265+ }
266
267 return 0;
268 }
269@@ -2576,71 +2386,6 @@
270 }
271
272
273-int VariablesISMethods::fillTable(Session *session, TableList *tables, COND *)
274-{
275- int res= 0;
276- LEX *lex= session->lex;
277- const char *wild= lex->wild ? lex->wild->ptr() : NULL;
278- const string schema_table_name= tables->schema_table->getTableName();
279- enum enum_var_type option_type= OPT_SESSION;
280- bool upper_case_names= (schema_table_name.compare("VARIABLES") != 0);
281- bool sorted_vars= (schema_table_name.compare("VARIABLES") == 0);
282-
283- if (lex->option_type == OPT_GLOBAL ||
284- schema_table_name.compare("GLOBAL_VARIABLES") == 0)
285- {
286- option_type= OPT_GLOBAL;
287- }
288-
289- pthread_rwlock_rdlock(&LOCK_system_variables_hash);
290- res= show_status_array(session, wild, enumerate_sys_vars(session, sorted_vars),
291- option_type, NULL, "", tables->table, upper_case_names);
292- pthread_rwlock_unlock(&LOCK_system_variables_hash);
293- return(res);
294-}
295-
296-
297-int StatusISMethods::fillTable(Session *session, TableList *tables, COND *)
298-{
299- LEX *lex= session->lex;
300- const char *wild= lex->wild ? lex->wild->ptr() : NULL;
301- int res= 0;
302- STATUS_VAR *tmp1, tmp;
303- const string schema_table_name= tables->schema_table->getTableName();
304- enum enum_var_type option_type;
305- bool upper_case_names= (schema_table_name.compare("STATUS") != 0);
306-
307- if (schema_table_name.compare("STATUS") == 0)
308- {
309- option_type= lex->option_type;
310- if (option_type == OPT_GLOBAL)
311- tmp1= &tmp;
312- else
313- tmp1= session->initial_status_var;
314- }
315- else if (schema_table_name.compare("GLOBAL_STATUS") == 0)
316- {
317- option_type= OPT_GLOBAL;
318- tmp1= &tmp;
319- }
320- else
321- {
322- option_type= OPT_SESSION;
323- tmp1= &session->status_var;
324- }
325-
326- pthread_mutex_lock(&LOCK_status);
327- if (option_type == OPT_GLOBAL)
328- calc_sum_of_all_status(&tmp);
329- res= show_status_array(session, wild,
330- (SHOW_VAR *) all_status_vars.front(),
331- option_type, tmp1, "", tables->table,
332- upper_case_names);
333- pthread_mutex_unlock(&LOCK_status);
334- return(res);
335-}
336-
337-
338 class FindSchemaTableByName : public unary_function<InfoSchemaTable *, bool>
339 {
340 const char *table_name;
341@@ -2670,21 +2415,14 @@
342
343 InfoSchemaTable *find_schema_table(const char* table_name)
344 {
345- InfoSchemaTable *schema_table= schema_tables;
346-
347- for (; schema_table->getTableName().length() != 0; schema_table++)
348- {
349- if (! my_strcasecmp(system_charset_info,
350- schema_table->getTableName().c_str(),
351- table_name))
352- return(schema_table);
353- }
354-
355 vector<InfoSchemaTable *>::iterator iter=
356 find_if(all_schema_tables.begin(), all_schema_tables.end(),
357 FindSchemaTableByName(table_name));
358 if (iter != all_schema_tables.end())
359+ {
360 return *iter;
361+ }
362+
363 return NULL;
364 }
365
366@@ -2997,51 +2735,3 @@
367 session->no_warnings_for_error= 0;
368 return(result);
369 }
370-
371-ColumnInfo variables_fields_info[]=
372-{
373- ColumnInfo("VARIABLE_NAME", 64, DRIZZLE_TYPE_VARCHAR, 0, 0, "Variable_name",
374- SKIP_OPEN_TABLE),
375- ColumnInfo("VARIABLE_VALUE", 16300, DRIZZLE_TYPE_VARCHAR, 0, 1, "Value", SKIP_OPEN_TABLE),
376- ColumnInfo()
377-};
378-
379-
380-static StatusISMethods status_methods;
381-static VariablesISMethods variables_methods;
382-
383-static InfoSchemaTable global_stat_table("GLOBAL_STATUS",
384- variables_fields_info,
385- -1, -1, false, false, 0,
386- &status_methods);
387-static InfoSchemaTable global_var_table("GLOBAL_VARIABLES",
388- variables_fields_info,
389- -1, -1, false, false, 0,
390- &variables_methods);
391-static InfoSchemaTable sess_stat_table("SESSION_STATUS",
392- variables_fields_info,
393- -1, -1, false, false, 0,
394- &status_methods);
395-static InfoSchemaTable sess_var_table("SESSION_VARIABLES",
396- variables_fields_info,
397- -1, -1, false, false, 0,
398- &variables_methods);
399-static InfoSchemaTable status_table("STATUS",
400- variables_fields_info,
401- -1, -1, true, false, 0,
402- &status_methods);
403-static InfoSchemaTable var_table("VARIABLES",
404- variables_fields_info,
405- -1, -1, true, false, 0,
406- &variables_methods);
407-
408-InfoSchemaTable schema_tables[]=
409-{
410- global_stat_table,
411- global_var_table,
412- sess_stat_table,
413- sess_var_table,
414- status_table,
415- var_table,
416- InfoSchemaTable()
417-};
418
419=== modified file 'drizzled/show.h'
420--- drizzled/show.h 2009-07-02 06:54:37 +0000
421+++ drizzled/show.h 2009-07-05 17:44:13 +0000
422@@ -65,6 +65,7 @@
423 LOOKUP_FIELD_VALUES *lookup_field_values);
424 int make_db_list(Session *session, std::vector<LEX_STRING*> &files,
425 LOOKUP_FIELD_VALUES *lookup_field_vals, bool *with_i_schema);
426+SHOW_VAR *getFrontOfStatusVars();
427
428 int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg);
429 bool store_db_create_info(const char *dbname, String *buffer, HA_CREATE_INFO *create_info);
430
431=== modified file 'plugin/info_schema/info_schema.cc'
432--- plugin/info_schema/info_schema.cc 2009-07-01 03:36:14 +0000
433+++ plugin/info_schema/info_schema.cc 2009-07-05 17:44:13 +0000
434@@ -48,6 +48,7 @@
435 static vector<const ColumnInfo *> ref_constraint_columns;
436 static vector<const ColumnInfo *> schemata_columns;
437 static vector<const ColumnInfo *> stats_columns;
438+static vector<const ColumnInfo *> status_columns;
439 static vector<const ColumnInfo *> tab_constraints_columns;
440 static vector<const ColumnInfo *> tables_columns;
441 static vector<const ColumnInfo *> tab_names_columns;
442@@ -66,9 +67,11 @@
443 static InfoSchemaMethods *ref_constraint_methods= NULL;
444 static InfoSchemaMethods *schemata_methods= NULL;
445 static InfoSchemaMethods *stats_methods= NULL;
446+static InfoSchemaMethods *status_methods= NULL;
447 static InfoSchemaMethods *tab_constraints_methods= NULL;
448 static InfoSchemaMethods *tables_methods= NULL;
449 static InfoSchemaMethods *tab_names_methods= NULL;
450+static InfoSchemaMethods *variables_methods= NULL;
451
452 /*
453 * I_S tables.
454@@ -78,15 +81,21 @@
455 static InfoSchemaTable *coll_char_set_table= NULL;
456 static InfoSchemaTable *columns_table= NULL;
457 static InfoSchemaTable *key_col_usage_table= NULL;
458+static InfoSchemaTable *global_stat_table= NULL;
459+static InfoSchemaTable *global_var_table= NULL;
460 static InfoSchemaTable *open_tab_table= NULL;
461 static InfoSchemaTable *plugins_table= NULL;
462 static InfoSchemaTable *processlist_table= NULL;
463 static InfoSchemaTable *ref_constraint_table= NULL;
464 static InfoSchemaTable *schemata_table= NULL;
465+static InfoSchemaTable *sess_stat_table= NULL;
466+static InfoSchemaTable *sess_var_table= NULL;
467 static InfoSchemaTable *stats_table= NULL;
468+static InfoSchemaTable *status_table= NULL;
469 static InfoSchemaTable *tab_constraints_table= NULL;
470 static InfoSchemaTable *tables_table= NULL;
471 static InfoSchemaTable *tab_names_table= NULL;
472+static InfoSchemaTable *var_table= NULL;
473
474 /**
475 * Populate the vectors of columns for each I_S table.
476@@ -152,6 +161,11 @@
477 return true;
478 }
479
480+ if ((retval= createStatusColumns(status_columns)) == true)
481+ {
482+ return true;
483+ }
484+
485 if ((retval= createTabConstraintsColumns(tab_constraints_columns)) == true)
486 {
487 return true;
488@@ -186,6 +200,7 @@
489 clearColumns(ref_constraint_columns);
490 clearColumns(schemata_columns);
491 clearColumns(stats_columns);
492+ clearColumns(status_columns);
493 clearColumns(tab_constraints_columns);
494 clearColumns(tables_columns);
495 clearColumns(tab_names_columns);
496@@ -253,6 +268,11 @@
497 return true;
498 }
499
500+ if ((status_methods= new(std::nothrow) StatusISMethods()) == NULL)
501+ {
502+ return true;
503+ }
504+
505 if ((tab_constraints_methods= new(std::nothrow) TabConstraintsISMethods()) == NULL)
506 {
507 return true;
508@@ -268,6 +288,11 @@
509 return true;
510 }
511
512+ if ((variables_methods= new(std::nothrow) VariablesISMethods()) == NULL)
513+ {
514+ return true;
515+ }
516+
517 return false;
518 }
519
520@@ -287,9 +312,11 @@
521 delete ref_constraint_methods;
522 delete schemata_methods;
523 delete stats_methods;
524+ delete status_methods;
525 delete tab_constraints_methods;
526 delete tables_methods;
527 delete tab_names_methods;
528+ delete variables_methods;
529 }
530
531 /**
532@@ -347,6 +374,24 @@
533 return true;
534 }
535
536+ global_stat_table= new(std::nothrow) InfoSchemaTable("GLOBAL_STATUS",
537+ status_columns,
538+ -1, -1, false, false,
539+ 0, status_methods);
540+ if (global_stat_table == NULL)
541+ {
542+ return true;
543+ }
544+
545+ global_var_table= new(std::nothrow) InfoSchemaTable("GLOBAL_VARIABLES",
546+ status_columns,
547+ -1, -1, false, false,
548+ 0, variables_methods);
549+ if (global_var_table == NULL)
550+ {
551+ return true;
552+ }
553+
554 open_tab_table= new(std::nothrow) InfoSchemaTable("OPEN_TABLES",
555 open_tab_columns,
556 -1, -1, true, false, 0,
557@@ -393,6 +438,24 @@
558 return true;
559 }
560
561+ sess_stat_table= new(std::nothrow) InfoSchemaTable("SESSION_STATUS",
562+ status_columns,
563+ -1, -1, false, false,
564+ 0, status_methods);
565+ if (sess_stat_table == NULL)
566+ {
567+ return true;
568+ }
569+
570+ sess_var_table= new(std::nothrow) InfoSchemaTable("SESSION_VARIABLES",
571+ status_columns,
572+ -1, -1, false, false, 0,
573+ variables_methods);
574+ if (sess_var_table == NULL)
575+ {
576+ return true;
577+ }
578+
579 stats_table= new(std::nothrow) InfoSchemaTable("STATISTICS",
580 stats_columns,
581 1, 2, false, true,
582@@ -403,6 +466,15 @@
583 return true;
584 }
585
586+ status_table= new(std::nothrow) InfoSchemaTable("STATUS",
587+ status_columns,
588+ -1, -1, true, false, 0,
589+ status_methods);
590+ if (status_table == NULL)
591+ {
592+ return true;
593+ }
594+
595 tab_constraints_table= new(std::nothrow) InfoSchemaTable("TABLE_CONSTRAINTS",
596 tab_constraints_columns,
597 3, 4, false, true,
598@@ -432,6 +504,15 @@
599 return true;
600 }
601
602+ var_table= new(std::nothrow) InfoSchemaTable("VARIABLES",
603+ status_columns,
604+ -1, -1, true, false, 0,
605+ variables_methods);
606+ if (var_table == NULL)
607+ {
608+ return true;
609+ }
610+
611 return false;
612 }
613
614@@ -445,15 +526,21 @@
615 delete coll_char_set_table;
616 delete columns_table;
617 delete key_col_usage_table;
618+ delete global_stat_table;
619+ delete global_var_table;
620 delete open_tab_table;
621 delete plugins_table;
622 delete processlist_table;
623 delete ref_constraint_table;
624 delete schemata_table;
625+ delete sess_stat_table;
626+ delete sess_var_table;
627 delete stats_table;
628+ delete status_table;
629 delete tab_constraints_table;
630 delete tables_table;
631 delete tab_names_table;
632+ delete var_table;
633 }
634
635 /**
636@@ -486,15 +573,21 @@
637 registry.add(coll_char_set_table);
638 registry.add(columns_table);
639 registry.add(key_col_usage_table);
640+ registry.add(global_stat_table);
641+ registry.add(global_var_table);
642 registry.add(open_tab_table);
643 registry.add(plugins_table);
644 registry.add(processlist_table);
645 registry.add(ref_constraint_table);
646 registry.add(schemata_table);
647+ registry.add(sess_stat_table);
648+ registry.add(sess_var_table);
649 registry.add(stats_table);
650+ registry.add(status_table);
651 registry.add(tab_constraints_table);
652 registry.add(tables_table);
653 registry.add(tab_names_table);
654+ registry.add(var_table);
655
656 return 0;
657 }
658@@ -512,15 +605,21 @@
659 registry.remove(coll_char_set_table);
660 registry.remove(columns_table);
661 registry.remove(key_col_usage_table);
662+ registry.remove(global_stat_table);
663+ registry.remove(global_var_table);
664 registry.remove(open_tab_table);
665 registry.remove(plugins_table);
666 registry.remove(processlist_table);
667 registry.remove(ref_constraint_table);
668 registry.remove(schemata_table);
669+ registry.remove(sess_stat_table);
670+ registry.remove(sess_var_table);
671 registry.remove(stats_table);
672+ registry.remove(status_table);
673 registry.remove(tab_constraints_table);
674 registry.remove(tables_table);
675 registry.remove(tab_names_table);
676+ registry.remove(var_table);
677
678 cleanupTableMethods();
679 cleanupTableColumns();
680
681=== modified file 'plugin/info_schema/info_schema_columns.cc'
682--- plugin/info_schema/info_schema_columns.cc 2009-07-01 03:36:14 +0000
683+++ plugin/info_schema/info_schema_columns.cc 2009-07-05 17:26:20 +0000
684@@ -1384,6 +1384,38 @@
685 return false;
686 }
687
688+bool createStatusColumns(vector<const ColumnInfo *>& cols)
689+{
690+ const ColumnInfo *name= new(std::nothrow) ColumnInfo("VARIABLE_NAME",
691+ 64,
692+ DRIZZLE_TYPE_VARCHAR,
693+ 0,
694+ 0,
695+ "Variable_name",
696+ SKIP_OPEN_TABLE);
697+ if (name == NULL)
698+ {
699+ return true;
700+ }
701+
702+ const ColumnInfo *value= new(std::nothrow) ColumnInfo("VARIABLE_VALUE",
703+ 16300,
704+ DRIZZLE_TYPE_VARCHAR,
705+ 0,
706+ 1,
707+ "Value",
708+ SKIP_OPEN_TABLE);
709+ if (value == NULL)
710+ {
711+ return true;
712+ }
713+
714+ cols.push_back(name);
715+ cols.push_back(value);
716+
717+ return false;
718+}
719+
720 bool createTabConstraintsColumns(vector<const ColumnInfo *>& cols)
721 {
722 const ColumnInfo *cat= new(std::nothrow) ColumnInfo("CONSTRAINT_CATALOG",
723
724=== modified file 'plugin/info_schema/info_schema_columns.h'
725--- plugin/info_schema/info_schema_columns.h 2009-07-01 03:36:14 +0000
726+++ plugin/info_schema/info_schema_columns.h 2009-07-05 17:26:20 +0000
727@@ -130,6 +130,15 @@
728 bool createStatsColumns(std::vector<const ColumnInfo *>& cols);
729
730 /**
731+ * Create the various volumns for numerous I_S tables
732+ * and add them to the std::vector of columns for these table.
733+ *
734+ * @param[out] cols vector to add columns to
735+ * @return false on success; true on failure
736+ */
737+bool createStatusColumns(std::vector<const ColumnInfo *>& cols);
738+
739+/**
740 * Create the various volumns for the TABLE_CONSTRAINTS I_S table
741 * and add them to the std::vector of columns for this table.
742 *
743
744=== modified file 'plugin/info_schema/info_schema_methods.cc'
745--- plugin/info_schema/info_schema_methods.cc 2009-07-02 06:54:37 +0000
746+++ plugin/info_schema/info_schema_methods.cc 2009-07-05 17:44:13 +0000
747@@ -36,6 +36,171 @@
748
749 using namespace std;
750
751+static inline void make_upper(char *buf)
752+{
753+ for (; *buf; buf++)
754+ *buf= my_toupper(system_charset_info, *buf);
755+}
756+
757+static bool show_status_array(Session *session, const char *wild,
758+ SHOW_VAR *variables,
759+ enum enum_var_type value_type,
760+ struct system_status_var *status_var,
761+ const char *prefix, Table *table,
762+ bool ucase_names)
763+{
764+ MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, int64_t);
765+ char * const buff= (char *) &buff_data;
766+ char *prefix_end;
767+ /* the variable name should not be longer than 64 characters */
768+ char name_buffer[64];
769+ int len;
770+ SHOW_VAR tmp, *var;
771+
772+ prefix_end= strncpy(name_buffer, prefix, sizeof(name_buffer)-1);
773+ prefix_end+= strlen(prefix);
774+
775+ if (*prefix)
776+ *prefix_end++= '_';
777+ len=name_buffer + sizeof(name_buffer) - prefix_end;
778+
779+ for (; variables->name; variables++)
780+ {
781+ strncpy(prefix_end, variables->name, len);
782+ name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
783+ if (ucase_names)
784+ make_upper(name_buffer);
785+
786+ /*
787+ if var->type is SHOW_FUNC, call the function.
788+ Repeat as necessary, if new var is again SHOW_FUNC
789+ */
790+ for (var=variables; var->type == SHOW_FUNC; var= &tmp)
791+ ((mysql_show_var_func)((st_show_var_func_container *)var->value)->func)(&tmp, buff);
792+
793+ SHOW_TYPE show_type=var->type;
794+ if (show_type == SHOW_ARRAY)
795+ {
796+ show_status_array(session, wild, (SHOW_VAR *) var->value, value_type,
797+ status_var, name_buffer, table, ucase_names);
798+ }
799+ else
800+ {
801+ if (!(wild && wild[0] && wild_case_compare(system_charset_info,
802+ name_buffer, wild)))
803+ {
804+ char *value=var->value;
805+ const char *pos, *end; // We assign a lot of const's
806+ pthread_mutex_lock(&LOCK_global_system_variables);
807+
808+ if (show_type == SHOW_SYS)
809+ {
810+ show_type= ((sys_var*) value)->show_type();
811+ value= (char*) ((sys_var*) value)->value_ptr(session, value_type,
812+ &null_lex_str);
813+ }
814+
815+ pos= end= buff;
816+ /*
817+ note that value may be == buff. All SHOW_xxx code below
818+ should still work in this case
819+ */
820+ switch (show_type) {
821+ case SHOW_DOUBLE_STATUS:
822+ value= ((char *) status_var + (ulong) value);
823+ /* fall through */
824+ case SHOW_DOUBLE:
825+ /* 6 is the default precision for '%f' in sprintf() */
826+ end= buff + my_fcvt(*(double *) value, 6, buff, NULL);
827+ break;
828+ case SHOW_LONG_STATUS:
829+ value= ((char *) status_var + (ulong) value);
830+ /* fall through */
831+ case SHOW_LONG:
832+ end= int10_to_str(*(long*) value, buff, 10);
833+ break;
834+ case SHOW_LONGLONG_STATUS:
835+ value= ((char *) status_var + (uint64_t) value);
836+ /* fall through */
837+ case SHOW_LONGLONG:
838+ end= int64_t10_to_str(*(int64_t*) value, buff, 10);
839+ break;
840+ case SHOW_SIZE:
841+ {
842+ stringstream ss (stringstream::in);
843+ ss << *(size_t*) value;
844+
845+ string str= ss.str();
846+ strncpy(buff, str.c_str(), str.length());
847+ end= buff+ str.length();
848+ }
849+ break;
850+ case SHOW_HA_ROWS:
851+ end= int64_t10_to_str((int64_t) *(ha_rows*) value, buff, 10);
852+ break;
853+ case SHOW_BOOL:
854+ end+= sprintf(buff,"%s", *(bool*) value ? "ON" : "OFF");
855+ break;
856+ case SHOW_MY_BOOL:
857+ end+= sprintf(buff,"%s", *(bool*) value ? "ON" : "OFF");
858+ break;
859+ case SHOW_INT:
860+ case SHOW_INT_NOFLUSH: // the difference lies in refresh_status()
861+ end= int10_to_str((long) *(uint32_t*) value, buff, 10);
862+ break;
863+ case SHOW_HAVE:
864+ {
865+ SHOW_COMP_OPTION tmp_option= *(SHOW_COMP_OPTION *)value;
866+ pos= show_comp_option_name[(int) tmp_option];
867+ end= strchr(pos, '\0');
868+ break;
869+ }
870+ case SHOW_CHAR:
871+ {
872+ if (!(pos= value))
873+ pos= "";
874+ end= strchr(pos, '\0');
875+ break;
876+ }
877+ case SHOW_CHAR_PTR:
878+ {
879+ if (!(pos= *(char**) value))
880+ pos= "";
881+ end= strchr(pos, '\0');
882+ break;
883+ }
884+ case SHOW_KEY_CACHE_LONG:
885+ value= (char*) dflt_key_cache + (ulong)value;
886+ end= int10_to_str(*(long*) value, buff, 10);
887+ break;
888+ case SHOW_KEY_CACHE_LONGLONG:
889+ value= (char*) dflt_key_cache + (ulong)value;
890+ end= int64_t10_to_str(*(int64_t*) value, buff, 10);
891+ break;
892+ case SHOW_UNDEF:
893+ break; // Return empty string
894+ case SHOW_SYS: // Cannot happen
895+ default:
896+ assert(0);
897+ break;
898+ }
899+ table->restoreRecordAsDefault();
900+ table->field[0]->store(name_buffer, strlen(name_buffer),
901+ system_charset_info);
902+ table->field[1]->store(pos, (uint32_t) (end - pos), system_charset_info);
903+ table->field[1]->set_notnull();
904+
905+ pthread_mutex_unlock(&LOCK_global_system_variables);
906+
907+ if (schema_table_store_record(session, table))
908+ return true;
909+ }
910+ }
911+ }
912+
913+ return false;
914+}
915+
916 int CharSetISMethods::fillTable(Session *session, TableList *tables, COND *)
917 {
918 CHARSET_INFO **cs;
919@@ -786,6 +951,46 @@
920 return(res);
921 }
922
923+int StatusISMethods::fillTable(Session *session, TableList *tables, COND *)
924+{
925+ LEX *lex= session->lex;
926+ const char *wild= lex->wild ? lex->wild->ptr() : NULL;
927+ int res= 0;
928+ STATUS_VAR *tmp1, tmp;
929+ const string schema_table_name= tables->schema_table->getTableName();
930+ enum enum_var_type option_type;
931+ bool upper_case_names= (schema_table_name.compare("STATUS") != 0);
932+
933+ if (schema_table_name.compare("STATUS") == 0)
934+ {
935+ option_type= lex->option_type;
936+ if (option_type == OPT_GLOBAL)
937+ tmp1= &tmp;
938+ else
939+ tmp1= session->initial_status_var;
940+ }
941+ else if (schema_table_name.compare("GLOBAL_STATUS") == 0)
942+ {
943+ option_type= OPT_GLOBAL;
944+ tmp1= &tmp;
945+ }
946+ else
947+ {
948+ option_type= OPT_SESSION;
949+ tmp1= &session->status_var;
950+ }
951+
952+ pthread_mutex_lock(&LOCK_status);
953+ if (option_type == OPT_GLOBAL)
954+ calc_sum_of_all_status(&tmp);
955+ res= show_status_array(session, wild,
956+ getFrontOfStatusVars(),
957+ option_type, tmp1, "", tables->table,
958+ upper_case_names);
959+ pthread_mutex_unlock(&LOCK_status);
960+ return(res);
961+}
962+
963 static bool store_constraints(Session *session, Table *table, LEX_STRING *db_name,
964 LEX_STRING *table_name, const char *key_name,
965 uint32_t key_len, const char *con_type, uint32_t con_len)
966@@ -1118,3 +1323,27 @@
967 }
968 return 0;
969 }
970+
971+int VariablesISMethods::fillTable(Session *session, TableList *tables, COND *)
972+{
973+ int res= 0;
974+ LEX *lex= session->lex;
975+ const char *wild= lex->wild ? lex->wild->ptr() : NULL;
976+ const string schema_table_name= tables->schema_table->getTableName();
977+ enum enum_var_type option_type= OPT_SESSION;
978+ bool upper_case_names= (schema_table_name.compare("VARIABLES") != 0);
979+ bool sorted_vars= (schema_table_name.compare("VARIABLES") == 0);
980+
981+ if (lex->option_type == OPT_GLOBAL ||
982+ schema_table_name.compare("GLOBAL_VARIABLES") == 0)
983+ {
984+ option_type= OPT_GLOBAL;
985+ }
986+
987+ pthread_rwlock_rdlock(&LOCK_system_variables_hash);
988+ res= show_status_array(session, wild, enumerate_sys_vars(session, sorted_vars),
989+ option_type, NULL, "", tables->table, upper_case_names);
990+ pthread_rwlock_unlock(&LOCK_system_variables_hash);
991+ return(res);
992+}
993+
994
995=== modified file 'plugin/info_schema/info_schema_methods.h'
996--- plugin/info_schema/info_schema_methods.h 2009-07-01 03:36:14 +0000
997+++ plugin/info_schema/info_schema_methods.h 2009-07-05 17:44:13 +0000
998@@ -192,6 +192,20 @@
999 };
1000
1001 /**
1002+ * @class StatusISMethods
1003+ * @brief
1004+ * Class which implements any methods that the STATUS
1005+ * I_S table needs besides the default methods
1006+ */
1007+class StatusISMethods : public InfoSchemaMethods
1008+{
1009+public:
1010+ virtual int fillTable(Session *session,
1011+ TableList *tables,
1012+ COND *cond);
1013+};
1014+
1015+/**
1016 * @class TabConstraintsISMethods
1017 * @brief
1018 * Class which implements any methods that the TABLE_CONSTRAINTS
1019@@ -231,4 +245,18 @@
1020 virtual int oldFormat(Session *session, InfoSchemaTable *schema_table) const;
1021 };
1022
1023+/**
1024+ * @class VariablesISMethods
1025+ * @brief
1026+ * Class which implements any methods that the VARIABLES
1027+ * I_S table needs besides the default methods
1028+ */
1029+class VariablesISMethods : public InfoSchemaMethods
1030+{
1031+public:
1032+ virtual int fillTable(Session *session,
1033+ TableList *tables,
1034+ COND *cond);
1035+};
1036+
1037 #endif /* DRIZZLE_INFO_SCHEMA_METHODS_H */
1038
1039=== modified file 'tests/r/information_schema.result'
1040--- tests/r/information_schema.result 2009-07-01 03:38:19 +0000
1041+++ tests/r/information_schema.result 2009-07-05 18:46:45 +0000
1042@@ -244,10 +244,6 @@
1043 )
1044 AND t.table_name NOT LIKE 'falcon%';
1045 table_name column_name
1046-GLOBAL_STATUS VARIABLE_NAME
1047-GLOBAL_VARIABLES VARIABLE_NAME
1048-SESSION_STATUS VARIABLE_NAME
1049-SESSION_VARIABLES VARIABLE_NAME
1050 INNODB_TRX trx_id
1051 INNODB_LOCKS lock_id
1052 INNODB_LOCK_WAITS requesting_trx_id
1053@@ -260,10 +256,14 @@
1054 COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
1055 COLUMNS TABLE_SCHEMA
1056 KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
1057+GLOBAL_STATUS VARIABLE_NAME
1058+GLOBAL_VARIABLES VARIABLE_NAME
1059 PLUGINS PLUGIN_NAME
1060 PROCESSLIST ID
1061 REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
1062 SCHEMATA SCHEMA_NAME
1063+SESSION_STATUS VARIABLE_NAME
1064+SESSION_VARIABLES VARIABLE_NAME
1065 STATISTICS TABLE_SCHEMA
1066 TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
1067 TABLES TABLE_SCHEMA
1068@@ -283,10 +283,6 @@
1069 )
1070 AND t.table_name NOT LIKE 'falcon%';
1071 table_name column_name
1072-GLOBAL_STATUS VARIABLE_NAME
1073-GLOBAL_VARIABLES VARIABLE_NAME
1074-SESSION_STATUS VARIABLE_NAME
1075-SESSION_VARIABLES VARIABLE_NAME
1076 INNODB_TRX trx_id
1077 INNODB_LOCKS lock_id
1078 INNODB_LOCK_WAITS requesting_trx_id
1079@@ -299,10 +295,14 @@
1080 COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
1081 COLUMNS TABLE_SCHEMA
1082 KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
1083+GLOBAL_STATUS VARIABLE_NAME
1084+GLOBAL_VARIABLES VARIABLE_NAME
1085 PLUGINS PLUGIN_NAME
1086 PROCESSLIST ID
1087 REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
1088 SCHEMATA SCHEMA_NAME
1089+SESSION_STATUS VARIABLE_NAME
1090+SESSION_VARIABLES VARIABLE_NAME
1091 STATISTICS TABLE_SCHEMA
1092 TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
1093 TABLES TABLE_SCHEMA
1094@@ -465,151 +465,156 @@
1095 FROM information_schema.processlist
1096 WHERE id = CONNECTION_ID() Query test
1097 SELECT *
1098-FROM information_schema.character_sets;
1099+FROM information_schema.character_sets
1100+ORDER BY character_set_name;
1101 CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
1102+binary binary 1
1103 utf8 utf8_general_ci UTF-8 Unicode 4
1104-binary binary 1
1105 SELECT *
1106-FROM information_schema.collations;
1107+FROM information_schema.collations
1108+ORDER BY collation_name;
1109 COLLATION_NAME CHARACTER_SET_NAME DESCRIPTION ID IS_DEFAULT IS_COMPILED SORTLEN
1110+binary binary 63 0 Yes 1 0
1111+utf8_bin utf8 46 0 Yes 1 0
1112+utf8_czech_ci utf8 234 0 Yes 8 0
1113+utf8_danish_ci utf8 235 0 Yes 8 0
1114+utf8_esperanto_ci utf8 241 0 Yes 8 0
1115+utf8_estonian_ci utf8 230 0 Yes 8 0
1116 utf8_general_ci utf8 45 0 Yes 1 0
1117-utf8_bin utf8 46 0 Yes 1 0
1118-utf8_unicode_ci utf8 224 0 Yes 8 0
1119+utf8_hungarian_ci utf8 242 0 Yes 8 0
1120 utf8_icelandic_ci utf8 225 0 Yes 8 0
1121 utf8_latvian_ci utf8 226 0 Yes 8 0
1122+utf8_lithuanian_ci utf8 236 0 Yes 8 0
1123+utf8_persian_ci utf8 240 0 Yes 8 0
1124+utf8_polish_ci utf8 229 0 Yes 8 0
1125 utf8_romanian_ci utf8 227 0 Yes 8 0
1126+utf8_roman_ci utf8 239 0 Yes 8 0
1127+utf8_sinhala_ci utf8 243 0 Yes 8 0
1128+utf8_slovak_ci utf8 237 0 Yes 8 0
1129 utf8_slovenian_ci utf8 228 0 Yes 8 0
1130-utf8_polish_ci utf8 229 0 Yes 8 0
1131-utf8_estonian_ci utf8 230 0 Yes 8 0
1132+utf8_spanish2_ci utf8 238 0 Yes 8 0
1133 utf8_spanish_ci utf8 231 0 Yes 8 0
1134 utf8_swedish_ci utf8 232 0 Yes 8 0
1135 utf8_turkish_ci utf8 233 0 Yes 8 0
1136-utf8_czech_ci utf8 234 0 Yes 8 0
1137-utf8_danish_ci utf8 235 0 Yes 8 0
1138-utf8_lithuanian_ci utf8 236 0 Yes 8 0
1139-utf8_slovak_ci utf8 237 0 Yes 8 0
1140-utf8_spanish2_ci utf8 238 0 Yes 8 0
1141-utf8_roman_ci utf8 239 0 Yes 8 0
1142-utf8_persian_ci utf8 240 0 Yes 8 0
1143-utf8_esperanto_ci utf8 241 0 Yes 8 0
1144-utf8_hungarian_ci utf8 242 0 Yes 8 0
1145-utf8_sinhala_ci utf8 243 0 Yes 8 0
1146-binary binary 63 0 Yes 1 0
1147+utf8_unicode_ci utf8 224 0 Yes 8 0
1148 SELECT *
1149-FROM information_schema.collation_character_set_applicability;
1150+FROM information_schema.collation_character_set_applicability
1151+ORDER BY collation_name;
1152 COLLATION_NAME CHARACTER_SET_NAME
1153+binary binary
1154+utf8_bin utf8
1155+utf8_czech_ci utf8
1156+utf8_danish_ci utf8
1157+utf8_esperanto_ci utf8
1158+utf8_estonian_ci utf8
1159 utf8_general_ci utf8
1160-utf8_bin utf8
1161-utf8_unicode_ci utf8
1162+utf8_hungarian_ci utf8
1163 utf8_icelandic_ci utf8
1164 utf8_latvian_ci utf8
1165+utf8_lithuanian_ci utf8
1166+utf8_persian_ci utf8
1167+utf8_polish_ci utf8
1168 utf8_romanian_ci utf8
1169+utf8_roman_ci utf8
1170+utf8_sinhala_ci utf8
1171+utf8_slovak_ci utf8
1172 utf8_slovenian_ci utf8
1173-utf8_polish_ci utf8
1174-utf8_estonian_ci utf8
1175+utf8_spanish2_ci utf8
1176 utf8_spanish_ci utf8
1177 utf8_swedish_ci utf8
1178 utf8_turkish_ci utf8
1179-utf8_czech_ci utf8
1180-utf8_danish_ci utf8
1181-utf8_lithuanian_ci utf8
1182-utf8_slovak_ci utf8
1183-utf8_spanish2_ci utf8
1184-utf8_roman_ci utf8
1185-utf8_persian_ci utf8
1186-utf8_esperanto_ci utf8
1187-utf8_hungarian_ci utf8
1188-utf8_sinhala_ci utf8
1189-binary binary
1190+utf8_unicode_ci utf8
1191 SELECT table_name, column_name
1192-FROM information_schema.columns;
1193+FROM information_schema.columns
1194+ORDER BY table_name;
1195 table_name column_name
1196-GLOBAL_STATUS VARIABLE_NAME
1197-GLOBAL_STATUS VARIABLE_VALUE
1198-GLOBAL_VARIABLES VARIABLE_NAME
1199-GLOBAL_VARIABLES VARIABLE_VALUE
1200-SESSION_STATUS VARIABLE_NAME
1201-SESSION_STATUS VARIABLE_VALUE
1202-SESSION_VARIABLES VARIABLE_NAME
1203-SESSION_VARIABLES VARIABLE_VALUE
1204-INNODB_TRX trx_id
1205-INNODB_TRX trx_state
1206-INNODB_TRX trx_started
1207-INNODB_TRX trx_requested_lock_id
1208-INNODB_TRX trx_wait_started
1209-INNODB_TRX trx_weight
1210-INNODB_TRX trx_mysql_thread_id
1211-INNODB_TRX trx_query
1212-INNODB_LOCKS lock_id
1213-INNODB_LOCKS lock_trx_id
1214-INNODB_LOCKS lock_mode
1215-INNODB_LOCKS lock_type
1216-INNODB_LOCKS lock_table
1217-INNODB_LOCKS lock_index
1218-INNODB_LOCKS lock_space
1219-INNODB_LOCKS lock_page
1220-INNODB_LOCKS lock_rec
1221-INNODB_LOCKS lock_data
1222-INNODB_LOCK_WAITS requesting_trx_id
1223-INNODB_LOCK_WAITS requested_lock_id
1224-INNODB_LOCK_WAITS blocking_trx_id
1225-INNODB_LOCK_WAITS blocking_lock_id
1226-INNODB_CMP page_size
1227-INNODB_CMP compress_ops
1228-INNODB_CMP compress_ops_ok
1229-INNODB_CMP compress_time
1230-INNODB_CMP uncompress_ops
1231-INNODB_CMP uncompress_time
1232-INNODB_CMP_RESET page_size
1233-INNODB_CMP_RESET compress_ops
1234-INNODB_CMP_RESET compress_ops_ok
1235-INNODB_CMP_RESET compress_time
1236-INNODB_CMP_RESET uncompress_ops
1237-INNODB_CMP_RESET uncompress_time
1238-INNODB_CMPMEM page_size
1239-INNODB_CMPMEM pages_used
1240-INNODB_CMPMEM pages_free
1241-INNODB_CMPMEM relocation_ops
1242-INNODB_CMPMEM relocation_time
1243-INNODB_CMPMEM_RESET page_size
1244-INNODB_CMPMEM_RESET pages_used
1245-INNODB_CMPMEM_RESET pages_free
1246-INNODB_CMPMEM_RESET relocation_ops
1247-INNODB_CMPMEM_RESET relocation_time
1248-CHARACTER_SETS CHARACTER_SET_NAME
1249+CHARACTER_SETS MAXLEN
1250+CHARACTER_SETS DESCRIPTION
1251 CHARACTER_SETS DEFAULT_COLLATE_NAME
1252-CHARACTER_SETS DESCRIPTION
1253-CHARACTER_SETS MAXLEN
1254-COLLATIONS COLLATION_NAME
1255-COLLATIONS CHARACTER_SET_NAME
1256-COLLATIONS DESCRIPTION
1257-COLLATIONS ID
1258-COLLATIONS IS_DEFAULT
1259+CHARACTER_SETS CHARACTER_SET_NAME
1260 COLLATIONS IS_COMPILED
1261+COLLATIONS COLLATION_NAME
1262 COLLATIONS SORTLEN
1263-COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
1264+COLLATIONS IS_DEFAULT
1265+COLLATIONS ID
1266+COLLATIONS DESCRIPTION
1267+COLLATIONS CHARACTER_SET_NAME
1268 COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME
1269+COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
1270+COLUMNS PRIVILEGES
1271+COLUMNS TABLE_SCHEMA
1272+COLUMNS TABLE_NAME
1273 COLUMNS TABLE_CATALOG
1274-COLUMNS TABLE_SCHEMA
1275-COLUMNS TABLE_NAME
1276 COLUMNS COLUMN_NAME
1277 COLUMNS ORDINAL_POSITION
1278 COLUMNS COLUMN_DEFAULT
1279 COLUMNS IS_NULLABLE
1280-COLUMNS DATA_TYPE
1281-COLUMNS CHARACTER_MAXIMUM_LENGTH
1282-COLUMNS CHARACTER_OCTET_LENGTH
1283-COLUMNS NUMERIC_PRECISION
1284-COLUMNS NUMERIC_SCALE
1285+COLUMNS FORMAT
1286+COLUMNS COLLATION_NAME
1287 COLUMNS CHARACTER_SET_NAME
1288-COLUMNS COLLATION_NAME
1289+COLUMNS COLUMN_COMMENT
1290 COLUMNS COLUMN_TYPE
1291 COLUMNS COLUMN_KEY
1292 COLUMNS EXTRA
1293-COLUMNS PRIVILEGES
1294-COLUMNS COLUMN_COMMENT
1295 COLUMNS STORAGE
1296-COLUMNS FORMAT
1297+COLUMNS NUMERIC_SCALE
1298+COLUMNS NUMERIC_PRECISION
1299+COLUMNS CHARACTER_OCTET_LENGTH
1300+COLUMNS DATA_TYPE
1301+COLUMNS CHARACTER_MAXIMUM_LENGTH
1302+GLOBAL_STATUS VARIABLE_NAME
1303+GLOBAL_STATUS VARIABLE_VALUE
1304+GLOBAL_VARIABLES VARIABLE_VALUE
1305+GLOBAL_VARIABLES VARIABLE_NAME
1306+INNODB_CMP compress_time
1307+INNODB_CMP uncompress_ops
1308+INNODB_CMP compress_ops
1309+INNODB_CMP page_size
1310+INNODB_CMP uncompress_time
1311+INNODB_CMP compress_ops_ok
1312+INNODB_CMPMEM relocation_time
1313+INNODB_CMPMEM relocation_ops
1314+INNODB_CMPMEM pages_used
1315+INNODB_CMPMEM page_size
1316+INNODB_CMPMEM pages_free
1317+INNODB_CMPMEM_RESET relocation_time
1318+INNODB_CMPMEM_RESET relocation_ops
1319+INNODB_CMPMEM_RESET pages_free
1320+INNODB_CMPMEM_RESET pages_used
1321+INNODB_CMPMEM_RESET page_size
1322+INNODB_CMP_RESET page_size
1323+INNODB_CMP_RESET compress_ops
1324+INNODB_CMP_RESET compress_ops_ok
1325+INNODB_CMP_RESET compress_time
1326+INNODB_CMP_RESET uncompress_ops
1327+INNODB_CMP_RESET uncompress_time
1328+INNODB_LOCKS lock_index
1329+INNODB_LOCKS lock_table
1330+INNODB_LOCKS lock_type
1331+INNODB_LOCKS lock_trx_id
1332+INNODB_LOCKS lock_id
1333+INNODB_LOCKS lock_mode
1334+INNODB_LOCKS lock_space
1335+INNODB_LOCKS lock_page
1336+INNODB_LOCKS lock_rec
1337+INNODB_LOCKS lock_data
1338+INNODB_LOCK_WAITS blocking_lock_id
1339+INNODB_LOCK_WAITS blocking_trx_id
1340+INNODB_LOCK_WAITS requested_lock_id
1341+INNODB_LOCK_WAITS requesting_trx_id
1342+INNODB_TRX trx_id
1343+INNODB_TRX trx_state
1344+INNODB_TRX trx_started
1345+INNODB_TRX trx_requested_lock_id
1346+INNODB_TRX trx_wait_started
1347+INNODB_TRX trx_weight
1348+INNODB_TRX trx_mysql_thread_id
1349+INNODB_TRX trx_query
1350+KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME
1351+KEY_COLUMN_USAGE REFERENCED_TABLE_NAME
1352+KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA
1353+KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT
1354+KEY_COLUMN_USAGE ORDINAL_POSITION
1355 KEY_COLUMN_USAGE CONSTRAINT_CATALOG
1356 KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
1357 KEY_COLUMN_USAGE CONSTRAINT_NAME
1358@@ -617,50 +622,40 @@
1359 KEY_COLUMN_USAGE TABLE_SCHEMA
1360 KEY_COLUMN_USAGE TABLE_NAME
1361 KEY_COLUMN_USAGE COLUMN_NAME
1362-KEY_COLUMN_USAGE ORDINAL_POSITION
1363-KEY_COLUMN_USAGE POSITION_IN_UNIQUE_CONSTRAINT
1364-KEY_COLUMN_USAGE REFERENCED_TABLE_SCHEMA
1365-KEY_COLUMN_USAGE REFERENCED_TABLE_NAME
1366-KEY_COLUMN_USAGE REFERENCED_COLUMN_NAME
1367-PLUGINS PLUGIN_NAME
1368+PLUGINS PLUGIN_LICENSE
1369+PLUGINS PLUGIN_DESCRIPTION
1370+PLUGINS PLUGIN_AUTHOR
1371+PLUGINS PLUGIN_STATUS
1372 PLUGINS PLUGIN_VERSION
1373-PLUGINS PLUGIN_STATUS
1374-PLUGINS PLUGIN_AUTHOR
1375-PLUGINS PLUGIN_DESCRIPTION
1376-PLUGINS PLUGIN_LICENSE
1377-PROCESSLIST ID
1378+PLUGINS PLUGIN_NAME
1379+PROCESSLIST INFO
1380+PROCESSLIST STATE
1381+PROCESSLIST TIME
1382+PROCESSLIST COMMAND
1383+PROCESSLIST DB
1384+PROCESSLIST HOST
1385 PROCESSLIST USER
1386-PROCESSLIST HOST
1387-PROCESSLIST DB
1388-PROCESSLIST COMMAND
1389-PROCESSLIST TIME
1390-PROCESSLIST STATE
1391-PROCESSLIST INFO
1392+PROCESSLIST ID
1393+REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME
1394+REFERENTIAL_CONSTRAINTS TABLE_NAME
1395+REFERENTIAL_CONSTRAINTS DELETE_RULE
1396+REFERENTIAL_CONSTRAINTS UPDATE_RULE
1397+REFERENTIAL_CONSTRAINTS MATCH_OPTION
1398+REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_NAME
1399+REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA
1400+REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG
1401+REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME
1402+REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
1403 REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG
1404-REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
1405-REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME
1406-REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG
1407-REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA
1408-REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_NAME
1409-REFERENTIAL_CONSTRAINTS MATCH_OPTION
1410-REFERENTIAL_CONSTRAINTS UPDATE_RULE
1411-REFERENTIAL_CONSTRAINTS DELETE_RULE
1412-REFERENTIAL_CONSTRAINTS TABLE_NAME
1413-REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME
1414+SCHEMATA SQL_PATH
1415+SCHEMATA DEFAULT_COLLATION_NAME
1416+SCHEMATA DEFAULT_CHARACTER_SET_NAME
1417+SCHEMATA SCHEMA_NAME
1418 SCHEMATA CATALOG_NAME
1419-SCHEMATA SCHEMA_NAME
1420-SCHEMATA DEFAULT_CHARACTER_SET_NAME
1421-SCHEMATA DEFAULT_COLLATION_NAME
1422-SCHEMATA SQL_PATH
1423-STATISTICS TABLE_CATALOG
1424-STATISTICS TABLE_SCHEMA
1425-STATISTICS TABLE_NAME
1426-STATISTICS NON_UNIQUE
1427-STATISTICS INDEX_SCHEMA
1428-STATISTICS INDEX_NAME
1429-STATISTICS SEQ_IN_INDEX
1430-STATISTICS COLUMN_NAME
1431-STATISTICS COLLATION
1432+SESSION_STATUS VARIABLE_VALUE
1433+SESSION_STATUS VARIABLE_NAME
1434+SESSION_VARIABLES VARIABLE_NAME
1435+SESSION_VARIABLES VARIABLE_VALUE
1436 STATISTICS CARDINALITY
1437 STATISTICS SUB_PART
1438 STATISTICS PACKED
1439@@ -668,20 +663,15 @@
1440 STATISTICS INDEX_TYPE
1441 STATISTICS COMMENT
1442 STATISTICS INDEX_COMMENT
1443-TABLE_CONSTRAINTS CONSTRAINT_CATALOG
1444-TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
1445-TABLE_CONSTRAINTS CONSTRAINT_NAME
1446-TABLE_CONSTRAINTS TABLE_SCHEMA
1447-TABLE_CONSTRAINTS TABLE_NAME
1448-TABLE_CONSTRAINTS CONSTRAINT_TYPE
1449-TABLES TABLE_CATALOG
1450-TABLES TABLE_SCHEMA
1451-TABLES TABLE_NAME
1452-TABLES TABLE_TYPE
1453-TABLES ENGINE
1454-TABLES VERSION
1455-TABLES ROW_FORMAT
1456-TABLES TABLE_ROWS
1457+STATISTICS COLLATION
1458+STATISTICS COLUMN_NAME
1459+STATISTICS TABLE_CATALOG
1460+STATISTICS TABLE_SCHEMA
1461+STATISTICS TABLE_NAME
1462+STATISTICS NON_UNIQUE
1463+STATISTICS INDEX_SCHEMA
1464+STATISTICS INDEX_NAME
1465+STATISTICS SEQ_IN_INDEX
1466 TABLES AVG_ROW_LENGTH
1467 TABLES DATA_LENGTH
1468 TABLES MAX_DATA_LENGTH
1469@@ -694,7 +684,21 @@
1470 TABLES TABLE_COLLATION
1471 TABLES CHECKSUM
1472 TABLES CREATE_OPTIONS
1473+TABLES TABLE_ROWS
1474+TABLES ROW_FORMAT
1475 TABLES TABLE_COMMENT
1476+TABLES TABLE_CATALOG
1477+TABLES TABLE_SCHEMA
1478+TABLES TABLE_NAME
1479+TABLES TABLE_TYPE
1480+TABLES ENGINE
1481+TABLES VERSION
1482+TABLE_CONSTRAINTS TABLE_NAME
1483+TABLE_CONSTRAINTS TABLE_SCHEMA
1484+TABLE_CONSTRAINTS CONSTRAINT_NAME
1485+TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
1486+TABLE_CONSTRAINTS CONSTRAINT_CATALOG
1487+TABLE_CONSTRAINTS CONSTRAINT_TYPE
1488 SELECT *
1489 FROM information_schema.key_column_usage;
1490 CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
1491@@ -702,37 +706,373 @@
1492 FROM information_schema.referential_constraints;
1493 CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME
1494 SELECT catalog_name, schema_name
1495-FROM information_schema.schemata;
1496+FROM information_schema.schemata
1497+ORDER BY schema_name;
1498 catalog_name schema_name
1499 NULL information_schema
1500 NULL mysql
1501 NULL test
1502 SELECT *
1503+FROM information_schema.session_status
1504+ORDER BY variable_name;
1505+VARIABLE_NAME VARIABLE_VALUE
1506+# #
1507+# #
1508+# #
1509+# #
1510+# #
1511+# #
1512+# #
1513+# #
1514+# #
1515+# #
1516+# #
1517+# #
1518+# #
1519+# #
1520+# #
1521+# #
1522+# #
1523+# #
1524+# #
1525+# #
1526+# #
1527+# #
1528+# #
1529+# #
1530+# #
1531+# #
1532+# #
1533+# #
1534+# #
1535+# #
1536+# #
1537+# #
1538+# #
1539+# #
1540+# #
1541+# #
1542+# #
1543+# #
1544+# #
1545+# #
1546+# #
1547+# #
1548+# #
1549+# #
1550+# #
1551+# #
1552+# #
1553+# #
1554+# #
1555+# #
1556+# #
1557+# #
1558+# #
1559+# #
1560+# #
1561+# #
1562+# #
1563+# #
1564+# #
1565+# #
1566+# #
1567+# #
1568+# #
1569+# #
1570+# #
1571+# #
1572+# #
1573+# #
1574+# #
1575+# #
1576+# #
1577+# #
1578+# #
1579+# #
1580+# #
1581+# #
1582+# #
1583+# #
1584+# #
1585+# #
1586+# #
1587+# #
1588+# #
1589+# #
1590+# #
1591+# #
1592+# #
1593+# #
1594+# #
1595+# #
1596+# #
1597+# #
1598+# #
1599+# #
1600+# #
1601+# #
1602+# #
1603+# #
1604+# #
1605+# #
1606+# #
1607+# #
1608+# #
1609+# #
1610+# #
1611+# #
1612+# #
1613+# #
1614+SHOW STATUS;
1615+Variable_name Value
1616+# #
1617+# #
1618+# #
1619+# #
1620+# #
1621+# #
1622+# #
1623+# #
1624+# #
1625+# #
1626+# #
1627+# #
1628+# #
1629+# #
1630+# #
1631+# #
1632+# #
1633+# #
1634+# #
1635+# #
1636+# #
1637+# #
1638+# #
1639+# #
1640+# #
1641+# #
1642+# #
1643+# #
1644+# #
1645+# #
1646+# #
1647+# #
1648+# #
1649+# #
1650+# #
1651+# #
1652+# #
1653+# #
1654+# #
1655+# #
1656+# #
1657+# #
1658+# #
1659+# #
1660+# #
1661+# #
1662+# #
1663+# #
1664+# #
1665+# #
1666+# #
1667+# #
1668+# #
1669+# #
1670+# #
1671+# #
1672+# #
1673+# #
1674+# #
1675+# #
1676+# #
1677+# #
1678+# #
1679+# #
1680+# #
1681+# #
1682+# #
1683+# #
1684+# #
1685+# #
1686+# #
1687+# #
1688+# #
1689+# #
1690+# #
1691+# #
1692+# #
1693+# #
1694+# #
1695+# #
1696+# #
1697+# #
1698+# #
1699+# #
1700+# #
1701+# #
1702+# #
1703+# #
1704+# #
1705+# #
1706+# #
1707+# #
1708+# #
1709+# #
1710+# #
1711+# #
1712+# #
1713+# #
1714+# #
1715+# #
1716+# #
1717+# #
1718+# #
1719+# #
1720+# #
1721+# #
1722+# #
1723+# #
1724+SELECT *
1725+FROM information_schema.global_status
1726+ORDER BY variable_name;
1727+VARIABLE_NAME VARIABLE_VALUE
1728+# #
1729+# #
1730+# #
1731+# #
1732+# #
1733+# #
1734+# #
1735+# #
1736+# #
1737+# #
1738+# #
1739+# #
1740+# #
1741+# #
1742+# #
1743+# #
1744+# #
1745+# #
1746+# #
1747+# #
1748+# #
1749+# #
1750+# #
1751+# #
1752+# #
1753+# #
1754+# #
1755+# #
1756+# #
1757+# #
1758+# #
1759+# #
1760+# #
1761+# #
1762+# #
1763+# #
1764+# #
1765+# #
1766+# #
1767+# #
1768+# #
1769+# #
1770+# #
1771+# #
1772+# #
1773+# #
1774+# #
1775+# #
1776+# #
1777+# #
1778+# #
1779+# #
1780+# #
1781+# #
1782+# #
1783+# #
1784+# #
1785+# #
1786+# #
1787+# #
1788+# #
1789+# #
1790+# #
1791+# #
1792+# #
1793+# #
1794+# #
1795+# #
1796+# #
1797+# #
1798+# #
1799+# #
1800+# #
1801+# #
1802+# #
1803+# #
1804+# #
1805+# #
1806+# #
1807+# #
1808+# #
1809+# #
1810+# #
1811+# #
1812+# #
1813+# #
1814+# #
1815+# #
1816+# #
1817+# #
1818+# #
1819+# #
1820+# #
1821+# #
1822+# #
1823+# #
1824+# #
1825+# #
1826+# #
1827+# #
1828+# #
1829+# #
1830+# #
1831+# #
1832+# #
1833+# #
1834+# #
1835+# #
1836+SELECT *
1837 FROM information_schema.table_constraints;
1838 CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
1839 SELECT table_schema, table_name
1840-FROM information_schema.tables;
1841+FROM information_schema.tables
1842+ORDER BY table_name;
1843 table_schema table_name
1844+information_schema CHARACTER_SETS
1845+information_schema COLLATIONS
1846+information_schema COLLATION_CHARACTER_SET_APPLICABILITY
1847+information_schema COLUMNS
1848 information_schema GLOBAL_STATUS
1849 information_schema GLOBAL_VARIABLES
1850-information_schema SESSION_STATUS
1851-information_schema SESSION_VARIABLES
1852-information_schema INNODB_TRX
1853-information_schema INNODB_LOCKS
1854-information_schema INNODB_LOCK_WAITS
1855 information_schema INNODB_CMP
1856-information_schema INNODB_CMP_RESET
1857 information_schema INNODB_CMPMEM
1858 information_schema INNODB_CMPMEM_RESET
1859-information_schema CHARACTER_SETS
1860-information_schema COLLATIONS
1861-information_schema COLLATION_CHARACTER_SET_APPLICABILITY
1862-information_schema COLUMNS
1863+information_schema INNODB_CMP_RESET
1864+information_schema INNODB_LOCKS
1865+information_schema INNODB_LOCK_WAITS
1866+information_schema INNODB_TRX
1867 information_schema KEY_COLUMN_USAGE
1868 information_schema PLUGINS
1869 information_schema PROCESSLIST
1870 information_schema REFERENTIAL_CONSTRAINTS
1871 information_schema SCHEMATA
1872+information_schema SESSION_STATUS
1873+information_schema SESSION_VARIABLES
1874 information_schema STATISTICS
1875+information_schema TABLES
1876 information_schema TABLE_CONSTRAINTS
1877-information_schema TABLES
1878
1879=== modified file 'tests/t/information_schema.test'
1880--- tests/t/information_schema.test 2009-07-01 02:05:39 +0000
1881+++ tests/t/information_schema.test 2009-07-05 18:46:45 +0000
1882@@ -412,25 +412,29 @@
1883 # do a query on the CHARACTER_SET table in I_S
1884 #
1885 SELECT *
1886-FROM information_schema.character_sets;
1887+FROM information_schema.character_sets
1888+ORDER BY character_set_name;
1889
1890 #
1891 # perform a query on the COLLATIONS table
1892 #
1893 SELECT *
1894-FROM information_schema.collations;
1895+FROM information_schema.collations
1896+ORDER BY collation_name;
1897
1898 #
1899 # perform a query on COLLATION_CHARACTER_SET_APPLICABILITY
1900 #
1901 SELECT *
1902-FROM information_schema.collation_character_set_applicability;
1903+FROM information_schema.collation_character_set_applicability
1904+ORDER BY collation_name;
1905
1906 #
1907 # perform a query on COLUMNS
1908 #
1909 SELECT table_name, column_name
1910-FROM information_schema.columns;
1911+FROM information_schema.columns
1912+ORDER BY table_name;
1913
1914 #
1915 # perform a query on KEY_COLUMN_USAGE
1916@@ -448,7 +452,38 @@
1917 # query the SCHEMATA table
1918 #
1919 SELECT catalog_name, schema_name
1920-FROM information_schema.schemata;
1921+FROM information_schema.schemata
1922+ORDER BY schema_name;
1923+
1924+#
1925+# Query the STATUS and VARIABLES related
1926+# I_S related tables.
1927+#
1928+--replace_column 1 # 2 #
1929+SELECT *
1930+FROM information_schema.session_status
1931+ORDER BY variable_name;
1932+
1933+--replace_column 1 # 2 #
1934+SHOW STATUS;
1935+
1936+#--replace_column 1 # 2 #
1937+#SELECT *
1938+#FROM information_schema.session_variables
1939+#ORDER BY variable_name;
1940+
1941+#--replace_column 1 # 2 #
1942+#SHOW VARIABLES;
1943+
1944+--replace_column 1 # 2 #
1945+SELECT *
1946+FROM information_schema.global_status
1947+ORDER BY variable_name;
1948+
1949+#--replace_column 1 # 2 #
1950+#SELECT *
1951+#FROM information_schema.global_variables
1952+#ORDER BY variable_name;
1953
1954 #
1955 # query TABLE_CONSTRAINTS table
1956@@ -460,7 +495,8 @@
1957 # query TABLES
1958 #
1959 SELECT table_schema, table_name
1960-FROM information_schema.tables;
1961+FROM information_schema.tables
1962+ORDER BY table_name;
1963
1964 #
1965 # do a query on the PLUGINS table in I_S to ensure it works correctly