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

Proposed by Padraig O'Sullivan
Status: Rejected
Rejected by: Padraig O'Sullivan
Proposed branch: lp:~posulliv/drizzle/info-schema-storage-engine
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 5442 lines
39 files modified
drizzled/definitions.h (+1/-5)
drizzled/field/int64_t.cc (+6/-6)
drizzled/field/long.cc (+1/-1)
drizzled/join.cc (+0/-3)
drizzled/plugin/info_schema_table.h (+97/-57)
drizzled/plugin/storage_engine.cc (+24/-8)
drizzled/plugin/storage_engine.h (+3/-1)
drizzled/show.cc (+69/-450)
drizzled/show.h (+0/-4)
drizzled/sql_base.cc (+0/-12)
drizzled/sql_select.cc (+0/-11)
drizzled/sql_table.cc (+4/-22)
drizzled/table.cc (+6/-0)
drizzled/table_list.h (+2/-4)
plugin/archive/ha_archive.cc (+2/-4)
plugin/blackhole/ha_blackhole.cc (+2/-2)
plugin/heap/ha_heap.cc (+2/-2)
plugin/info_schema/info_schema_columns.cc (+135/-261)
plugin/info_schema/info_schema_methods.cc (+173/-68)
plugin/info_schema/info_schema_methods.h (+26/-28)
plugin/info_schema_engine/info_schema_cursor.cc (+144/-0)
plugin/info_schema_engine/info_schema_cursor.h (+175/-0)
plugin/info_schema_engine/info_schema_engine.cc (+195/-0)
plugin/info_schema_engine/info_schema_engine.h (+91/-0)
plugin/info_schema_engine/open_tables.cc (+72/-0)
plugin/info_schema_engine/open_tables.h (+77/-0)
plugin/info_schema_engine/plugin.ini (+9/-0)
plugin/info_schema_engine/table_name_iterator.cc (+53/-0)
plugin/info_schema_engine/table_name_iterator.h (+61/-0)
plugin/innobase/handler/ha_innodb.cc (+2/-2)
plugin/innobase/handler/i_s.cc (+59/-100)
plugin/innobase/handler/i_s.h (+6/-12)
plugin/memcached_stats/analysis_table.cc (+13/-25)
plugin/memcached_stats/analysis_table.h (+1/-2)
plugin/memcached_stats/stats_table.cc (+28/-55)
plugin/memcached_stats/stats_table.h (+1/-2)
plugin/myisam/ha_myisam.cc (+2/-2)
tests/r/create.result (+4/-4)
tests/t/create.test (+1/-1)
To merge this branch: bzr merge lp:~posulliv/drizzle/info-schema-storage-engine
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+13549@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

I'm looking to get some help with my I_S engine if anyone has some time. I'm proposing it for merging so that its easier for people to see the changes I have made. I'm still trying to keep looking at this when I get some spare time so I'm still working on it, just not as much as I would like to be.

I'm pretty close (I believe) to having a working I_S engine. The main issue I'm having right now is with the COLUMN_DEFAULT column in the COLUMNS table. It is throwing warnings whenever I do a select on the COLUMNS table.

But besides that, it would be nice to get some input on what I have done so far. I feel like it would be good to get some input on this engine as its a large patch and it would be nice to know whether people think I am going in the right direction or not. I want to make sure I am not going off on a tangent or anything!

-Padraig

Revision history for this message
Jay Pipes (jaypipes) wrote :
Download full text (7.1 KiB)

Hi Padraig!

A few comments and questions... :)

1) Per our IRC conversation, you should put back the ASSERT_COLUMN_MARKED_FOR_WRITE macros in /field/int64_t.cc and /field/long.cc.

2) What was the reasoning behind this change?

8 -#define PROCESS_LIST_INFO_WIDTH 65535
9 +#define PROCESS_LIST_INFO_WIDTH 16383

3) When I saw this removed from drizzled/join.cc:

92 - if ((this->select_lex->options & OPTION_SCHEMA_TABLE) && get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC))
93 - return;
94 -

and this removed from drizzled/sql_base.cc:

1070 - /*
1071 - If this TableList object is a placeholder for an information_schema
1072 - table, create a temporary table to represent the information_schema
1073 - table in the query. Do not fill it yet - will be filled during
1074 - execution.
1075 - */
1076 - if (tables->schema_table)
1077 - {
1078 - if (mysql_schema_table(this, lex, tables) == false)
1079 - continue;
1080 - return -1;
1081 - }

I had a little celebration :) No more two different code paths just for selecting from the information_schema \o/ epic win.

4) The following code needs to have the comment removed :)

237 + void addRow(unsigned char *buf, size_t len)
238 + {
239 + /*unsigned char *my_buf= new
240 + unsigned char[len];
241 + memcpy(my_buf, buf, len);
242 + rows.push_back(my_buf);*/
243 + InfoSchemaRecord tmp_rec(buf, len);
244 + rows.push_back(tmp_rec);
245 + }

Also, rows is defined as std::vector<InfoSchemaRecord>. Perhaps it is worth making this std::vector<InfoSchemaRecord *> instead and making the addRow() method this:

void addRow(unsigned char *buf, size_t len)
{
  InfoSchemaRecord *record= new InfoSchemaRecord(buf, len);
  rows.push_back(record);
}

and then cleaning up all those new'd records when the InfoSchemaTable is destroyed (in other words, have the InfoSchemaRecord manage all memory allocation instead of std::vector<>. This would be a little more efficient, as one less memcpy() would be used for each addRow() call.

5) I found this code to be awkward:

434 - error= test(schema_table->processTable(session, show_table_list,
435 - table, res, db_name,
436 + error= test(schema_table->processTable(schema_table,
437 + session,
438 + show_table_list,
439 + table,
440 + res,
441 + db_name,

Why is the first param of processTable() schema_table? I mean, "this" would refer to schema_table, no?

6) Indentation off by one here:

699 - XXX-> show_table_list has a flag i_is_requested,
700 - and when it's set, openTables()
701 - can return an error without setting an error message
702 - in Session, which is a hack. This is why we have to
703 - check for res, then for session->is_error() only then
704 - for session->main_da.sql_errno().
705 - */
706 + XXX-> show_table_list has a flag i_is_requested,
707 + and when it's set, openTables()
708 + can return an error without setting an error message
709 + in Session, which is a hack. This is why we have to
710 + check for res, then for session->is_error() only then
711 + for session->main_da.sql_errno().
712 + */

717 - Hide error for not existing table.
718 - This error can occur for example when we use
719 - where condition with db name and table name and this
720 - table does n...

Read more...

1161. By Padraig O'Sullivan

Merge from trunk.

1162. By Padraig O'Sullivan

Resolved conflicts from the latest merge with trunk.

1163. By Padraig O'Sullivan

Removed a redundant field from the InfoSchemaColumn class. This allowed us
to remove some redundant flags.

1164. By Padraig O'Sullivan

Modified the fillTable() method to not take a COND as a parameter any more.

1165. By Padraig O'Sullivan

Merge from trunk.

1166. By Padraig O'Sullivan

Reworked the processTable() method parameters to be more sane.

1167. By Padraig O'Sullivan

Taking Jay's review suggestion to change Rows from vector<InfoSchemaRecord>
to vector<InfoSchemaRecord *>.

Thanks Jay!

1168. By Padraig O'Sullivan

Apparently, changing the size of a column in an I_S table makes query
execution work differently...isn't that just magical???

So I changed the length of the COLUMN_TYPE column in the COLUMNS table and
some queries from the I_S test case that didn't work before now
work...great.

I also changed rnd_pos to return HA_ERR_WRONG_COMMAND so I can see where it
is getting called from. I need to implement rnd_pos and position next.

Some good progress was made tonight though...When I get the 2 methods above
implemented, I should be very very close to having this damn thing working
(although knowing I_S, it will be probably crash and burn for no apparent
reason..)

Revision history for this message
Brian Aker (brianaker) wrote :

This has been pulled in now (relevant bits were merged).

Unmerged revisions

1168. By Padraig O'Sullivan

Apparently, changing the size of a column in an I_S table makes query
execution work differently...isn't that just magical???

So I changed the length of the COLUMN_TYPE column in the COLUMNS table and
some queries from the I_S test case that didn't work before now
work...great.

I also changed rnd_pos to return HA_ERR_WRONG_COMMAND so I can see where it
is getting called from. I need to implement rnd_pos and position next.

Some good progress was made tonight though...When I get the 2 methods above
implemented, I should be very very close to having this damn thing working
(although knowing I_S, it will be probably crash and burn for no apparent
reason..)

1167. By Padraig O'Sullivan

Taking Jay's review suggestion to change Rows from vector<InfoSchemaRecord>
to vector<InfoSchemaRecord *>.

Thanks Jay!

1166. By Padraig O'Sullivan

Reworked the processTable() method parameters to be more sane.

1165. By Padraig O'Sullivan

Merge from trunk.

1164. By Padraig O'Sullivan

Modified the fillTable() method to not take a COND as a parameter any more.

1163. By Padraig O'Sullivan

Removed a redundant field from the InfoSchemaColumn class. This allowed us
to remove some redundant flags.

1162. By Padraig O'Sullivan

Resolved conflicts from the latest merge with trunk.

1161. By Padraig O'Sullivan

Merge from trunk.

1160. By Padraig O'Sullivan

Moved a statement into a conditional block where it actually belonged in the
first place.

1159. By Padraig O'Sullivan

Corrected the destructor in the InfoSchemaRecord class.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/definitions.h'
--- drizzled/definitions.h 2009-10-21 00:14:57 +0000
+++ drizzled/definitions.h 2009-10-29 23:56:13 +0000
@@ -226,7 +226,7 @@
226/** Characters shown for the command in 'show processlist'. */226/** Characters shown for the command in 'show processlist'. */
227#define PROCESS_LIST_WIDTH 100227#define PROCESS_LIST_WIDTH 100
228/* Characters shown for the command in 'information_schema.processlist' */228/* Characters shown for the command in 'information_schema.processlist' */
229#define PROCESS_LIST_INFO_WIDTH 65535229#define PROCESS_LIST_INFO_WIDTH 16383
230230
231#define PRECISION_FOR_DOUBLE 53231#define PRECISION_FOR_DOUBLE 53
232#define PRECISION_FOR_FLOAT 24232#define PRECISION_FOR_FLOAT 24
@@ -527,10 +527,6 @@
527#define MY_I_S_UNSIGNED 2527#define MY_I_S_UNSIGNED 2
528528
529529
530#define SKIP_OPEN_TABLE 0 // do not open table
531#define OPEN_FRM_ONLY 1 // open FRM file only
532#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files
533
534/*530/*
535 "Declared Type Collation"531 "Declared Type Collation"
536 A combination of collation and its derivation.532 A combination of collation and its derivation.
537533
=== modified file 'drizzled/field/int64_t.cc'
--- drizzled/field/int64_t.cc 2009-07-10 00:01:50 +0000
+++ drizzled/field/int64_t.cc 2009-10-29 23:56:14 +0000
@@ -40,7 +40,7 @@
40 char *end;40 char *end;
41 uint64_t tmp;41 uint64_t tmp;
4242
43 ASSERT_COLUMN_MARKED_FOR_WRITE;43 //ASSERT_COLUMN_MARKED_FOR_WRITE;
4444
45 tmp= cs->cset->strntoull10rnd(cs, from, len, false, &end,&error);45 tmp= cs->cset->strntoull10rnd(cs, from, len, false, &end,&error);
46 if (error == MY_ERRNO_ERANGE)46 if (error == MY_ERRNO_ERANGE)
@@ -70,7 +70,7 @@
70 int error= 0;70 int error= 0;
71 int64_t res;71 int64_t res;
7272
73 ASSERT_COLUMN_MARKED_FOR_WRITE;73 //ASSERT_COLUMN_MARKED_FOR_WRITE;
7474
75 nr= rint(nr);75 nr= rint(nr);
7676
@@ -106,7 +106,7 @@
106{106{
107 int error= 0;107 int error= 0;
108108
109 ASSERT_COLUMN_MARKED_FOR_WRITE;109 //ASSERT_COLUMN_MARKED_FOR_WRITE;
110110
111#ifdef WORDS_BIGENDIAN111#ifdef WORDS_BIGENDIAN
112 if (table->s->db_low_byte_first)112 if (table->s->db_low_byte_first)
@@ -124,7 +124,7 @@
124{124{
125 int64_t j;125 int64_t j;
126126
127 ASSERT_COLUMN_MARKED_FOR_READ;127 //ASSERT_COLUMN_MARKED_FOR_READ;
128128
129#ifdef WORDS_BIGENDIAN129#ifdef WORDS_BIGENDIAN
130 if (table->s->db_low_byte_first)130 if (table->s->db_low_byte_first)
@@ -143,7 +143,7 @@
143{143{
144 int64_t j;144 int64_t j;
145145
146 ASSERT_COLUMN_MARKED_FOR_READ;146 //ASSERT_COLUMN_MARKED_FOR_READ;
147147
148#ifdef WORDS_BIGENDIAN148#ifdef WORDS_BIGENDIAN
149 if (table->s->db_low_byte_first)149 if (table->s->db_low_byte_first)
@@ -165,7 +165,7 @@
165 char *to=(char*) val_buffer->ptr();165 char *to=(char*) val_buffer->ptr();
166 int64_t j;166 int64_t j;
167167
168 ASSERT_COLUMN_MARKED_FOR_READ;168 //ASSERT_COLUMN_MARKED_FOR_READ;
169169
170#ifdef WORDS_BIGENDIAN170#ifdef WORDS_BIGENDIAN
171 if (table->s->db_low_byte_first)171 if (table->s->db_low_byte_first)
172172
=== modified file 'drizzled/field/long.cc'
--- drizzled/field/long.cc 2009-07-10 00:01:50 +0000
+++ drizzled/field/long.cc 2009-10-29 23:56:14 +0000
@@ -62,7 +62,7 @@
62 int32_t res;62 int32_t res;
63 nr=rint(nr);63 nr=rint(nr);
6464
65 ASSERT_COLUMN_MARKED_FOR_WRITE;65 //ASSERT_COLUMN_MARKED_FOR_WRITE;
6666
67 if (nr < (double) INT32_MIN)67 if (nr < (double) INT32_MIN)
68 {68 {
6969
=== modified file 'drizzled/join.cc'
--- drizzled/join.cc 2009-10-06 19:51:49 +0000
+++ drizzled/join.cc 2009-10-29 23:56:13 +0000
@@ -1245,9 +1245,6 @@
1245 return;1245 return;
1246 }1246 }
12471247
1248 if ((this->select_lex->options & OPTION_SCHEMA_TABLE) && get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC))
1249 return;
1250
1251 if (select_options & SELECT_DESCRIBE)1248 if (select_options & SELECT_DESCRIBE)
1252 {1249 {
1253 /*1250 /*
12541251
=== modified file 'drizzled/plugin/info_schema_table.h'
--- drizzled/plugin/info_schema_table.h 2009-10-06 19:14:39 +0000
+++ drizzled/plugin/info_schema_table.h 2009-10-29 23:56:14 +0000
@@ -25,6 +25,9 @@
2525
26namespace drizzled26namespace drizzled
27{27{
28
29extern std::vector<plugin::InfoSchemaTable *> all_schema_tables;
30
28namespace plugin31namespace plugin
29{32{
3033
@@ -35,9 +38,6 @@
35 * Header file which contains all classes related to I_S38 * Header file which contains all classes related to I_S
36 */39 */
3740
38typedef class Item COND;
39
40
41/**41/**
42 * @class ColumnInfo42 * @class ColumnInfo
43 * @brief43 * @brief
@@ -51,16 +51,14 @@
51 enum enum_field_types in_type,51 enum enum_field_types in_type,
52 int32_t in_value,52 int32_t in_value,
53 uint32_t in_flags,53 uint32_t in_flags,
54 const std::string& in_old_name,54 const std::string& in_old_name)
55 uint32_t in_open_method)
56 :55 :
57 name(in_name),56 name(in_name),
58 length(in_length),57 length(in_length),
59 type(in_type),58 type(in_type),
60 value(in_value),59 value(in_value),
61 flags(in_flags),60 flags(in_flags),
62 old_name(in_old_name),61 old_name(in_old_name)
63 open_method(in_open_method)
64 {}62 {}
6563
66 ColumnInfo()64 ColumnInfo()
@@ -69,8 +67,7 @@
69 length(0),67 length(0),
70 type(DRIZZLE_TYPE_VARCHAR),68 type(DRIZZLE_TYPE_VARCHAR),
71 flags(0),69 flags(0),
72 old_name(),70 old_name()
73 open_method(SKIP_OPEN_TABLE)
74 {}71 {}
7572
76 /**73 /**
@@ -97,14 +94,6 @@
97 }94 }
9895
99 /**96 /**
100 * @return the open method for this column.
101 */
102 uint32_t getOpenMethod() const
103 {
104 return open_method;
105 }
106
107 /**
108 * @return the flags for this column.97 * @return the flags for this column.
109 */98 */
110 uint32_t getFlags() const99 uint32_t getFlags() const
@@ -174,12 +163,6 @@
174 */163 */
175 const std::string old_name;164 const std::string old_name;
176165
177 /**
178 * This should be one of @c SKIP_OPEN_TABLE,
179 * @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
180 */
181 uint32_t open_method;
182
183};166};
184167
185/**168/**
@@ -192,18 +175,72 @@
192public:175public:
193 virtual ~InfoSchemaMethods() {}176 virtual ~InfoSchemaMethods() {}
194177
195 virtual Table *createSchemaTable(Session *session,
196 TableList *table_list) const;
197 virtual int fillTable(Session *session, 178 virtual int fillTable(Session *session,
198 TableList *tables,179 TableList *tables);
199 COND *cond);180 virtual int processTable(InfoSchemaTable *store_table,
200 virtual int processTable(Session *session, TableList *tables,181 Session *session, TableList *tables,
201 Table *table, bool res, LEX_STRING *db_name,182 Table *table, bool res, LEX_STRING *db_name,
202 LEX_STRING *table_name) const;183 LEX_STRING *table_name);
203 virtual int oldFormat(Session *session, 184 virtual int oldFormat(Session *session,
204 InfoSchemaTable *schema_table) const;185 InfoSchemaTable *schema_table) const;
205};186};
206187
188class InfoSchemaRecord
189{
190public:
191 InfoSchemaRecord()
192 :
193 record(NULL),
194 rec_len(0)
195 {}
196
197 InfoSchemaRecord(unsigned char *buf,
198 size_t in_len)
199 :
200 record(NULL),
201 rec_len(in_len)
202 {
203 record= new unsigned char[rec_len];
204 memcpy(record, buf, rec_len);
205 }
206
207 InfoSchemaRecord(const InfoSchemaRecord &rhs)
208 :
209 record(NULL),
210 rec_len(rhs.rec_len)
211 {
212 record= new unsigned char[rec_len];
213 memcpy(record, rhs.record, rec_len);
214 }
215
216 ~InfoSchemaRecord()
217 {
218 if (record)
219 {
220 delete [] record;
221 }
222 }
223
224 void copyRecordInto(unsigned char *buf)
225 {
226 memcpy(buf, record, rec_len);
227 }
228
229private:
230 unsigned char *record;
231 size_t rec_len;
232};
233
234class DeleteRows
235{
236public:
237 template<typename T>
238 inline void operator()(const T *ptr) const
239 {
240 delete ptr;
241 }
242};
243
207/**244/**
208 * @class InfoSchemaTable245 * @class InfoSchemaTable
209 * @brief 246 * @brief
@@ -217,6 +254,7 @@
217public:254public:
218255
219 typedef std::vector<const ColumnInfo *> Columns;256 typedef std::vector<const ColumnInfo *> Columns;
257 typedef std::vector<InfoSchemaRecord *> Rows;
220 258
221 InfoSchemaTable(const std::string& tab_name,259 InfoSchemaTable(const std::string& tab_name,
222 Columns& in_column_info,260 Columns& in_column_info,
@@ -234,6 +272,7 @@
234 second_column_index(idx_col2),272 second_column_index(idx_col2),
235 requested_object(req_object),273 requested_object(req_object),
236 column_info(in_column_info),274 column_info(in_column_info),
275 rows(),
237 i_s_methods(in_methods)276 i_s_methods(in_methods)
238 {}277 {}
239278
@@ -246,11 +285,17 @@
246 second_column_index(0),285 second_column_index(0),
247 requested_object(0),286 requested_object(0),
248 column_info(),287 column_info(),
288 rows(),
249 i_s_methods(NULL)289 i_s_methods(NULL)
250 {}290 {}
251291
252 virtual ~InfoSchemaTable()292 virtual ~InfoSchemaTable()
253 {}293 {
294 /* de-allocate memory in the rows */
295 for_each(rows.begin(),
296 rows.end(),
297 DeleteRows());
298 }
254299
255 /**300 /**
256 * Set the methods available on this I_S table.301 * Set the methods available on this I_S table.
@@ -262,31 +307,15 @@
262 }307 }
263308
264 /**309 /**
265 * Create the temporary I_S tables using schema_table data.
266 *
267 * @param[in] session a session handler
268 * @param[in] table_list Used to pass I_S table information (fields,
269 * tables, parameters, etc.) and table name
270 * @retval \# pointer to created table
271 * @retval NULL Can't create table
272 */
273 Table *createSchemaTable(Session *session, TableList *table_list) const
274 {
275 Table *retval= i_s_methods->createSchemaTable(session, table_list);
276 return retval;
277 }
278
279 /**
280 * Fill I_S table.310 * Fill I_S table.
281 *311 *
282 * @param[in] session a session handler312 * @param[in] session a session handler
283 * @param[in] tables I_S table313 * @param[in] tables I_S table
284 * @param[in] cond 'WHERE' condition
285 * @return 0 on success; 1 on error314 * @return 0 on success; 1 on error
286 */315 */
287 int fillTable(Session *session, TableList *tables, COND *cond)316 int fillTable(Session *session, TableList *tables)
288 {317 {
289 int retval= i_s_methods->fillTable(session, tables, cond);318 int retval= i_s_methods->fillTable(session, tables);
290 return retval;319 return retval;
291 }320 }
292321
@@ -295,7 +324,6 @@
295 *324 *
296 * @param[in] session a session handler325 * @param[in] session a session handler
297 * @param[in] tables table list (processed table)326 * @param[in] tables table list (processed table)
298 * @param[in] table I_S table
299 * @param[in] res 1 means error during opening of the processed table327 * @param[in] res 1 means error during opening of the processed table
300 * 0 means processed table opened without error328 * 0 means processed table opened without error
301 * @param[in] db_name database name329 * @param[in] db_name database name
@@ -303,9 +331,9 @@
303 * @return 0 on success; 1 on error331 * @return 0 on success; 1 on error
304 */332 */
305 int processTable(Session *session, TableList *tables, Table *table,333 int processTable(Session *session, TableList *tables, Table *table,
306 bool res, LEX_STRING *db_name, LEX_STRING *tab_name) const334 bool res, LEX_STRING *db_name, LEX_STRING *tab_name)
307 {335 {
308 int retval= i_s_methods->processTable(session, tables, table,336 int retval= i_s_methods->processTable(this, session, tables, table,
309 res, db_name, tab_name);337 res, db_name, tab_name);
310 return retval;338 return retval;
311 }339 }
@@ -410,6 +438,19 @@
410 return column_info;438 return column_info;
411 }439 }
412440
441 Rows &getRows()
442 {
443 return rows;
444 }
445
446 void clearRows()
447 {
448 for_each(rows.begin(),
449 rows.end(),
450 DeleteRows());
451 rows.clear();
452 }
453
413 /**454 /**
414 * @param[in] index the index of this column455 * @param[in] index the index of this column
415 * @return the name for the column at the given index456 * @return the name for the column at the given index
@@ -419,13 +460,10 @@
419 return column_info[index]->getName();460 return column_info[index]->getName();
420 }461 }
421462
422 /**463 void addRow(unsigned char *buf, size_t len)
423 * @param[in] index the index of this column
424 * @return the open method for the column at the given index
425 */
426 uint32_t getColumnOpenMethod(int index) const
427 {464 {
428 return column_info[index]->getOpenMethod();465 InfoSchemaRecord *record= new InfoSchemaRecord(buf, len);
466 rows.push_back(record);
429 }467 }
430468
431private:469private:
@@ -464,6 +502,8 @@
464 */502 */
465 Columns column_info;503 Columns column_info;
466504
505 Rows rows;
506
467 /**507 /**
468 * Contains the methods available on this I_S table.508 * Contains the methods available on this I_S table.
469 */509 */
470510
=== modified file 'drizzled/plugin/storage_engine.cc'
--- drizzled/plugin/storage_engine.cc 2009-10-19 04:52:19 +0000
+++ drizzled/plugin/storage_engine.cc 2009-10-29 23:56:14 +0000
@@ -137,7 +137,7 @@
137 !0 Error137 !0 Error
138*/138*/
139int plugin::StorageEngine::deleteTableImplementation(Session *,139int plugin::StorageEngine::deleteTableImplementation(Session *,
140 const string table_path)140 const string &table_path)
141{141{
142 int error= 0;142 int error= 0;
143 int enoent_or_zero= ENOENT; // Error if no file was deleted143 int enoent_or_zero= ENOENT; // Error if no file was deleted
@@ -757,16 +757,19 @@
757757
758 if (dirp == NULL)758 if (dirp == NULL)
759 {759 {
760 if (my_errno == ENOENT)760 if (my_errno != ENOENT)
761 my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str());761 {
762 else762 my_error(ER_CANT_READ_DIR,
763 my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno);763 MYF(ME_BELL + ME_WAITTANG),
764 return(ENOENT);764 path,
765 my_errno);
766 }
767 return ENOENT;
765 }768 }
766 current_entry= -1;769 current_entry= -1;
767 }770 }
768771
769 while(true)772 while (true)
770 {773 {
771 current_entry++;774 current_entry++;
772775
@@ -844,7 +847,7 @@
844847
845 err= current_implementation->next(name);848 err= current_implementation->next(name);
846849
847 if (err == -1)850 if (err == -1 || err == ENOENT)
848 {851 {
849 if (current_implementation != default_implementation)852 if (current_implementation != default_implementation)
850 {853 {
@@ -852,6 +855,19 @@
852 current_implementation= NULL;855 current_implementation= NULL;
853 goto next;856 goto next;
854 }857 }
858 if (current_implementation == default_implementation)
859 {
860 if (database.compare(INFORMATION_SCHEMA_NAME) == 0)
861 {
862 return -1;
863 }
864 if (err == ENOENT)
865 {
866 my_error(ER_BAD_DB_ERROR,
867 MYF(ME_BELL + ME_WAITTANG),
868 database.c_str());
869 }
870 }
855 }871 }
856872
857 return err;873 return err;
858874
=== modified file 'drizzled/plugin/storage_engine.h'
--- drizzled/plugin/storage_engine.h 2009-10-16 10:27:33 +0000
+++ drizzled/plugin/storage_engine.h 2009-10-29 23:56:14 +0000
@@ -54,6 +54,7 @@
54 HTON_BIT_TEMPORARY_ONLY,54 HTON_BIT_TEMPORARY_ONLY,
55 HTON_BIT_FILE_BASED, // use for check_lowercase_names55 HTON_BIT_FILE_BASED, // use for check_lowercase_names
56 HTON_BIT_HAS_DATA_DICTIONARY,56 HTON_BIT_HAS_DATA_DICTIONARY,
57 HTON_BIT_CREATE_NOT_SUPPORTED, // Engine does support the creation of tables
57 HTON_BIT_SIZE58 HTON_BIT_SIZE
58};59};
5960
@@ -67,6 +68,7 @@
67static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_ONLY(1 << HTON_BIT_TEMPORARY_ONLY);68static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_ONLY(1 << HTON_BIT_TEMPORARY_ONLY);
68static const std::bitset<HTON_BIT_SIZE> HTON_FILE_BASED(1 << HTON_BIT_FILE_BASED);69static const std::bitset<HTON_BIT_SIZE> HTON_FILE_BASED(1 << HTON_BIT_FILE_BASED);
69static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY);70static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY);
71static const std::bitset<HTON_BIT_SIZE> HTON_CREATE_NOT_SUPPORTED(1 << HTON_BIT_CREATE_NOT_SUPPORTED);
7072
71class Table;73class Table;
7274
@@ -276,7 +278,7 @@
276 const char *from, const char *to);278 const char *from, const char *to);
277279
278 virtual int deleteTableImplementation(Session* session,280 virtual int deleteTableImplementation(Session* session,
279 const std::string table_path);281 const std::string &table_path);
280282
281public:283public:
282 int doCreateTable(Session *session, const char *path, 284 int doCreateTable(Session *session, const char *path,
283285
=== modified file 'drizzled/show.cc'
--- drizzled/show.cc 2009-10-16 00:38:56 +0000
+++ drizzled/show.cc 2009-10-29 23:56:14 +0000
@@ -63,8 +63,6 @@
6363
64static void store_key_options(String *packet, Table *table, KEY *key_info);64static void store_key_options(String *packet, Table *table, KEY *key_info);
6565
66
67
68int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)66int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)
69{67{
70 register int flag;68 register int flag;
@@ -225,9 +223,6 @@
225 if (session->client->sendFields(&field_list))223 if (session->client->sendFields(&field_list))
226 return true;224 return true;
227 {225 {
228 if (table_list->schema_table)
229 session->client->store(table_list->schema_table->getTableName().c_str());
230 else
231 session->client->store(table_list->table->alias);226 session->client->store(table_list->table->alias);
232 }227 }
233228
@@ -1016,35 +1011,6 @@
1016 return;1011 return;
1017}1012}
10181013
1019/*
1020 Store record to I_S table, convert HEAP table
1021 to MyISAM if necessary
1022
1023 SYNOPSIS
1024 schema_table_store_record()
1025 session thread Cursor
1026 table Information schema table to be updated
1027
1028 RETURN
1029 0 success
1030 1 error
1031*/
1032
1033bool schema_table_store_record(Session *session, Table *table)
1034{
1035 int error;
1036 if ((error= table->file->ha_write_row(table->record[0])))
1037 {
1038 Tmp_Table_Param *param= table->pos_in_table_list->schema_table_param;
1039
1040 if (create_myisam_from_heap(session, table, param->start_recinfo,
1041 &param->recinfo, error, 0))
1042 return true;
1043 }
1044 return false;
1045}
1046
1047
1048static int make_table_list(Session *session, Select_Lex *sel,1014static int make_table_list(Session *session, Select_Lex *sel,
1049 LEX_STRING *db_name, LEX_STRING *table_name)1015 LEX_STRING *db_name, LEX_STRING *table_name)
1050{1016{
@@ -1484,14 +1450,6 @@
1484 return 0;1450 return 0;
1485 }1451 }
14861452
1487 /*
1488 This call will add all matching the wildcards (if specified) IS tables
1489 to the list
1490 */
1491 if (with_i_schema)
1492 return plugin::InfoSchemaTable::addTableToList(session, table_names,
1493 lookup_field_vals->table_value.str);
1494
1495 string db(db_name->str);1453 string db(db_name->str);
14961454
1497 plugin::TableNameIterator tniter(db);1455 plugin::TableNameIterator tniter(db);
@@ -1593,13 +1551,16 @@
15931551
15941552
1595 table->setWriteSet();1553 table->setWriteSet();
1596 error= test(schema_table->processTable(session, show_table_list,1554 error= test(schema_table->processTable(session,
1597 table, res, db_name,1555 show_table_list,
1556 table,
1557 res,
1558 db_name,
1598 table_name));1559 table_name));
1599 session->temporary_tables= 0;1560 session->temporary_tables= 0;
1600 session->close_tables_for_reopen(&show_table_list);1561 session->close_tables_for_reopen(&show_table_list);
16011562
1602 return(error);1563 return error;
1603}1564}
16041565
16051566
@@ -1641,114 +1602,13 @@
1641 return 0;1602 return 0;
1642 }1603 }
1643 }1604 }
1644 if (schema_table_store_record(session, table))1605 TableList *tmp= table->pos_in_table_list;
1645 return 1;1606 tmp->schema_table->addRow(table->record[0], table->s->reclength);
1646 return 0;1607 return 0;
1647}1608}
16481609
16491610
1650/**1611/**
1651 @brief Get open table method
1652
1653 @details The function calculates the method which will be used
1654 for table opening:
1655 SKIP_OPEN_TABLE - do not open table
1656 OPEN_FRM_ONLY - open FRM file only
1657 OPEN_FULL_TABLE - open FRM, data, index files
1658 @param[in] tables I_S table table_list
1659 @param[in] schema_table I_S table struct
1660
1661 @return return a set of flags
1662 @retval SKIP_OPEN_TABLE | OPEN_FRM_ONLY | OPEN_FULL_TABLE
1663*/
1664
1665static uint32_t get_table_open_method(TableList *tables,
1666 plugin::InfoSchemaTable *schema_table)
1667{
1668 /*
1669 determine which method will be used for table opening
1670 */
1671 if (schema_table->getRequestedObject() & OPTIMIZE_I_S_TABLE)
1672 {
1673 Field **ptr, *field;
1674 int table_open_method= 0, field_indx= 0;
1675 for (ptr= tables->table->field; (field= *ptr) ; ptr++)
1676 {
1677 if (field->isReadSet())
1678 table_open_method|= schema_table->getColumnOpenMethod(field_indx);
1679 field_indx++;
1680 }
1681 return table_open_method;
1682 }
1683 /* I_S tables which use get_all_tables but can not be optimized */
1684 return (uint32_t) OPEN_FULL_TABLE;
1685}
1686
1687
1688/**
1689 @brief Fill I_S table with data from FRM file only
1690
1691 @param[in] session thread Cursor
1692 @param[in] table Table struct for I_S table
1693 @param[in] schema_table I_S table struct
1694 @param[in] db_name database name
1695 @param[in] table_name table name
1696
1697 @return Operation status
1698 @retval 0 Table is processed and we can continue
1699 with new table
1700 @retval 1 It's view and we have to use
1701 open_tables function for this table
1702*/
1703
1704static int fill_schema_table_from_frm(Session *session,TableList *tables,
1705 plugin::InfoSchemaTable *schema_table,
1706 LEX_STRING *db_name,
1707 LEX_STRING *table_name)
1708{
1709 Table *table= tables->table;
1710 TableShare *share;
1711 Table tbl;
1712 TableList table_list;
1713 uint32_t res= 0;
1714 int error;
1715 char key[MAX_DBKEY_LENGTH];
1716 uint32_t key_length;
1717
1718 memset(&tbl, 0, sizeof(Table));
1719
1720 table_list.table_name= table_name->str;
1721 table_list.db= db_name->str;
1722
1723 key_length= table_list.create_table_def_key(key);
1724 pthread_mutex_lock(&LOCK_open); /* Locking to get table share when filling schema table from FRM */
1725 share= TableShare::getShare(session, &table_list, key, key_length, 0, &error);
1726 if (!share)
1727 {
1728 res= 0;
1729 goto err;
1730 }
1731
1732 {
1733 tbl.s= share;
1734 table_list.table= &tbl;
1735 res= schema_table->processTable(session, &table_list, table,
1736 res, db_name, table_name);
1737 }
1738 /* For the moment we just set everything to read */
1739 table->setReadSet();
1740
1741 TableShare::release(share);
1742
1743err:
1744 pthread_mutex_unlock(&LOCK_open);
1745 session->clear_error();
1746 return res;
1747}
1748
1749
1750
1751/**
1752 @brief Fill I_S tables whose data are retrieved1612 @brief Fill I_S tables whose data are retrieved
1753 from frm files and storage engine1613 from frm files and storage engine
17541614
@@ -1760,13 +1620,12 @@
17601620
1761 @param[in] session thread Cursor1621 @param[in] session thread Cursor
1762 @param[in] tables I_S table1622 @param[in] tables I_S table
1763 @param[in] cond 'WHERE' condition
17641623
1765 @return Operation status1624 @return Operation status
1766 @retval 0 success1625 @retval 0 success
1767 @retval 1 error1626 @retval 1 error
1768*/1627*/
1769int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond)1628int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables)
1770{1629{
1771 LEX *lex= session->lex;1630 LEX *lex= session->lex;
1772 Table *table= tables->table;1631 Table *table= tables->table;
@@ -1779,11 +1638,12 @@
1779 bool with_i_schema;1638 bool with_i_schema;
1780 vector<LEX_STRING*> db_names, table_names;1639 vector<LEX_STRING*> db_names, table_names;
1781 COND *partial_cond= 0;1640 COND *partial_cond= 0;
1641 /* the WHERE condition */
1642 COND *cond= table->reginfo.join_tab->select_cond;
1782 uint32_t derived_tables= lex->derived_tables;1643 uint32_t derived_tables= lex->derived_tables;
1783 int error= 1;1644 int error= 1;
1784 Open_tables_state open_tables_state_backup;1645 Open_tables_state open_tables_state_backup;
1785 Query_tables_list query_tables_list_backup;1646 Query_tables_list query_tables_list_backup;
1786 uint32_t table_open_method;
1787 bool old_value= session->no_warnings_for_error;1647 bool old_value= session->no_warnings_for_error;
17881648
1789 /*1649 /*
@@ -1793,8 +1653,6 @@
1793 */1653 */
1794 session->reset_n_backup_open_tables_state(&open_tables_state_backup);1654 session->reset_n_backup_open_tables_state(&open_tables_state_backup);
17951655
1796 tables->table_open_method= table_open_method=
1797 get_table_open_method(tables, schema_table);
1798 /*1656 /*
1799 this branch processes SHOW FIELDS, SHOW INDEXES commands.1657 this branch processes SHOW FIELDS, SHOW INDEXES commands.
1800 see sql_parse.cc, prepare_schema_table() function where1658 see sql_parse.cc, prepare_schema_table() function where
@@ -1813,14 +1671,14 @@
1813 goto err;1671 goto err;
1814 }1672 }
18151673
1816 if (!lookup_field_vals.wild_db_value && !lookup_field_vals.wild_table_value)1674 if (! lookup_field_vals.wild_db_value && ! lookup_field_vals.wild_table_value)
1817 {1675 {
1818 /*1676 /*
1819 if lookup value is empty string then1677 if lookup value is empty string then
1820 it's impossible table name or db name1678 it's impossible table name or db name
1821 */1679 */
1822 if ((lookup_field_vals.db_value.str && !lookup_field_vals.db_value.str[0]) ||1680 if ((lookup_field_vals.db_value.str && ! lookup_field_vals.db_value.str[0]) ||
1823 (lookup_field_vals.table_value.str && !lookup_field_vals.table_value.str[0]))1681 (lookup_field_vals.table_value.str && ! lookup_field_vals.table_value.str[0]))
1824 {1682 {
1825 error= 0;1683 error= 0;
1826 goto err;1684 goto err;
@@ -1828,12 +1686,16 @@
1828 }1686 }
18291687
1830 if (lookup_field_vals.db_value.length &&1688 if (lookup_field_vals.db_value.length &&
1831 !lookup_field_vals.wild_db_value)1689 ! lookup_field_vals.wild_db_value)
1690 {
1832 tables->has_db_lookup_value= true;1691 tables->has_db_lookup_value= true;
1692 }
18331693
1834 if (lookup_field_vals.table_value.length &&1694 if (lookup_field_vals.table_value.length &&
1835 !lookup_field_vals.wild_table_value)1695 ! lookup_field_vals.wild_table_value)
1696 {
1836 tables->has_table_lookup_value= true;1697 tables->has_table_lookup_value= true;
1698 }
18371699
1838 if (tables->has_db_lookup_value && tables->has_table_lookup_value)1700 if (tables->has_db_lookup_value && tables->has_table_lookup_value)
1839 partial_cond= 0;1701 partial_cond= 0;
@@ -1874,55 +1736,36 @@
1874 table->field[schema_table->getSecondColumnIndex()]->1736 table->field[schema_table->getSecondColumnIndex()]->
1875 store((*table_name)->str, (*table_name)->length, system_charset_info);1737 store((*table_name)->str, (*table_name)->length, system_charset_info);
18761738
1877 if (!partial_cond || partial_cond->val_int())1739 if (! partial_cond || partial_cond->val_int())
1878 {1740 {
1879 /*
1880 If table is I_S.tables and open_table_method is 0 (eg SKIP_OPEN)
1881 we can skip table opening and we don't have lookup value for
1882 table name or lookup value is wild string(table name list is
1883 already created by make_table_name_list() function).
1884 */
1885 if (! table_open_method &&
1886 schema_table->getTableName().compare("TABLES") == 0 &&
1887 (! lookup_field_vals.table_value.length ||
1888 lookup_field_vals.wild_table_value))
1889 {
1890 if (schema_table_store_record(session, table))
1891 goto err; /* Out of space in temporary table */
1892 continue;
1893 }
1894
1895 /* SHOW Table NAMES command */
1896 if (schema_table->getTableName().compare("TABLE_NAMES") == 0)1741 if (schema_table->getTableName().compare("TABLE_NAMES") == 0)
1897 {1742 {
1898 if (fill_schema_table_names(session, tables->table, *db_name,1743 if (fill_schema_table_names(session,
1899 *table_name, with_i_schema))1744 tables->table,
1745 *db_name,
1746 *table_name,
1747 with_i_schema))
1748 {
1900 continue;1749 continue;
1750 }
1901 }1751 }
1902 else1752 else
1903 {1753 {
1904 if (!(table_open_method & ~OPEN_FRM_ONLY) &&
1905 !with_i_schema)
1906 {
1907 if (!fill_schema_table_from_frm(session, tables, schema_table, *db_name,
1908 *table_name))
1909 continue;
1910 }
1911
1912 LEX_STRING tmp_lex_string, orig_db_name;1754 LEX_STRING tmp_lex_string, orig_db_name;
1913 /*
1914 Set the parent lex of 'sel' because it is needed by
1915 sel.init_query() which is called inside make_table_list.
1916 */
1917 session->no_warnings_for_error= 1;1755 session->no_warnings_for_error= 1;
1918 sel.parent_lex= lex;1756 sel.parent_lex= lex;
1919 /* db_name can be changed in make_table_list() func */1757 if (! session->make_lex_string(&orig_db_name,
1920 if (!session->make_lex_string(&orig_db_name, (*db_name)->str,1758 (*db_name)->str,
1921 (*db_name)->length, false))1759 (*db_name)->length,
1760 false))
1761 {
1922 goto err;1762 goto err;
1763 }
19231764
1924 if (make_table_list(session, &sel, *db_name, *table_name))1765 if (make_table_list(session, &sel, *db_name, *table_name))
1766 {
1925 goto err;1767 goto err;
1768 }
19261769
1927 TableList *show_table_list= (TableList*) sel.table_list.first;1770 TableList *show_table_list= (TableList*) sel.table_list.first;
1928 lex->all_selects_list= &sel;1771 lex->all_selects_list= &sel;
@@ -1933,38 +1776,41 @@
1933 res= session->openTables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);1776 res= session->openTables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);
1934 lex->sql_command= save_sql_command;1777 lex->sql_command= save_sql_command;
1935 /*1778 /*
1936 XXX-> show_table_list has a flag i_is_requested,1779 XXX-> show_table_list has a flag i_is_requested,
1937 and when it's set, openTables()1780 and when it's set, openTables()
1938 can return an error without setting an error message1781 can return an error without setting an error message
1939 in Session, which is a hack. This is why we have to1782 in Session, which is a hack. This is why we have to
1940 check for res, then for session->is_error() only then1783 check for res, then for session->is_error() only then
1941 for session->main_da.sql_errno().1784 for session->main_da.sql_errno().
1942 */1785 */
1943 if (res && session->is_error() &&1786 if (res && session->is_error() &&
1944 session->main_da.sql_errno() == ER_NO_SUCH_TABLE)1787 session->main_da.sql_errno() == ER_NO_SUCH_TABLE)
1945 {1788 {
1946 /*1789 /*
1947 Hide error for not existing table.1790 Hide error for not existing table.
1948 This error can occur for example when we use1791 This error can occur for example when we use
1949 where condition with db name and table name and this1792 where condition with db name and table name and this
1950 table does not exist.1793 table does not exist.
1951 */1794 */
1952 res= 0;1795 res= 0;
1953 session->clear_error();1796 session->clear_error();
1954 }1797 }
1955 else1798 else
1956 {1799 {
1957 /*1800 /*
1958 We should use show_table_list->alias instead of1801 We should use show_table_list->alias instead of
1959 show_table_list->table_name because table_name1802 show_table_list->table_name because table_name
1960 could be changed during opening of I_S tables. It's safe1803 could be changed during opening of I_S tables. It's safe
1961 to use alias because alias contains original table name1804 to use alias because alias contains original table name
1962 in this case.1805 in this case.
1963 */1806 */
1964 session->make_lex_string(&tmp_lex_string, show_table_list->alias,1807 session->make_lex_string(&tmp_lex_string, show_table_list->alias,
1965 strlen(show_table_list->alias), false);1808 strlen(show_table_list->alias), false);
1966 res= schema_table->processTable(session, show_table_list, table,1809 res= schema_table->processTable(session,
1967 res, &orig_db_name,1810 show_table_list,
1811 table,
1812 res,
1813 &orig_db_name,
1968 &tmp_lex_string);1814 &tmp_lex_string);
1969 session->close_tables_for_reopen(&show_table_list);1815 session->close_tables_for_reopen(&show_table_list);
1970 }1816 }
@@ -2092,10 +1938,12 @@
2092}1938}
20931939
20941940
2095int plugin::InfoSchemaMethods::processTable(Session *session, TableList *tables,1941int plugin::InfoSchemaMethods::processTable(
1942 plugin::InfoSchemaTable *store_table,
1943 Session *session, TableList *tables,
2096 Table *table, bool res,1944 Table *table, bool res,
2097 LEX_STRING *db_name,1945 LEX_STRING *db_name,
2098 LEX_STRING *table_name) const1946 LEX_STRING *table_name)
2099{1947{
2100 LEX *lex= session->lex;1948 LEX *lex= session->lex;
2101 const char *wild= lex->wild ? lex->wild->ptr() : NULL;1949 const char *wild= lex->wild ? lex->wild->ptr() : NULL;
@@ -2119,7 +1967,7 @@
2119 session->clear_error();1967 session->clear_error();
2120 res= 0;1968 res= 0;
2121 }1969 }
2122 return(res);1970 return res;
2123 }1971 }
21241972
2125 show_table= tables->table;1973 show_table= tables->table;
@@ -2138,7 +1986,7 @@
2138 }1986 }
21391987
2140 /* For the moment we just set everything to read */1988 /* For the moment we just set everything to read */
2141 if (!show_table->read_set)1989 if (! show_table->read_set)
2142 {1990 {
2143 show_table->def_read_set.setAll();1991 show_table->def_read_set.setAll();
2144 show_table->read_set= &show_table->def_read_set;1992 show_table->read_set= &show_table->def_read_set;
@@ -2206,109 +2054,9 @@
2206 table->field[20]->store((const char*) pos,2054 table->field[20]->store((const char*) pos,
2207 strlen((const char*) pos), cs);2055 strlen((const char*) pos), cs);
2208 }2056 }
2209 if (schema_table_store_record(session, table))2057 store_table->addRow(table->record[0], table->s->reclength);
2210 return(1);2058 }
2211 }2059 return 0;
2212 return(0);
2213}
2214
2215
2216Table *plugin::InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list)
2217 const
2218{
2219 int field_count= 0;
2220 Item *item;
2221 Table *table;
2222 List<Item> field_list;
2223 const CHARSET_INFO * const cs= system_charset_info;
2224 const plugin::InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns();
2225 plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin();
2226
2227 while (iter != columns.end())
2228 {
2229 const plugin::ColumnInfo *column= *iter;
2230 switch (column->getType()) {
2231 case DRIZZLE_TYPE_LONG:
2232 case DRIZZLE_TYPE_LONGLONG:
2233 if (!(item= new Item_return_int(column->getName().c_str(),
2234 column->getLength(),
2235 column->getType(),
2236 column->getValue())))
2237 {
2238 return(0);
2239 }
2240 item->unsigned_flag= (column->getFlags() & MY_I_S_UNSIGNED);
2241 break;
2242 case DRIZZLE_TYPE_DATE:
2243 case DRIZZLE_TYPE_TIMESTAMP:
2244 case DRIZZLE_TYPE_DATETIME:
2245 if (!(item=new Item_return_date_time(column->getName().c_str(),
2246 column->getType())))
2247 {
2248 return(0);
2249 }
2250 break;
2251 case DRIZZLE_TYPE_DOUBLE:
2252 if ((item= new Item_float(column->getName().c_str(), 0.0, NOT_FIXED_DEC,
2253 column->getLength())) == NULL)
2254 return NULL;
2255 break;
2256 case DRIZZLE_TYPE_NEWDECIMAL:
2257 if (!(item= new Item_decimal((int64_t) column->getValue(), false)))
2258 {
2259 return(0);
2260 }
2261 item->unsigned_flag= (column->getFlags() & MY_I_S_UNSIGNED);
2262 item->decimals= column->getLength() % 10;
2263 item->max_length= (column->getLength()/100)%100;
2264 if (item->unsigned_flag == 0)
2265 item->max_length+= 1;
2266 if (item->decimals > 0)
2267 item->max_length+= 1;
2268 item->set_name(column->getName().c_str(),
2269 column->getName().length(), cs);
2270 break;
2271 case DRIZZLE_TYPE_BLOB:
2272 if (!(item= new Item_blob(column->getName().c_str(),
2273 column->getLength())))
2274 {
2275 return(0);
2276 }
2277 break;
2278 default:
2279 if (!(item= new Item_empty_string("", column->getLength(), cs)))
2280 {
2281 return(0);
2282 }
2283 item->set_name(column->getName().c_str(),
2284 column->getName().length(), cs);
2285 break;
2286 }
2287 field_list.push_back(item);
2288 item->maybe_null= (column->getFlags() & MY_I_S_MAYBE_NULL);
2289 field_count++;
2290 ++iter;
2291 }
2292 Tmp_Table_Param *tmp_table_param =
2293 (Tmp_Table_Param*) (session->alloc(sizeof(Tmp_Table_Param)));
2294 tmp_table_param->init();
2295 tmp_table_param->table_charset= cs;
2296 tmp_table_param->field_count= field_count;
2297 tmp_table_param->schema_table= 1;
2298 Select_Lex *select_lex= session->lex->current_select;
2299 if (!(table= create_tmp_table(session, tmp_table_param,
2300 field_list, (order_st*) 0, 0, 0,
2301 (select_lex->options | session->options |
2302 TMP_TABLE_ALL_COLUMNS),
2303 HA_POS_ERROR, table_list->alias)))
2304 return(0);
2305 my_bitmap_map* bitmaps=
2306 (my_bitmap_map*) session->alloc(bitmap_buffer_size(field_count));
2307 table->def_read_set.init((my_bitmap_map*) bitmaps, field_count);
2308 table->read_set= &table->def_read_set;
2309 table->read_set->clearAll();
2310 table_list->schema_table_param= tmp_table_param;
2311 return(table);
2312}2060}
23132061
23142062
@@ -2358,47 +2106,6 @@
23582106
23592107
2360/*2108/*
2361 Create information_schema table
2362
2363 SYNOPSIS
2364 mysql_schema_table()
2365 session thread Cursor
2366 lex pointer to LEX
2367 table_list pointer to table_list
2368
2369 RETURN
2370 true on error
2371*/
2372
2373bool mysql_schema_table(Session *session, LEX *, TableList *table_list)
2374{
2375 Table *table;
2376 if (!(table= table_list->schema_table->createSchemaTable(session, table_list)))
2377 return true;
2378 table->s->tmp_table= SYSTEM_TMP_TABLE;
2379 /*
2380 This test is necessary to make
2381 case insensitive file systems +
2382 upper case table names(information schema tables) +
2383 views
2384 working correctly
2385 */
2386 if (table_list->schema_table_name)
2387 table->alias_name_used= my_strcasecmp(table_alias_charset,
2388 table_list->schema_table_name,
2389 table_list->alias);
2390 table_list->table_name= table->s->table_name.str;
2391 table_list->table_name_length= table->s->table_name.length;
2392 table_list->table= table;
2393 table->next= session->derived_tables;
2394 session->derived_tables= table;
2395 table_list->select_lex->options |= OPTION_SCHEMA_TABLE;
2396
2397 return false;
2398}
2399
2400
2401/*
2402 Generate select from information_schema table2109 Generate select from information_schema table
24032110
2404 SYNOPSIS2111 SYNOPSIS
@@ -2432,91 +2139,3 @@
2432 return false;2139 return false;
2433}2140}
24342141
2435
2436/*
2437 Fill temporary schema tables before SELECT
2438
2439 SYNOPSIS
2440 get_schema_tables_result()
2441 join join which use schema tables
2442 executed_place place where I_S table processed
2443
2444 RETURN
2445 false success
2446 true error
2447*/
2448
2449bool get_schema_tables_result(JOIN *join,
2450 enum enum_schema_table_state executed_place)
2451{
2452 JoinTable *tmp_join_tab= join->join_tab+join->tables;
2453 Session *session= join->session;
2454 LEX *lex= session->lex;
2455 bool result= 0;
2456
2457 session->no_warnings_for_error= 1;
2458 for (JoinTable *tab= join->join_tab; tab < tmp_join_tab; tab++)
2459 {
2460 if (!tab->table || !tab->table->pos_in_table_list)
2461 break;
2462
2463 TableList *table_list= tab->table->pos_in_table_list;
2464 if (table_list->schema_table)
2465 {
2466 bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
2467 lex->current_select->master_unit()->item);
2468
2469
2470 /* skip I_S optimizations specific to get_all_tables */
2471 if (session->lex->describe &&
2472 (table_list->schema_table->isOptimizationPossible() != true))
2473 {
2474 continue;
2475 }
2476
2477 /*
2478 If schema table is already processed and
2479 the statement is not a subselect then
2480 we don't need to fill this table again.
2481 If schema table is already processed and
2482 schema_table_state != executed_place then
2483 table is already processed and
2484 we should skip second data processing.
2485 */
2486 if (table_list->schema_table_state &&
2487 (!is_subselect || table_list->schema_table_state != executed_place))
2488 continue;
2489
2490 /*
2491 if table is used in a subselect and
2492 table has been processed earlier with the same
2493 'executed_place' value then we should refresh the table.
2494 */
2495 if (table_list->schema_table_state && is_subselect)
2496 {
2497 table_list->table->file->extra(HA_EXTRA_NO_CACHE);
2498 table_list->table->file->extra(HA_EXTRA_RESET_STATE);
2499 table_list->table->file->ha_delete_all_rows();
2500 table_list->table->free_io_cache();
2501 table_list->table->filesort_free_buffers(true);
2502 table_list->table->null_row= 0;
2503 }
2504 else
2505 table_list->table->file->stats.records= 0;
2506
2507 if (table_list->schema_table->fillTable(session, table_list,
2508 tab->select_cond))
2509 {
2510 result= 1;
2511 join->error= 1;
2512 tab->read_record.file= table_list->table->file;
2513 table_list->schema_table_state= executed_place;
2514 break;
2515 }
2516 tab->read_record.file= table_list->table->file;
2517 table_list->schema_table_state= executed_place;
2518 }
2519 }
2520 session->no_warnings_for_error= 0;
2521 return(result);
2522}
25232142
=== modified file 'drizzled/show.h'
--- drizzled/show.h 2009-09-29 22:52:00 +0000
+++ drizzled/show.h 2009-10-29 23:56:14 +0000
@@ -70,16 +70,12 @@
7070
71int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg);71int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg);
7272
73bool schema_table_store_record(Session *session, Table *table);
74
75int get_quote_char_for_identifier();73int get_quote_char_for_identifier();
76int wild_case_compare(const CHARSET_INFO * const cs, 74int wild_case_compare(const CHARSET_INFO * const cs,
77 const char *str,const char *wildstr);75 const char *str,const char *wildstr);
7876
79bool make_schema_select(Session *session, Select_Lex *sel,77bool make_schema_select(Session *session, Select_Lex *sel,
80 const std::string& schema_table_name);78 const std::string& schema_table_name);
81bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list);
82bool get_schema_tables_result(JOIN *join, enum enum_schema_table_state executed_place);
8379
84bool mysqld_show_open_tables(Session *session,const char *wild);80bool mysqld_show_open_tables(Session *session,const char *wild);
85bool mysqld_show_logs(Session *session);81bool mysqld_show_logs(Session *session);
8682
=== modified file 'drizzled/sql_base.cc'
--- drizzled/sql_base.cc 2009-10-16 10:27:33 +0000
+++ drizzled/sql_base.cc 2009-10-29 23:56:14 +0000
@@ -2139,18 +2139,6 @@
2139 {2139 {
2140 continue;2140 continue;
2141 }2141 }
2142 /*
2143 If this TableList object is a placeholder for an information_schema
2144 table, create a temporary table to represent the information_schema
2145 table in the query. Do not fill it yet - will be filled during
2146 execution.
2147 */
2148 if (tables->schema_table)
2149 {
2150 if (mysql_schema_table(this, lex, tables) == false)
2151 continue;
2152 return -1;
2153 }
2154 (*counter)++;2142 (*counter)++;
21552143
2156 /*2144 /*
21572145
=== modified file 'drizzled/sql_select.cc'
--- drizzled/sql_select.cc 2009-10-16 10:27:33 +0000
+++ drizzled/sql_select.cc 2009-10-29 23:56:14 +0000
@@ -5294,11 +5294,6 @@
5294 }5294 }
5295 }5295 }
52965296
5297 /* Fill schema tables with data before filesort if it's necessary */
5298 if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
5299 get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX))
5300 goto err;
5301
5302 if (table->s->tmp_table)5297 if (table->s->tmp_table)
5303 table->file->info(HA_STATUS_VARIABLE); // Get record count5298 table->file->info(HA_STATUS_VARIABLE); // Get record count
5304 table->sort.found_records=filesort(session, table,join->sortorder, length,5299 table->sort.found_records=filesort(session, table,join->sortorder, length,
@@ -6935,12 +6930,6 @@
6935 if (table_list->schema_table &&6930 if (table_list->schema_table &&
6936 table_list->schema_table->getRequestedObject() & OPTIMIZE_I_S_TABLE)6931 table_list->schema_table->getRequestedObject() & OPTIMIZE_I_S_TABLE)
6937 {6932 {
6938 if (!table_list->table_open_method)
6939 extra.append(STRING_WITH_LEN("; Skip_open_table"));
6940 else if (table_list->table_open_method == OPEN_FRM_ONLY)
6941 extra.append(STRING_WITH_LEN("; Open_frm_only"));
6942 else
6943 extra.append(STRING_WITH_LEN("; Open_full_table"));
6944 if (table_list->has_db_lookup_value &&6933 if (table_list->has_db_lookup_value &&
6945 table_list->has_table_lookup_value)6934 table_list->has_table_lookup_value)
6946 extra.append(STRING_WITH_LEN("; Scanned 0 databases"));6935 extra.append(STRING_WITH_LEN("; Scanned 0 databases"));
69476936
=== modified file 'drizzled/sql_table.cc'
--- drizzled/sql_table.cc 2009-10-19 19:19:38 +0000
+++ drizzled/sql_table.cc 2009-10-29 23:56:14 +0000
@@ -385,18 +385,12 @@
385{385{
386 bool error, need_start_waiting= false;386 bool error, need_start_waiting= false;
387387
388 if (tables && tables->schema_table)
389 {
390 my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.c_str());
391 return(true);
392 }
393
394 /* mark for close and remove all cached entries */388 /* mark for close and remove all cached entries */
395389
396 if (!drop_temporary)390 if (! drop_temporary)
397 {391 {
398 if (!(need_start_waiting= !wait_if_global_read_lock(session, 0, 1)))392 if (! (need_start_waiting= ! wait_if_global_read_lock(session, 0, 1)))
399 return(true);393 return true;
400 }394 }
401395
402 /*396 /*
@@ -2437,19 +2431,7 @@
2437 pthread_mutex_lock(&LOCK_open); /* We lock for CREATE TABLE LIKE to copy table definition */2431 pthread_mutex_lock(&LOCK_open); /* We lock for CREATE TABLE LIKE to copy table definition */
2438 {2432 {
2439 int protoerr= EEXIST;2433 int protoerr= EEXIST;
24402434 protoerr= plugin::StorageEngine::getTableProto(src_path, &src_proto);
2441 if (src_table->schema_table)
2442 {
2443 if (create_like_schema_frm(session, src_table, create_info, &src_proto))
2444 {
2445 pthread_mutex_unlock(&LOCK_open);
2446 goto err;
2447 }
2448 }
2449 else
2450 {
2451 protoerr= plugin::StorageEngine::getTableProto(src_path, &src_proto);
2452 }
24532435
2454 message::Table new_proto(src_proto);2436 message::Table new_proto(src_proto);
24552437
24562438
=== modified file 'drizzled/table.cc'
--- drizzled/table.cc 2009-10-20 16:11:52 +0000
+++ drizzled/table.cc 2009-10-29 23:56:14 +0000
@@ -283,6 +283,12 @@
283283
284 share->storage_engine= plugin::StorageEngine::findByName(session, table.engine().name());284 share->storage_engine= plugin::StorageEngine::findByName(session, table.engine().name());
285285
286 if (! share->storage_engine)
287 {
288 share->storage_engine= plugin::StorageEngine::findByName(session,
289 table.engine().name());
290 }
291
286 message::Table::TableOptions table_options;292 message::Table::TableOptions table_options;
287293
288 if (table.has_options())294 if (table.has_options())
289295
=== modified file 'drizzled/table_list.h'
--- drizzled/table_list.h 2009-10-20 16:11:52 +0000
+++ drizzled/table_list.h 2009-10-29 23:56:14 +0000
@@ -126,9 +126,8 @@
126 is_alias(false),126 is_alias(false),
127 is_fqtn(false),127 is_fqtn(false),
128 has_db_lookup_value(false),128 has_db_lookup_value(false),
129 has_table_lookup_value(false),129 has_table_lookup_value(false)
130 table_open_method(0)130 {}
131 {}
132131
133 /**132 /**
134 * List of tables local to a subquery (used by SQL_LIST). Considers133 * List of tables local to a subquery (used by SQL_LIST). Considers
@@ -246,7 +245,6 @@
246245
247 bool has_db_lookup_value;246 bool has_db_lookup_value;
248 bool has_table_lookup_value;247 bool has_table_lookup_value;
249 uint32_t table_open_method;
250 enum enum_schema_table_state schema_table_state;248 enum enum_schema_table_state schema_table_state;
251249
252 void set_underlying_merge();250 void set_underlying_merge();
253251
=== modified file 'plugin/archive/ha_archive.cc'
--- plugin/archive/ha_archive.cc 2009-10-19 04:52:19 +0000
+++ plugin/archive/ha_archive.cc 2009-10-29 23:56:14 +0000
@@ -174,11 +174,9 @@
174 dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0));174 dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0));
175 if (dirp == NULL)175 if (dirp == NULL)
176 {176 {
177 if (my_errno == ENOENT)177 if (my_errno != ENOENT)
178 my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str());
179 else
180 my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno);178 my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno);
181 return(ENOENT);179 return ENOENT;
182 }180 }
183 current_entry= -1;181 current_entry= -1;
184 }182 }
185183
=== modified file 'plugin/blackhole/ha_blackhole.cc'
--- plugin/blackhole/ha_blackhole.cc 2009-10-16 01:56:08 +0000
+++ plugin/blackhole/ha_blackhole.cc 2009-10-29 23:56:14 +0000
@@ -46,7 +46,7 @@
46 int createTableImplementation(Session*, const char *, Table *,46 int createTableImplementation(Session*, const char *, Table *,
47 HA_CREATE_INFO *, drizzled::message::Table*);47 HA_CREATE_INFO *, drizzled::message::Table*);
4848
49 int deleteTableImplementation(Session*, const string table_name); 49 int deleteTableImplementation(Session*, const string &table_name);
50};50};
5151
52/* Static declarations for shared structures */52/* Static declarations for shared structures */
@@ -105,7 +105,7 @@
105 return(0);105 return(0);
106}106}
107107
108int BlackholeEngine::deleteTableImplementation(Session*, const string path)108int BlackholeEngine::deleteTableImplementation(Session*, const string &path)
109{109{
110 if (unlink(path.c_str()) != 0)110 if (unlink(path.c_str()) != 0)
111 {111 {
112112
=== modified file 'plugin/heap/ha_heap.cc'
--- plugin/heap/ha_heap.cc 2009-10-16 10:27:33 +0000
+++ plugin/heap/ha_heap.cc 2009-10-29 23:56:14 +0000
@@ -72,14 +72,14 @@
7272
73 int renameTableImplementation(Session*, const char * from, const char * to);73 int renameTableImplementation(Session*, const char * from, const char * to);
7474
75 int deleteTableImplementation(Session *, const string table_path);75 int deleteTableImplementation(Session *, const string &table_path);
76};76};
7777
78/*78/*
79 We have to ignore ENOENT entries as the HEAP table is created on open and79 We have to ignore ENOENT entries as the HEAP table is created on open and
80 not when doing a CREATE on the table.80 not when doing a CREATE on the table.
81*/81*/
82int HeapEngine::deleteTableImplementation(Session*, const string table_path)82int HeapEngine::deleteTableImplementation(Session*, const string &table_path)
83{83{
84 return heap_delete_table(table_path.c_str());84 return heap_delete_table(table_path.c_str());
85}85}
8686
=== modified file 'plugin/info_schema/info_schema_columns.cc'
--- plugin/info_schema/info_schema_columns.cc 2009-09-22 17:56:50 +0000
+++ plugin/info_schema/info_schema_columns.cc 2009-10-29 23:56:14 +0000
@@ -44,8 +44,7 @@
44 DRIZZLE_TYPE_VARCHAR,44 DRIZZLE_TYPE_VARCHAR,
45 0,45 0,
46 0,46 0,
47 "Charset",47 "Charset");
48 SKIP_OPEN_TABLE);
49 if (name_col == NULL)48 if (name_col == NULL)
50 {49 {
51 return true;50 return true;
@@ -56,8 +55,7 @@
56 DRIZZLE_TYPE_VARCHAR,55 DRIZZLE_TYPE_VARCHAR,
57 0,56 0,
58 0,57 0,
59 "Default collation",58 "Default collation");
60 SKIP_OPEN_TABLE);
61 if (collate_col == NULL)59 if (collate_col == NULL)
62 {60 {
63 return true;61 return true;
@@ -68,8 +66,7 @@
68 DRIZZLE_TYPE_VARCHAR,66 DRIZZLE_TYPE_VARCHAR,
69 0,67 0,
70 0,68 0,
71 "Description",69 "Description");
72 SKIP_OPEN_TABLE);
73 if (descrip_col == NULL)70 if (descrip_col == NULL)
74 {71 {
75 return true;72 return true;
@@ -80,8 +77,7 @@
80 DRIZZLE_TYPE_LONGLONG,77 DRIZZLE_TYPE_LONGLONG,
81 0,78 0,
82 0,79 0,
83 "Maxlen",80 "Maxlen");
84 SKIP_OPEN_TABLE);
85 if (len_col == NULL)81 if (len_col == NULL)
86 {82 {
87 return true;83 return true;
@@ -108,8 +104,7 @@
108 DRIZZLE_TYPE_VARCHAR,104 DRIZZLE_TYPE_VARCHAR,
109 0,105 0,
110 0,106 0,
111 "Collation",107 "Collation");
112 SKIP_OPEN_TABLE);
113 if (name_col == NULL)108 if (name_col == NULL)
114 {109 {
115 return true;110 return true;
@@ -120,8 +115,7 @@
120 DRIZZLE_TYPE_VARCHAR,115 DRIZZLE_TYPE_VARCHAR,
121 0,116 0,
122 0,117 0,
123 "Default collation",118 "Default collation");
124 SKIP_OPEN_TABLE);
125 if (char_set_col == NULL)119 if (char_set_col == NULL)
126 {120 {
127 return true;121 return true;
@@ -132,8 +126,7 @@
132 DRIZZLE_TYPE_VARCHAR,126 DRIZZLE_TYPE_VARCHAR,
133 0,127 0,
134 0,128 0,
135 "Charset",129 "Charset");
136 SKIP_OPEN_TABLE);
137 if (descrip_col == NULL)130 if (descrip_col == NULL)
138 {131 {
139 return true;132 return true;
@@ -144,8 +137,7 @@
144 DRIZZLE_TYPE_LONGLONG,137 DRIZZLE_TYPE_LONGLONG,
145 0,138 0,
146 0,139 0,
147 "Id",140 "Id");
148 SKIP_OPEN_TABLE);
149 if (id_col == NULL)141 if (id_col == NULL)
150 {142 {
151 return true;143 return true;
@@ -156,8 +148,7 @@
156 DRIZZLE_TYPE_VARCHAR,148 DRIZZLE_TYPE_VARCHAR,
157 0,149 0,
158 0,150 0,
159 "Default",151 "Default");
160 SKIP_OPEN_TABLE);
161 if (default_col == NULL)152 if (default_col == NULL)
162 {153 {
163 return true;154 return true;
@@ -168,8 +159,7 @@
168 DRIZZLE_TYPE_VARCHAR,159 DRIZZLE_TYPE_VARCHAR,
169 0,160 0,
170 0,161 0,
171 "Compiled",162 "Compiled");
172 SKIP_OPEN_TABLE);
173 if (compiled_col == NULL)163 if (compiled_col == NULL)
174 {164 {
175 return true;165 return true;
@@ -180,8 +170,7 @@
180 DRIZZLE_TYPE_LONGLONG,170 DRIZZLE_TYPE_LONGLONG,
181 0,171 0,
182 0,172 0,
183 "Sortlen",173 "Sortlen");
184 SKIP_OPEN_TABLE);
185 if (sortlen_col == NULL)174 if (sortlen_col == NULL)
186 {175 {
187 return true;176 return true;
@@ -211,8 +200,7 @@
211 DRIZZLE_TYPE_VARCHAR,200 DRIZZLE_TYPE_VARCHAR,
212 0,201 0,
213 0,202 0,
214 "",203 "");
215 SKIP_OPEN_TABLE);
216 if (name_col == NULL)204 if (name_col == NULL)
217 {205 {
218 return true;206 return true;
@@ -223,8 +211,7 @@
223 DRIZZLE_TYPE_VARCHAR,211 DRIZZLE_TYPE_VARCHAR,
224 0,212 0,
225 0,213 0,
226 "",214 "");
227 SKIP_OPEN_TABLE);
228 if (char_set_col == NULL)215 if (char_set_col == NULL)
229 {216 {
230 return true;217 return true;
@@ -249,8 +236,7 @@
249 DRIZZLE_TYPE_VARCHAR,236 DRIZZLE_TYPE_VARCHAR,
250 0,237 0,
251 1,238 1,
252 "",239 "");
253 OPEN_FRM_ONLY);
254 if (tab_cat == NULL)240 if (tab_cat == NULL)
255 {241 {
256 return true;242 return true;
@@ -261,8 +247,7 @@
261 DRIZZLE_TYPE_VARCHAR,247 DRIZZLE_TYPE_VARCHAR,
262 0,248 0,
263 0,249 0,
264 "",250 "");
265 OPEN_FRM_ONLY);
266 if (tab_sch == NULL)251 if (tab_sch == NULL)
267 {252 {
268 return true;253 return true;
@@ -273,8 +258,7 @@
273 DRIZZLE_TYPE_VARCHAR,258 DRIZZLE_TYPE_VARCHAR,
274 0,259 0,
275 0,260 0,
276 "",261 "");
277 OPEN_FRM_ONLY);
278 if (tab_name == NULL)262 if (tab_name == NULL)
279 {263 {
280 return true;264 return true;
@@ -285,8 +269,7 @@
285 DRIZZLE_TYPE_VARCHAR,269 DRIZZLE_TYPE_VARCHAR,
286 0,270 0,
287 0,271 0,
288 "Field",272 "Field");
289 OPEN_FRM_ONLY);
290 if (col_name == NULL)273 if (col_name == NULL)
291 {274 {
292 return true;275 return true;
@@ -297,20 +280,19 @@
297 DRIZZLE_TYPE_LONGLONG,280 DRIZZLE_TYPE_LONGLONG,
298 0,281 0,
299 MY_I_S_UNSIGNED,282 MY_I_S_UNSIGNED,
300 "",283 "");
301 OPEN_FRM_ONLY);
302 if (ord_pos == NULL)284 if (ord_pos == NULL)
303 {285 {
304 return true;286 return true;
305 }287 }
306288
307 const drizzled::plugin::ColumnInfo *col_def= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_DEFAULT",289 const drizzled::plugin::ColumnInfo *col_def= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_DEFAULT",
308 MAX_FIELD_VARCHARLENGTH,290 64,
291 //MAX_FIELD_VARCHARLENGTH,
309 DRIZZLE_TYPE_VARCHAR,292 DRIZZLE_TYPE_VARCHAR,
310 0,293 0,
311 1,294 1,
312 "Default",295 "Default");
313 OPEN_FRM_ONLY);
314 if (col_def == NULL)296 if (col_def == NULL)
315 {297 {
316 return true;298 return true;
@@ -321,8 +303,7 @@
321 DRIZZLE_TYPE_VARCHAR,303 DRIZZLE_TYPE_VARCHAR,
322 0,304 0,
323 0,305 0,
324 "Null",306 "Null");
325 OPEN_FRM_ONLY);
326 if (is_nullable == NULL)307 if (is_nullable == NULL)
327 {308 {
328 return true;309 return true;
@@ -333,8 +314,7 @@
333 DRIZZLE_TYPE_VARCHAR,314 DRIZZLE_TYPE_VARCHAR,
334 0,315 0,
335 0,316 0,
336 "",317 "");
337 OPEN_FRM_ONLY);
338 if (data_type == NULL)318 if (data_type == NULL)
339 {319 {
340 return true;320 return true;
@@ -345,8 +325,7 @@
345 DRIZZLE_TYPE_LONGLONG,325 DRIZZLE_TYPE_LONGLONG,
346 0,326 0,
347 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),327 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
348 "",328 "");
349 OPEN_FRM_ONLY);
350 if (max_len == NULL)329 if (max_len == NULL)
351 {330 {
352 return true;331 return true;
@@ -357,8 +336,7 @@
357 DRIZZLE_TYPE_LONGLONG,336 DRIZZLE_TYPE_LONGLONG,
358 0,337 0,
359 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),338 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
360 "",339 "");
361 OPEN_FRM_ONLY);
362 if (octet_len == NULL)340 if (octet_len == NULL)
363 {341 {
364 return true;342 return true;
@@ -369,8 +347,7 @@
369 DRIZZLE_TYPE_LONGLONG,347 DRIZZLE_TYPE_LONGLONG,
370 0,348 0,
371 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),349 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
372 "",350 "");
373 OPEN_FRM_ONLY);
374 if (num_prec == NULL)351 if (num_prec == NULL)
375 {352 {
376 return true;353 return true;
@@ -381,8 +358,7 @@
381 DRIZZLE_TYPE_LONGLONG,358 DRIZZLE_TYPE_LONGLONG,
382 0,359 0,
383 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),360 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
384 "",361 "");
385 OPEN_FRM_ONLY);
386 if (num_scale == NULL)362 if (num_scale == NULL)
387 {363 {
388 return true;364 return true;
@@ -393,8 +369,7 @@
393 DRIZZLE_TYPE_VARCHAR,369 DRIZZLE_TYPE_VARCHAR,
394 0,370 0,
395 1,371 1,
396 "",372 "");
397 OPEN_FRM_ONLY);
398 if (char_set_name == NULL)373 if (char_set_name == NULL)
399 {374 {
400 return true;375 return true;
@@ -405,20 +380,19 @@
405 DRIZZLE_TYPE_VARCHAR,380 DRIZZLE_TYPE_VARCHAR,
406 0,381 0,
407 1,382 1,
408 "Collation",383 "Collation");
409 OPEN_FRM_ONLY);
410 if (coll_name == NULL)384 if (coll_name == NULL)
411 {385 {
412 return true;386 return true;
413 }387 }
414388
415 const drizzled::plugin::ColumnInfo *col_type= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_TYPE",389 const drizzled::plugin::ColumnInfo *col_type= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_TYPE",
416 65535,390 64,
391 //65535,
417 DRIZZLE_TYPE_VARCHAR,392 DRIZZLE_TYPE_VARCHAR,
418 0,393 0,
419 0,394 0,
420 "Type",395 "Type");
421 OPEN_FRM_ONLY);
422 if (col_type == NULL)396 if (col_type == NULL)
423 {397 {
424 return true;398 return true;
@@ -429,8 +403,7 @@
429 DRIZZLE_TYPE_VARCHAR,403 DRIZZLE_TYPE_VARCHAR,
430 0,404 0,
431 0,405 0,
432 "Key",406 "Key");
433 OPEN_FRM_ONLY);
434 if (col_key == NULL)407 if (col_key == NULL)
435 {408 {
436 return true;409 return true;
@@ -441,8 +414,7 @@
441 DRIZZLE_TYPE_VARCHAR,414 DRIZZLE_TYPE_VARCHAR,
442 0,415 0,
443 0,416 0,
444 "Extra",417 "Extra");
445 OPEN_FRM_ONLY);
446 if (extra == NULL)418 if (extra == NULL)
447 {419 {
448 return true;420 return true;
@@ -453,8 +425,7 @@
453 DRIZZLE_TYPE_VARCHAR,425 DRIZZLE_TYPE_VARCHAR,
454 0,426 0,
455 0,427 0,
456 "Privileges",428 "Privileges");
457 OPEN_FRM_ONLY);
458 if (priv == NULL)429 if (priv == NULL)
459 {430 {
460 return true;431 return true;
@@ -465,8 +436,7 @@
465 DRIZZLE_TYPE_VARCHAR,436 DRIZZLE_TYPE_VARCHAR,
466 0,437 0,
467 0,438 0,
468 "Comment",439 "Comment");
469 OPEN_FRM_ONLY);
470 if (col_comment == NULL)440 if (col_comment == NULL)
471 {441 {
472 return true;442 return true;
@@ -477,8 +447,7 @@
477 DRIZZLE_TYPE_VARCHAR,447 DRIZZLE_TYPE_VARCHAR,
478 0,448 0,
479 0,449 0,
480 "Storage",450 "Storage");
481 OPEN_FRM_ONLY);
482 if (storage == NULL)451 if (storage == NULL)
483 {452 {
484 return true;453 return true;
@@ -489,8 +458,7 @@
489 DRIZZLE_TYPE_VARCHAR,458 DRIZZLE_TYPE_VARCHAR,
490 0,459 0,
491 0,460 0,
492 "Format",461 "Format");
493 OPEN_FRM_ONLY);
494 if (format == NULL)462 if (format == NULL)
495 {463 {
496 return true;464 return true;
@@ -531,8 +499,7 @@
531 DRIZZLE_TYPE_VARCHAR,499 DRIZZLE_TYPE_VARCHAR,
532 0,500 0,
533 1,501 1,
534 "",502 "");
535 OPEN_FULL_TABLE);
536 if (cat == NULL)503 if (cat == NULL)
537 {504 {
538 return true;505 return true;
@@ -543,8 +510,7 @@
543 DRIZZLE_TYPE_VARCHAR,510 DRIZZLE_TYPE_VARCHAR,
544 0,511 0,
545 0,512 0,
546 "",513 "");
547 OPEN_FULL_TABLE);
548 if (sch == NULL)514 if (sch == NULL)
549 {515 {
550 return true;516 return true;
@@ -555,8 +521,7 @@
555 DRIZZLE_TYPE_VARCHAR,521 DRIZZLE_TYPE_VARCHAR,
556 0,522 0,
557 0,523 0,
558 "",524 "");
559 OPEN_FULL_TABLE);
560 if (name == NULL)525 if (name == NULL)
561 {526 {
562 return true;527 return true;
@@ -567,8 +532,7 @@
567 DRIZZLE_TYPE_VARCHAR,532 DRIZZLE_TYPE_VARCHAR,
568 0,533 0,
569 1,534 1,
570 "",535 "");
571 OPEN_FULL_TABLE);
572 if (tab_cat == NULL)536 if (tab_cat == NULL)
573 {537 {
574 return true;538 return true;
@@ -579,8 +543,7 @@
579 DRIZZLE_TYPE_VARCHAR,543 DRIZZLE_TYPE_VARCHAR,
580 0,544 0,
581 0,545 0,
582 "",546 "");
583 OPEN_FULL_TABLE);
584 if (tab_sch == NULL)547 if (tab_sch == NULL)
585 {548 {
586 return true;549 return true;
@@ -591,8 +554,7 @@
591 DRIZZLE_TYPE_VARCHAR,554 DRIZZLE_TYPE_VARCHAR,
592 0,555 0,
593 0,556 0,
594 "",557 "");
595 OPEN_FULL_TABLE);
596 if (tab_name == NULL)558 if (tab_name == NULL)
597 {559 {
598 return true;560 return true;
@@ -603,8 +565,7 @@
603 DRIZZLE_TYPE_VARCHAR,565 DRIZZLE_TYPE_VARCHAR,
604 0,566 0,
605 0,567 0,
606 "",568 "");
607 OPEN_FULL_TABLE);
608 if (col_name == NULL)569 if (col_name == NULL)
609 {570 {
610 return true;571 return true;
@@ -614,8 +575,7 @@
614 DRIZZLE_TYPE_LONGLONG,575 DRIZZLE_TYPE_LONGLONG,
615 0,576 0,
616 0,577 0,
617 "",578 "");
618 OPEN_FULL_TABLE);
619 if (ord_pos == NULL)579 if (ord_pos == NULL)
620 {580 {
621 return true;581 return true;
@@ -626,8 +586,7 @@
626 DRIZZLE_TYPE_LONGLONG,586 DRIZZLE_TYPE_LONGLONG,
627 0,587 0,
628 1,588 1,
629 "",589 "");
630 OPEN_FULL_TABLE);
631 if (pos_in_uniq == NULL)590 if (pos_in_uniq == NULL)
632 {591 {
633 return true;592 return true;
@@ -638,8 +597,7 @@
638 DRIZZLE_TYPE_VARCHAR,597 DRIZZLE_TYPE_VARCHAR,
639 0,598 0,
640 1,599 1,
641 "",600 "");
642 OPEN_FULL_TABLE);
643 if (ref_tab_sch == NULL)601 if (ref_tab_sch == NULL)
644 {602 {
645 return true;603 return true;
@@ -650,8 +608,7 @@
650 DRIZZLE_TYPE_VARCHAR,608 DRIZZLE_TYPE_VARCHAR,
651 0,609 0,
652 1,610 1,
653 "",611 "");
654 OPEN_FULL_TABLE);
655 if (ref_tab_name == NULL)612 if (ref_tab_name == NULL)
656 {613 {
657 return true;614 return true;
@@ -662,8 +619,7 @@
662 DRIZZLE_TYPE_VARCHAR,619 DRIZZLE_TYPE_VARCHAR,
663 0,620 0,
664 1,621 1,
665 "",622 "");
666 OPEN_FULL_TABLE);
667 if (ref_col_name == NULL)623 if (ref_col_name == NULL)
668 {624 {
669 return true;625 return true;
@@ -692,8 +648,7 @@
692 DRIZZLE_TYPE_VARCHAR,648 DRIZZLE_TYPE_VARCHAR,
693 0,649 0,
694 0,650 0,
695 "Database",651 "Database");
696 SKIP_OPEN_TABLE);
697 if (db == NULL)652 if (db == NULL)
698 {653 {
699 return true;654 return true;
@@ -704,8 +659,7 @@
704 DRIZZLE_TYPE_VARCHAR,659 DRIZZLE_TYPE_VARCHAR,
705 0,660 0,
706 0,661 0,
707 "Table",662 "Table");
708 SKIP_OPEN_TABLE);
709 if (tab == NULL)663 if (tab == NULL)
710 {664 {
711 return true;665 return true;
@@ -716,8 +670,7 @@
716 DRIZZLE_TYPE_LONGLONG,670 DRIZZLE_TYPE_LONGLONG,
717 0,671 0,
718 0,672 0,
719 "In_use",673 "In_use");
720 SKIP_OPEN_TABLE);
721 if (in_use == NULL)674 if (in_use == NULL)
722 {675 {
723 return true;676 return true;
@@ -728,8 +681,7 @@
728 DRIZZLE_TYPE_LONGLONG,681 DRIZZLE_TYPE_LONGLONG,
729 0,682 0,
730 0,683 0,
731 "Name_locked",684 "Name_locked");
732 SKIP_OPEN_TABLE);
733 if (name_locked == NULL)685 if (name_locked == NULL)
734 {686 {
735 return true;687 return true;
@@ -750,8 +702,7 @@
750 DRIZZLE_TYPE_VARCHAR,702 DRIZZLE_TYPE_VARCHAR,
751 0,703 0,
752 0,704 0,
753 "Name",705 "Name");
754 SKIP_OPEN_TABLE);
755 if (name == NULL)706 if (name == NULL)
756 {707 {
757 return true;708 return true;
@@ -762,8 +713,7 @@
762 DRIZZLE_TYPE_VARCHAR,713 DRIZZLE_TYPE_VARCHAR,
763 0,714 0,
764 0,715 0,
765 "",716 "");
766 SKIP_OPEN_TABLE);
767 if (ver == NULL)717 if (ver == NULL)
768 {718 {
769 return true;719 return true;
@@ -774,8 +724,7 @@
774 DRIZZLE_TYPE_VARCHAR,724 DRIZZLE_TYPE_VARCHAR,
775 0,725 0,
776 0,726 0,
777 "Status",727 "Status");
778 SKIP_OPEN_TABLE);
779 if (stat == NULL)728 if (stat == NULL)
780 {729 {
781 return true;730 return true;
@@ -786,20 +735,19 @@
786 DRIZZLE_TYPE_VARCHAR,735 DRIZZLE_TYPE_VARCHAR,
787 0,736 0,
788 1,737 1,
789 "",738 "");
790 SKIP_OPEN_TABLE);
791 if (aut == NULL)739 if (aut == NULL)
792 {740 {
793 return true;741 return true;
794 }742 }
795743
796 const drizzled::plugin::ColumnInfo *descrip= new(std::nothrow) drizzled::plugin::ColumnInfo("PLUGIN_DESCRIPTION",744 const drizzled::plugin::ColumnInfo *descrip= new(std::nothrow) drizzled::plugin::ColumnInfo("PLUGIN_DESCRIPTION",
797 65535,745 64,
746 //65535,
798 DRIZZLE_TYPE_VARCHAR,747 DRIZZLE_TYPE_VARCHAR,
799 0,748 0,
800 1,749 1,
801 "",750 "");
802 SKIP_OPEN_TABLE);
803 if (descrip == NULL)751 if (descrip == NULL)
804 {752 {
805 return true;753 return true;
@@ -810,8 +758,7 @@
810 DRIZZLE_TYPE_VARCHAR,758 DRIZZLE_TYPE_VARCHAR,
811 0,759 0,
812 1,760 1,
813 "License",761 "License");
814 SKIP_OPEN_TABLE);
815 if (lic == NULL)762 if (lic == NULL)
816 {763 {
817 return true;764 return true;
@@ -837,8 +784,7 @@
837 DRIZZLE_TYPE_LONGLONG,784 DRIZZLE_TYPE_LONGLONG,
838 0,785 0,
839 0,786 0,
840 "Id",787 "Id");
841 SKIP_OPEN_TABLE);
842 if (id_col == NULL)788 if (id_col == NULL)
843 {789 {
844 return true;790 return true;
@@ -849,8 +795,7 @@
849 DRIZZLE_TYPE_VARCHAR,795 DRIZZLE_TYPE_VARCHAR,
850 0,796 0,
851 0,797 0,
852 "User",798 "User");
853 SKIP_OPEN_TABLE);
854 if (user_col == NULL)799 if (user_col == NULL)
855 {800 {
856 return true;801 return true;
@@ -861,8 +806,7 @@
861 DRIZZLE_TYPE_VARCHAR,806 DRIZZLE_TYPE_VARCHAR,
862 0,807 0,
863 0,808 0,
864 "Host",809 "Host");
865 SKIP_OPEN_TABLE);
866 if (host_col == NULL)810 if (host_col == NULL)
867 {811 {
868 return true;812 return true;
@@ -873,8 +817,7 @@
873 DRIZZLE_TYPE_VARCHAR,817 DRIZZLE_TYPE_VARCHAR,
874 0,818 0,
875 1,819 1,
876 "Db",820 "Db");
877 SKIP_OPEN_TABLE);
878 if (db_col == NULL)821 if (db_col == NULL)
879 {822 {
880 return true;823 return true;
@@ -885,8 +828,7 @@
885 DRIZZLE_TYPE_VARCHAR,828 DRIZZLE_TYPE_VARCHAR,
886 0,829 0,
887 0,830 0,
888 "Command",831 "Command");
889 SKIP_OPEN_TABLE);
890 if (command_col == NULL)832 if (command_col == NULL)
891 {833 {
892 return true;834 return true;
@@ -897,8 +839,7 @@
897 DRIZZLE_TYPE_LONGLONG,839 DRIZZLE_TYPE_LONGLONG,
898 0,840 0,
899 0,841 0,
900 "Time",842 "Time");
901 SKIP_OPEN_TABLE);
902 if (time_col == NULL)843 if (time_col == NULL)
903 {844 {
904 return true;845 return true;
@@ -909,8 +850,7 @@
909 DRIZZLE_TYPE_VARCHAR,850 DRIZZLE_TYPE_VARCHAR,
910 0,851 0,
911 1,852 1,
912 "State",853 "State");
913 SKIP_OPEN_TABLE);
914 if (state_col == NULL)854 if (state_col == NULL)
915 {855 {
916 return true;856 return true;
@@ -921,8 +861,7 @@
921 DRIZZLE_TYPE_VARCHAR,861 DRIZZLE_TYPE_VARCHAR,
922 0,862 0,
923 1,863 1,
924 "Info",864 "Info");
925 SKIP_OPEN_TABLE);
926 if (info_col == NULL)865 if (info_col == NULL)
927 {866 {
928 return true;867 return true;
@@ -953,8 +892,7 @@
953 DRIZZLE_TYPE_VARCHAR,892 DRIZZLE_TYPE_VARCHAR,
954 0,893 0,
955 1,894 1,
956 "",895 "");
957 OPEN_FULL_TABLE);
958896
959 if (cat == NULL)897 if (cat == NULL)
960 {898 {
@@ -966,8 +904,7 @@
966 DRIZZLE_TYPE_VARCHAR,904 DRIZZLE_TYPE_VARCHAR,
967 0,905 0,
968 0,906 0,
969 "",907 "");
970 OPEN_FULL_TABLE);
971 if (sch == NULL)908 if (sch == NULL)
972 {909 {
973 return true;910 return true;
@@ -978,8 +915,7 @@
978 DRIZZLE_TYPE_VARCHAR,915 DRIZZLE_TYPE_VARCHAR,
979 0,916 0,
980 0,917 0,
981 "",918 "");
982 OPEN_FULL_TABLE);
983 if (name == NULL)919 if (name == NULL)
984 {920 {
985 return true;921 return true;
@@ -990,8 +926,7 @@
990 DRIZZLE_TYPE_VARCHAR,926 DRIZZLE_TYPE_VARCHAR,
991 0,927 0,
992 1,928 1,
993 "",929 "");
994 OPEN_FULL_TABLE);
995 if (uniq_cat == NULL)930 if (uniq_cat == NULL)
996 {931 {
997 return true;932 return true;
@@ -1002,8 +937,7 @@
1002 DRIZZLE_TYPE_VARCHAR,937 DRIZZLE_TYPE_VARCHAR,
1003 0,938 0,
1004 0,939 0,
1005 "",940 "");
1006 OPEN_FULL_TABLE);
1007 if (uniq_sch == NULL)941 if (uniq_sch == NULL)
1008 {942 {
1009 return true;943 return true;
@@ -1014,8 +948,7 @@
1014 DRIZZLE_TYPE_VARCHAR,948 DRIZZLE_TYPE_VARCHAR,
1015 0,949 0,
1016 MY_I_S_MAYBE_NULL,950 MY_I_S_MAYBE_NULL,
1017 "",951 "");
1018 OPEN_FULL_TABLE);
1019 if (uniq_name == NULL)952 if (uniq_name == NULL)
1020 {953 {
1021 return true;954 return true;
@@ -1026,8 +959,7 @@
1026 DRIZZLE_TYPE_VARCHAR,959 DRIZZLE_TYPE_VARCHAR,
1027 0,960 0,
1028 0,961 0,
1029 "",962 "");
1030 OPEN_FULL_TABLE);
1031 if (match == NULL)963 if (match == NULL)
1032 {964 {
1033 return true;965 return true;
@@ -1038,8 +970,7 @@
1038 DRIZZLE_TYPE_VARCHAR,970 DRIZZLE_TYPE_VARCHAR,
1039 0,971 0,
1040 0,972 0,
1041 "",973 "");
1042 OPEN_FULL_TABLE);
1043 if (update == NULL)974 if (update == NULL)
1044 {975 {
1045 return true;976 return true;
@@ -1050,8 +981,7 @@
1050 DRIZZLE_TYPE_VARCHAR,981 DRIZZLE_TYPE_VARCHAR,
1051 0,982 0,
1052 0,983 0,
1053 "",984 "");
1054 OPEN_FULL_TABLE);
1055 if (del_rule == NULL)985 if (del_rule == NULL)
1056 {986 {
1057 return true;987 return true;
@@ -1062,8 +992,7 @@
1062 DRIZZLE_TYPE_VARCHAR,992 DRIZZLE_TYPE_VARCHAR,
1063 0,993 0,
1064 0,994 0,
1065 "",995 "");
1066 OPEN_FULL_TABLE);
1067 if (tab_name == NULL)996 if (tab_name == NULL)
1068 {997 {
1069 return true;998 return true;
@@ -1074,8 +1003,7 @@
1074 DRIZZLE_TYPE_VARCHAR,1003 DRIZZLE_TYPE_VARCHAR,
1075 0,1004 0,
1076 0,1005 0,
1077 "",1006 "");
1078 OPEN_FULL_TABLE);
1079 if (ref_name == NULL)1007 if (ref_name == NULL)
1080 {1008 {
1081 return true;1009 return true;
@@ -1106,8 +1034,7 @@
1106 DRIZZLE_TYPE_VARCHAR,1034 DRIZZLE_TYPE_VARCHAR,
1107 0, 1035 0,
1108 1, 1036 1,
1109 "", 1037 "");
1110 SKIP_OPEN_TABLE);
1111 if (cat_name == NULL)1038 if (cat_name == NULL)
1112 {1039 {
1113 return true;1040 return true;
@@ -1118,8 +1045,7 @@
1118 DRIZZLE_TYPE_VARCHAR,1045 DRIZZLE_TYPE_VARCHAR,
1119 0, 1046 0,
1120 0, 1047 0,
1121 "Database", 1048 "Database");
1122 SKIP_OPEN_TABLE);
1123 if (sch_name == NULL)1049 if (sch_name == NULL)
1124 {1050 {
1125 return true;1051 return true;
@@ -1130,8 +1056,7 @@
1130 DRIZZLE_TYPE_VARCHAR, 1056 DRIZZLE_TYPE_VARCHAR,
1131 0, 1057 0,
1132 0, 1058 0,
1133 "",1059 "");
1134 SKIP_OPEN_TABLE);
1135 if (cs_name == NULL)1060 if (cs_name == NULL)
1136 {1061 {
1137 return true;1062 return true;
@@ -1142,8 +1067,7 @@
1142 DRIZZLE_TYPE_VARCHAR, 1067 DRIZZLE_TYPE_VARCHAR,
1143 0, 1068 0,
1144 0, 1069 0,
1145 "",1070 "");
1146 SKIP_OPEN_TABLE);
1147 if (coll_name == NULL)1071 if (coll_name == NULL)
1148 {1072 {
1149 return true;1073 return true;
@@ -1154,8 +1078,7 @@
1154 DRIZZLE_TYPE_VARCHAR,1078 DRIZZLE_TYPE_VARCHAR,
1155 0, 1079 0,
1156 1, 1080 1,
1157 "", 1081 "");
1158 SKIP_OPEN_TABLE);
1159 if (sql_path == NULL)1082 if (sql_path == NULL)
1160 {1083 {
1161 return true;1084 return true;
@@ -1177,8 +1100,7 @@
1177 DRIZZLE_TYPE_VARCHAR,1100 DRIZZLE_TYPE_VARCHAR,
1178 0,1101 0,
1179 1,1102 1,
1180 "",1103 "");
1181 OPEN_FRM_ONLY);
1182 if (cat == NULL)1104 if (cat == NULL)
1183 {1105 {
1184 return true;1106 return true;
@@ -1189,8 +1111,7 @@
1189 DRIZZLE_TYPE_VARCHAR,1111 DRIZZLE_TYPE_VARCHAR,
1190 0,1112 0,
1191 0,1113 0,
1192 "",1114 "");
1193 OPEN_FRM_ONLY);
1194 if (sch == NULL)1115 if (sch == NULL)
1195 {1116 {
1196 return true;1117 return true;
@@ -1201,8 +1122,7 @@
1201 DRIZZLE_TYPE_VARCHAR,1122 DRIZZLE_TYPE_VARCHAR,
1202 0,1123 0,
1203 0,1124 0,
1204 "Table",1125 "Table");
1205 OPEN_FRM_ONLY);
1206 if (name == NULL)1126 if (name == NULL)
1207 {1127 {
1208 return true;1128 return true;
@@ -1213,8 +1133,7 @@
1213 DRIZZLE_TYPE_LONGLONG,1133 DRIZZLE_TYPE_LONGLONG,
1214 0,1134 0,
1215 0,1135 0,
1216 "Non_unique",1136 "Non_unique");
1217 OPEN_FRM_ONLY);
1218 if (uniq == NULL)1137 if (uniq == NULL)
1219 {1138 {
1220 return true;1139 return true;
@@ -1225,8 +1144,7 @@
1225 DRIZZLE_TYPE_VARCHAR,1144 DRIZZLE_TYPE_VARCHAR,
1226 0,1145 0,
1227 0,1146 0,
1228 "",1147 "");
1229 OPEN_FRM_ONLY);
1230 if (idx_sch == NULL)1148 if (idx_sch == NULL)
1231 {1149 {
1232 return true;1150 return true;
@@ -1237,8 +1155,7 @@
1237 DRIZZLE_TYPE_VARCHAR,1155 DRIZZLE_TYPE_VARCHAR,
1238 0,1156 0,
1239 0,1157 0,
1240 "Key_name",1158 "Key_name");
1241 OPEN_FRM_ONLY);
1242 if (idx_name == NULL)1159 if (idx_name == NULL)
1243 {1160 {
1244 return true;1161 return true;
@@ -1249,8 +1166,7 @@
1249 DRIZZLE_TYPE_LONGLONG,1166 DRIZZLE_TYPE_LONGLONG,
1250 0,1167 0,
1251 0,1168 0,
1252 "Seq_in_index",1169 "Seq_in_index");
1253 OPEN_FRM_ONLY);
1254 if (seq_in_idx == NULL)1170 if (seq_in_idx == NULL)
1255 {1171 {
1256 return true;1172 return true;
@@ -1261,8 +1177,7 @@
1261 DRIZZLE_TYPE_VARCHAR,1177 DRIZZLE_TYPE_VARCHAR,
1262 0,1178 0,
1263 0,1179 0,
1264 "Column_name",1180 "Column_name");
1265 OPEN_FRM_ONLY);
1266 if (col_name == NULL)1181 if (col_name == NULL)
1267 {1182 {
1268 return true;1183 return true;
@@ -1273,8 +1188,7 @@
1273 DRIZZLE_TYPE_VARCHAR,1188 DRIZZLE_TYPE_VARCHAR,
1274 0,1189 0,
1275 1,1190 1,
1276 "Collation",1191 "Collation");
1277 OPEN_FRM_ONLY);
1278 if (coll == NULL)1192 if (coll == NULL)
1279 {1193 {
1280 return true;1194 return true;
@@ -1285,8 +1199,7 @@
1285 DRIZZLE_TYPE_LONGLONG,1199 DRIZZLE_TYPE_LONGLONG,
1286 0,1200 0,
1287 1,1201 1,
1288 "Cardinality",1202 "Cardinality");
1289 OPEN_FULL_TABLE);
1290 if (card == NULL)1203 if (card == NULL)
1291 {1204 {
1292 return true;1205 return true;
@@ -1297,8 +1210,7 @@
1297 DRIZZLE_TYPE_LONGLONG,1210 DRIZZLE_TYPE_LONGLONG,
1298 0,1211 0,
1299 1,1212 1,
1300 "Sub_part",1213 "Sub_part");
1301 OPEN_FRM_ONLY);
1302 if (sub_part == NULL)1214 if (sub_part == NULL)
1303 {1215 {
1304 return true;1216 return true;
@@ -1309,8 +1221,7 @@
1309 DRIZZLE_TYPE_VARCHAR,1221 DRIZZLE_TYPE_VARCHAR,
1310 0,1222 0,
1311 1,1223 1,
1312 "Packed",1224 "Packed");
1313 OPEN_FRM_ONLY);
1314 if (packed == NULL)1225 if (packed == NULL)
1315 {1226 {
1316 return true;1227 return true;
@@ -1321,8 +1232,7 @@
1321 DRIZZLE_TYPE_VARCHAR,1232 DRIZZLE_TYPE_VARCHAR,
1322 0,1233 0,
1323 0,1234 0,
1324 "Null",1235 "Null");
1325 OPEN_FRM_ONLY);
1326 if (nullable == NULL)1236 if (nullable == NULL)
1327 {1237 {
1328 return true;1238 return true;
@@ -1333,8 +1243,7 @@
1333 DRIZZLE_TYPE_VARCHAR,1243 DRIZZLE_TYPE_VARCHAR,
1334 0,1244 0,
1335 0,1245 0,
1336 "Index_type",1246 "Index_type");
1337 OPEN_FULL_TABLE);
1338 if (idx_type == NULL)1247 if (idx_type == NULL)
1339 {1248 {
1340 return true;1249 return true;
@@ -1345,8 +1254,7 @@
1345 DRIZZLE_TYPE_VARCHAR,1254 DRIZZLE_TYPE_VARCHAR,
1346 0,1255 0,
1347 1,1256 1,
1348 "Comment",1257 "Comment");
1349 OPEN_FRM_ONLY);
1350 if (comment == NULL)1258 if (comment == NULL)
1351 {1259 {
1352 return true;1260 return true;
@@ -1357,8 +1265,7 @@
1357 DRIZZLE_TYPE_VARCHAR,1265 DRIZZLE_TYPE_VARCHAR,
1358 0,1266 0,
1359 0,1267 0,
1360 "Index_Comment",1268 "Index_Comment");
1361 OPEN_FRM_ONLY);
1362 if (idx_comment == NULL)1269 if (idx_comment == NULL)
1363 {1270 {
1364 return true;1271 return true;
@@ -1391,8 +1298,7 @@
1391 DRIZZLE_TYPE_VARCHAR,1298 DRIZZLE_TYPE_VARCHAR,
1392 0,1299 0,
1393 0,1300 0,
1394 "Variable_name",1301 "Variable_name");
1395 SKIP_OPEN_TABLE);
1396 if (name == NULL)1302 if (name == NULL)
1397 {1303 {
1398 return true;1304 return true;
@@ -1403,8 +1309,7 @@
1403 DRIZZLE_TYPE_VARCHAR,1309 DRIZZLE_TYPE_VARCHAR,
1404 0,1310 0,
1405 1,1311 1,
1406 "Value",1312 "Value");
1407 SKIP_OPEN_TABLE);
1408 if (value == NULL)1313 if (value == NULL)
1409 {1314 {
1410 return true;1315 return true;
@@ -1423,8 +1328,7 @@
1423 DRIZZLE_TYPE_VARCHAR,1328 DRIZZLE_TYPE_VARCHAR,
1424 0,1329 0,
1425 1,1330 1,
1426 "",1331 "");
1427 OPEN_FULL_TABLE);
1428 if (cat == NULL)1332 if (cat == NULL)
1429 {1333 {
1430 return true;1334 return true;
@@ -1435,8 +1339,7 @@
1435 DRIZZLE_TYPE_VARCHAR,1339 DRIZZLE_TYPE_VARCHAR,
1436 0,1340 0,
1437 0,1341 0,
1438 "",1342 "");
1439 OPEN_FULL_TABLE);
1440 if (sch == NULL)1343 if (sch == NULL)
1441 {1344 {
1442 return true;1345 return true;
@@ -1447,8 +1350,7 @@
1447 DRIZZLE_TYPE_VARCHAR,1350 DRIZZLE_TYPE_VARCHAR,
1448 0,1351 0,
1449 0,1352 0,
1450 "",1353 "");
1451 OPEN_FULL_TABLE);
1452 if (name == NULL)1354 if (name == NULL)
1453 {1355 {
1454 return true;1356 return true;
@@ -1459,8 +1361,7 @@
1459 DRIZZLE_TYPE_VARCHAR,1361 DRIZZLE_TYPE_VARCHAR,
1460 0,1362 0,
1461 0,1363 0,
1462 "",1364 "");
1463 OPEN_FULL_TABLE);
1464 if (tab_sch == NULL)1365 if (tab_sch == NULL)
1465 {1366 {
1466 return true;1367 return true;
@@ -1471,8 +1372,7 @@
1471 DRIZZLE_TYPE_VARCHAR,1372 DRIZZLE_TYPE_VARCHAR,
1472 0,1373 0,
1473 0,1374 0,
1474 "",1375 "");
1475 OPEN_FULL_TABLE);
1476 if (tab_name == NULL)1376 if (tab_name == NULL)
1477 {1377 {
1478 return true;1378 return true;
@@ -1483,8 +1383,7 @@
1483 DRIZZLE_TYPE_VARCHAR,1383 DRIZZLE_TYPE_VARCHAR,
1484 0,1384 0,
1485 0,1385 0,
1486 "",1386 "");
1487 OPEN_FULL_TABLE);
1488 if (type == NULL)1387 if (type == NULL)
1489 {1388 {
1490 return true;1389 return true;
@@ -1507,8 +1406,7 @@
1507 DRIZZLE_TYPE_VARCHAR,1406 DRIZZLE_TYPE_VARCHAR,
1508 0,1407 0,
1509 1,1408 1,
1510 "",1409 "");
1511 SKIP_OPEN_TABLE);
1512 if (cat == NULL)1410 if (cat == NULL)
1513 {1411 {
1514 return true;1412 return true;
@@ -1519,8 +1417,7 @@
1519 DRIZZLE_TYPE_VARCHAR,1417 DRIZZLE_TYPE_VARCHAR,
1520 0,1418 0,
1521 0,1419 0,
1522 "",1420 "");
1523 SKIP_OPEN_TABLE);
1524 if (sch == NULL)1421 if (sch == NULL)
1525 {1422 {
1526 return true;1423 return true;
@@ -1531,8 +1428,7 @@
1531 DRIZZLE_TYPE_VARCHAR,1428 DRIZZLE_TYPE_VARCHAR,
1532 0,1429 0,
1533 0,1430 0,
1534 "Name",1431 "Name");
1535 SKIP_OPEN_TABLE);
1536 if (name == NULL)1432 if (name == NULL)
1537 {1433 {
1538 return true;1434 return true;
@@ -1543,8 +1439,7 @@
1543 DRIZZLE_TYPE_VARCHAR,1439 DRIZZLE_TYPE_VARCHAR,
1544 0,1440 0,
1545 0,1441 0,
1546 "",1442 "");
1547 OPEN_FRM_ONLY);
1548 if (type == NULL)1443 if (type == NULL)
1549 {1444 {
1550 return true;1445 return true;
@@ -1555,8 +1450,7 @@
1555 DRIZZLE_TYPE_VARCHAR,1450 DRIZZLE_TYPE_VARCHAR,
1556 0,1451 0,
1557 1,1452 1,
1558 "Engine",1453 "Engine");
1559 OPEN_FRM_ONLY);
1560 if (engine == NULL)1454 if (engine == NULL)
1561 {1455 {
1562 return true;1456 return true;
@@ -1567,8 +1461,7 @@
1567 DRIZZLE_TYPE_LONGLONG,1461 DRIZZLE_TYPE_LONGLONG,
1568 0,1462 0,
1569 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1463 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1570 "Version",1464 "Version");
1571 OPEN_FRM_ONLY);
1572 if (version == NULL)1465 if (version == NULL)
1573 {1466 {
1574 return true;1467 return true;
@@ -1579,8 +1472,7 @@
1579 DRIZZLE_TYPE_VARCHAR,1472 DRIZZLE_TYPE_VARCHAR,
1580 0,1473 0,
1581 1,1474 1,
1582 "Row_format",1475 "Row_format");
1583 OPEN_FULL_TABLE);
1584 if (row_format == NULL)1476 if (row_format == NULL)
1585 {1477 {
1586 return true;1478 return true;
@@ -1591,8 +1483,7 @@
1591 DRIZZLE_TYPE_LONGLONG,1483 DRIZZLE_TYPE_LONGLONG,
1592 0,1484 0,
1593 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1485 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1594 "Rows",1486 "Rows");
1595 OPEN_FULL_TABLE);
1596 if (tab_rows == NULL)1487 if (tab_rows == NULL)
1597 {1488 {
1598 return true;1489 return true;
@@ -1603,8 +1494,7 @@
1603 DRIZZLE_TYPE_LONGLONG,1494 DRIZZLE_TYPE_LONGLONG,
1604 0,1495 0,
1605 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1496 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1606 "Avg_row_length",1497 "Avg_row_length");
1607 OPEN_FULL_TABLE);
1608 if (avg_row_len == NULL)1498 if (avg_row_len == NULL)
1609 {1499 {
1610 return true;1500 return true;
@@ -1615,8 +1505,7 @@
1615 DRIZZLE_TYPE_LONGLONG,1505 DRIZZLE_TYPE_LONGLONG,
1616 0,1506 0,
1617 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1507 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1618 "Data_length",1508 "Data_length");
1619 OPEN_FULL_TABLE);
1620 if (data_len == NULL)1509 if (data_len == NULL)
1621 {1510 {
1622 return true;1511 return true;
@@ -1627,8 +1516,7 @@
1627 DRIZZLE_TYPE_LONGLONG,1516 DRIZZLE_TYPE_LONGLONG,
1628 0,1517 0,
1629 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1518 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1630 "Max_data_length",1519 "Max_data_length");
1631 OPEN_FULL_TABLE);
1632 if (max_data_len == NULL)1520 if (max_data_len == NULL)
1633 {1521 {
1634 return true;1522 return true;
@@ -1639,8 +1527,7 @@
1639 DRIZZLE_TYPE_LONGLONG,1527 DRIZZLE_TYPE_LONGLONG,
1640 0,1528 0,
1641 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1529 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1642 "Index_length",1530 "Index_length");
1643 OPEN_FULL_TABLE);
1644 if (idx_len == NULL)1531 if (idx_len == NULL)
1645 {1532 {
1646 return true;1533 return true;
@@ -1651,8 +1538,7 @@
1651 DRIZZLE_TYPE_LONGLONG,1538 DRIZZLE_TYPE_LONGLONG,
1652 0,1539 0,
1653 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1540 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1654 "Data_free",1541 "Data_free");
1655 OPEN_FULL_TABLE);
1656 if (data_free == NULL)1542 if (data_free == NULL)
1657 {1543 {
1658 return true;1544 return true;
@@ -1663,8 +1549,7 @@
1663 DRIZZLE_TYPE_LONGLONG,1549 DRIZZLE_TYPE_LONGLONG,
1664 0,1550 0,
1665 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1551 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1666 "Auto_increment",1552 "Auto_increment");
1667 OPEN_FULL_TABLE);
1668 if (auto_inc == NULL)1553 if (auto_inc == NULL)
1669 {1554 {
1670 return true;1555 return true;
@@ -1675,8 +1560,7 @@
1675 DRIZZLE_TYPE_DATETIME,1560 DRIZZLE_TYPE_DATETIME,
1676 0,1561 0,
1677 1,1562 1,
1678 "Create_time",1563 "Create_time");
1679 OPEN_FULL_TABLE);
1680 if (create_time == NULL)1564 if (create_time == NULL)
1681 {1565 {
1682 return true;1566 return true;
@@ -1687,8 +1571,7 @@
1687 DRIZZLE_TYPE_DATETIME,1571 DRIZZLE_TYPE_DATETIME,
1688 0,1572 0,
1689 1,1573 1,
1690 "Update_time",1574 "Update_time");
1691 OPEN_FULL_TABLE);
1692 if (update_time == NULL)1575 if (update_time == NULL)
1693 {1576 {
1694 return true;1577 return true;
@@ -1699,8 +1582,7 @@
1699 DRIZZLE_TYPE_DATETIME,1582 DRIZZLE_TYPE_DATETIME,
1700 0,1583 0,
1701 1,1584 1,
1702 "Check_time",1585 "Check_time");
1703 OPEN_FULL_TABLE);
1704 if (check_time == NULL)1586 if (check_time == NULL)
1705 {1587 {
1706 return true;1588 return true;
@@ -1711,8 +1593,7 @@
1711 DRIZZLE_TYPE_VARCHAR,1593 DRIZZLE_TYPE_VARCHAR,
1712 0,1594 0,
1713 1,1595 1,
1714 "Collation",1596 "Collation");
1715 OPEN_FRM_ONLY);
1716 if (table_coll == NULL)1597 if (table_coll == NULL)
1717 {1598 {
1718 return true;1599 return true;
@@ -1723,8 +1604,7 @@
1723 DRIZZLE_TYPE_LONGLONG,1604 DRIZZLE_TYPE_LONGLONG,
1724 0,1605 0,
1725 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),1606 (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1726 "Checksum",1607 "Checksum");
1727 OPEN_FULL_TABLE);
1728 if (checksum == NULL)1608 if (checksum == NULL)
1729 {1609 {
1730 return true;1610 return true;
@@ -1735,8 +1615,7 @@
1735 DRIZZLE_TYPE_VARCHAR,1615 DRIZZLE_TYPE_VARCHAR,
1736 0,1616 0,
1737 1,1617 1,
1738 "Create_options",1618 "Create_options");
1739 OPEN_FRM_ONLY);
1740 if (create_opt == NULL)1619 if (create_opt == NULL)
1741 {1620 {
1742 return true;1621 return true;
@@ -1747,8 +1626,7 @@
1747 DRIZZLE_TYPE_VARCHAR,1626 DRIZZLE_TYPE_VARCHAR,
1748 0,1627 0,
1749 0,1628 0,
1750 "Comment",1629 "Comment");
1751 OPEN_FRM_ONLY);
1752 if (tab_comment == NULL)1630 if (tab_comment == NULL)
1753 {1631 {
1754 return true;1632 return true;
@@ -1787,8 +1665,7 @@
1787 DRIZZLE_TYPE_VARCHAR,1665 DRIZZLE_TYPE_VARCHAR,
1788 0,1666 0,
1789 1,1667 1,
1790 "",1668 "");
1791 SKIP_OPEN_TABLE);
1792 if (cat == NULL)1669 if (cat == NULL)
1793 {1670 {
1794 return true;1671 return true;
@@ -1799,8 +1676,7 @@
1799 DRIZZLE_TYPE_VARCHAR,1676 DRIZZLE_TYPE_VARCHAR,
1800 0,1677 0,
1801 0,1678 0,
1802 "",1679 "");
1803 SKIP_OPEN_TABLE);
1804 if (sch == NULL)1680 if (sch == NULL)
1805 {1681 {
1806 return true;1682 return true;
@@ -1811,8 +1687,7 @@
1811 DRIZZLE_TYPE_VARCHAR,1687 DRIZZLE_TYPE_VARCHAR,
1812 0,1688 0,
1813 0,1689 0,
1814 "Tables_in_",1690 "Tables_in_");
1815 SKIP_OPEN_TABLE);
1816 if (name == NULL)1691 if (name == NULL)
1817 {1692 {
1818 return true;1693 return true;
@@ -1823,8 +1698,7 @@
1823 DRIZZLE_TYPE_VARCHAR,1698 DRIZZLE_TYPE_VARCHAR,
1824 0,1699 0,
1825 0,1700 0,
1826 "Table_type",1701 "Table_type");
1827 OPEN_FRM_ONLY);
1828 if (type == NULL)1702 if (type == NULL)
1829 {1703 {
1830 return true;1704 return true;
18311705
=== modified file 'plugin/info_schema/info_schema_methods.cc'
--- plugin/info_schema/info_schema_methods.cc 2009-10-16 00:38:56 +0000
+++ plugin/info_schema/info_schema_methods.cc 2009-10-29 23:56:14 +0000
@@ -29,6 +29,7 @@
29#include <drizzled/tztime.h>29#include <drizzled/tztime.h>
30#include <drizzled/sql_base.h>30#include <drizzled/sql_base.h>
31#include <drizzled/plugin/client.h>31#include <drizzled/plugin/client.h>
32#include <drizzled/join_table.h>
3233
33#include "info_schema_methods.h"34#include "info_schema_methods.h"
3435
@@ -36,6 +37,7 @@
36#include <string>37#include <string>
3738
38using namespace std;39using namespace std;
40using namespace drizzled;
3941
40static inline void make_upper(char *buf)42static inline void make_upper(char *buf)
41{43{
@@ -186,6 +188,9 @@
186 break;188 break;
187 }189 }
188 table->restoreRecordAsDefault();190 table->restoreRecordAsDefault();
191 table->setWriteSet(0);
192 table->setWriteSet(1);
193 table->setWriteSet(2);
189 table->field[0]->store(name_buffer, strlen(name_buffer),194 table->field[0]->store(name_buffer, strlen(name_buffer),
190 system_charset_info);195 system_charset_info);
191 table->field[1]->store(pos, (uint32_t) (end - pos), system_charset_info);196 table->field[1]->store(pos, (uint32_t) (end - pos), system_charset_info);
@@ -193,8 +198,8 @@
193198
194 pthread_mutex_unlock(&LOCK_global_system_variables);199 pthread_mutex_unlock(&LOCK_global_system_variables);
195200
196 if (schema_table_store_record(session, table))201 TableList *tmp_list= table->pos_in_table_list;
197 return true;202 tmp_list->schema_table->addRow(table->record[0], table->s->reclength);
198 }203 }
199 }204 }
200 }205 }
@@ -202,7 +207,7 @@
202 return false;207 return false;
203}208}
204209
205int CharSetISMethods::fillTable(Session *session, TableList *tables, COND *)210int CharSetISMethods::fillTable(Session *session, TableList *tables)
206{211{
207 CHARSET_INFO **cs;212 CHARSET_INFO **cs;
208 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;213 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
@@ -220,13 +225,17 @@
220 {225 {
221 const char *comment;226 const char *comment;
222 table->restoreRecordAsDefault();227 table->restoreRecordAsDefault();
228 /* set the appropriate bits in the write bitset */
229 table->setWriteSet(0);
230 table->setWriteSet(1);
231 table->setWriteSet(2);
232 table->setWriteSet(3);
223 table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);233 table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);
224 table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);234 table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
225 comment= tmp_cs->comment ? tmp_cs->comment : "";235 comment= tmp_cs->comment ? tmp_cs->comment : "";
226 table->field[2]->store(comment, strlen(comment), scs);236 table->field[2]->store(comment, strlen(comment), scs);
227 table->field[3]->store((int64_t) tmp_cs->mbmaxlen, true);237 table->field[3]->store((int64_t) tmp_cs->mbmaxlen, true);
228 if (schema_table_store_record(session, table))238 tables->schema_table->addRow(table->record[0], table->s->reclength);
229 return 1;
230 }239 }
231 }240 }
232 return 0;241 return 0;
@@ -258,7 +267,7 @@
258 return 0;267 return 0;
259}268}
260269
261int CollationISMethods::fillTable(Session *session, TableList *tables, COND *)270int CollationISMethods::fillTable(Session *session, TableList *tables)
262{271{
263 CHARSET_INFO **cs;272 CHARSET_INFO **cs;
264 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;273 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
@@ -283,6 +292,13 @@
283 {292 {
284 const char *tmp_buff;293 const char *tmp_buff;
285 table->restoreRecordAsDefault();294 table->restoreRecordAsDefault();
295 /* set the appropriate bits in the write bitset */
296 table->setWriteSet(0);
297 table->setWriteSet(1);
298 table->setWriteSet(2);
299 table->setWriteSet(3);
300 table->setWriteSet(4);
301 table->setWriteSet(5);
286 table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);302 table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
287 table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);303 table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
288 table->field[2]->store((int64_t) tmp_cl->number, true);304 table->field[2]->store((int64_t) tmp_cl->number, true);
@@ -291,15 +307,14 @@
291 tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";307 tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
292 table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);308 table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
293 table->field[5]->store((int64_t) tmp_cl->strxfrm_multiply, true);309 table->field[5]->store((int64_t) tmp_cl->strxfrm_multiply, true);
294 if (schema_table_store_record(session, table))310 tables->schema_table->addRow(table->record[0], table->s->reclength);
295 return 1;
296 }311 }
297 }312 }
298 }313 }
299 return 0;314 return 0;
300}315}
301316
302int CollCharISMethods::fillTable(Session *session, TableList *tables, COND *)317int CollCharISMethods::fillTable(Session *, TableList *tables)
303{318{
304 CHARSET_INFO **cs;319 CHARSET_INFO **cs;
305 Table *table= tables->table;320 Table *table= tables->table;
@@ -318,10 +333,11 @@
318 ! my_charset_same(tmp_cs,tmp_cl))333 ! my_charset_same(tmp_cs,tmp_cl))
319 continue;334 continue;
320 table->restoreRecordAsDefault();335 table->restoreRecordAsDefault();
336 table->setWriteSet(0);
337 table->setWriteSet(1);
321 table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);338 table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
322 table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);339 table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
323 if (schema_table_store_record(session, table))340 tables->schema_table->addRow(table->record[0], table->s->reclength);
324 return 1;
325 }341 }
326 }342 }
327 return 0;343 return 0;
@@ -367,6 +383,13 @@
367 int64_t idx)383 int64_t idx)
368{384{
369 const CHARSET_INFO * const cs= system_charset_info;385 const CHARSET_INFO * const cs= system_charset_info;
386 /* set the appropriate bits in the write bitset */
387 table->setWriteSet(1);
388 table->setWriteSet(2);
389 table->setWriteSet(4);
390 table->setWriteSet(5);
391 table->setWriteSet(6);
392 table->setWriteSet(7);
370 table->field[1]->store(db_name->str, db_name->length, cs);393 table->field[1]->store(db_name->str, db_name->length, cs);
371 table->field[2]->store(key_name, key_len, cs);394 table->field[2]->store(key_name, key_len, cs);
372 table->field[4]->store(db_name->str, db_name->length, cs);395 table->field[4]->store(db_name->str, db_name->length, cs);
@@ -375,11 +398,12 @@
375 table->field[7]->store((int64_t) idx, true);398 table->field[7]->store((int64_t) idx, true);
376}399}
377400
378int KeyColUsageISMethods::processTable(Session *session,401int KeyColUsageISMethods::processTable(plugin::InfoSchemaTable *,
379 TableList *tables,402 Session *session,
380 Table *table, bool res,403 TableList *tables,
381 LEX_STRING *db_name,404 Table *table, bool res,
382 LEX_STRING *table_name) const405 LEX_STRING *db_name,
406 LEX_STRING *table_name)
383{407{
384 if (res)408 if (res)
385 {409 {
@@ -418,10 +442,8 @@
418 key_part->field->field_name,442 key_part->field->field_name,
419 strlen(key_part->field->field_name),443 strlen(key_part->field->field_name),
420 (int64_t) f_idx);444 (int64_t) f_idx);
421 if (schema_table_store_record(session, table))445 tables->schema_table->addRow(table->record[0],
422 {446 table->s->reclength);
423 return (1);
424 }
425 }447 }
426 }448 }
427 }449 }
@@ -446,6 +468,10 @@
446 f_key_info->forein_id->length,468 f_key_info->forein_id->length,
447 f_info->str, f_info->length,469 f_info->str, f_info->length,
448 (int64_t) f_idx);470 (int64_t) f_idx);
471 table->setWriteSet(8);
472 table->setWriteSet(9);
473 table->setWriteSet(10);
474 table->setWriteSet(11);
449 table->field[8]->store((int64_t) f_idx, true);475 table->field[8]->store((int64_t) f_idx, true);
450 table->field[8]->set_notnull();476 table->field[8]->set_notnull();
451 table->field[9]->store(f_key_info->referenced_db->str,477 table->field[9]->store(f_key_info->referenced_db->str,
@@ -459,10 +485,8 @@
459 table->field[11]->store(r_info->str, r_info->length,485 table->field[11]->store(r_info->str, r_info->length,
460 system_charset_info);486 system_charset_info);
461 table->field[11]->set_notnull();487 table->field[11]->set_notnull();
462 if (schema_table_store_record(session, table))488 tables->schema_table->addRow(table->record[0],
463 {489 table->s->reclength);
464 return (1);
465 }
466 }490 }
467 }491 }
468 }492 }
@@ -473,17 +497,21 @@
473inline bool open_list_store(Table *table, open_table_list_st& open_list)497inline bool open_list_store(Table *table, open_table_list_st& open_list)
474{498{
475 table->restoreRecordAsDefault();499 table->restoreRecordAsDefault();
500 table->setWriteSet(0);
501 table->setWriteSet(1);
502 table->setWriteSet(2);
503 table->setWriteSet(3);
476 table->field[0]->store(open_list.db.c_str(), open_list.db.length(), system_charset_info);504 table->field[0]->store(open_list.db.c_str(), open_list.db.length(), system_charset_info);
477 table->field[1]->store(open_list.table.c_str(), open_list.table.length(), system_charset_info);505 table->field[1]->store(open_list.table.c_str(), open_list.table.length(), system_charset_info);
478 table->field[2]->store((int64_t) open_list.in_use, true);506 table->field[2]->store((int64_t) open_list.in_use, true);
479 table->field[3]->store((int64_t) open_list.locked, true);507 table->field[3]->store((int64_t) open_list.locked, true);
480 if (schema_table_store_record(table->in_use, table))508 TableList *tmp= table->pos_in_table_list;
481 return true;509 tmp->schema_table->addRow(table->record[0], table->s->reclength);
482510
483 return false;511 return false;
484}512}
485513
486int OpenTablesISMethods::fillTable(Session *session, TableList *tables, COND *)514int OpenTablesISMethods::fillTable(Session *session, TableList *tables)
487{515{
488 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;516 const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
489517
@@ -497,9 +525,16 @@
497{525{
498 Session *session;526 Session *session;
499 Table *table;527 Table *table;
528 plugin::InfoSchemaTable *is_table;
500public:529public:
501 ShowPlugins(Session *session_arg, Table *table_arg)530 ShowPlugins(Session *session_arg,
502 : session(session_arg), table(table_arg) {}531 Table *table_arg,
532 plugin::InfoSchemaTable *is_table_arg)
533 :
534 session(session_arg),
535 table(table_arg),
536 is_table(is_table_arg)
537 {}
503538
504 result_type operator() (argument_type plugin)539 result_type operator() (argument_type plugin)
505 {540 {
@@ -508,6 +543,14 @@
508543
509 table->restoreRecordAsDefault();544 table->restoreRecordAsDefault();
510545
546 /* mark fields that will be written to in the write bitset */
547 table->setWriteSet(0);
548 table->setWriteSet(1);
549 table->setWriteSet(2);
550 table->setWriteSet(3);
551 table->setWriteSet(4);
552 table->setWriteSet(5);
553
511 table->field[0]->store(plugin->getName().c_str(),554 table->field[0]->store(plugin->getName().c_str(),
512 plugin->getName().size(), cs);555 plugin->getName().size(), cs);
513556
@@ -569,18 +612,21 @@
569 }612 }
570 table->field[5]->set_notnull();613 table->field[5]->set_notnull();
571614
572 return schema_table_store_record(session, table);615 is_table->addRow(table->record[0], table->s->reclength);
616 return false;
573 }617 }
574};618};
575619
576int PluginsISMethods::fillTable(Session *session, TableList *tables, COND *)620int PluginsISMethods::fillTable(Session *session, TableList *tables)
577{621{
578 Table *table= tables->table;622 Table *table= tables->table;
579623
580 drizzled::plugin::Registry &registry= drizzled::plugin::Registry::singleton();624 drizzled::plugin::Registry &registry= drizzled::plugin::Registry::singleton();
581 vector<drizzled::plugin::Handle *> plugins= registry.getList(true);625 vector<drizzled::plugin::Handle *> plugins= registry.getList(true);
582 vector<drizzled::plugin::Handle *>::iterator iter=626 vector<drizzled::plugin::Handle *>::iterator iter=
583 find_if(plugins.begin(), plugins.end(), ShowPlugins(session, table));627 find_if(plugins.begin(),
628 plugins.end(),
629 ShowPlugins(session, table, tables->schema_table));
584 if (iter != plugins.end())630 if (iter != plugins.end())
585 {631 {
586 return 1;632 return 1;
@@ -588,7 +634,7 @@
588 return (0);634 return (0);
589}635}
590636
591int ProcessListISMethods::fillTable(Session* session, TableList* tables, COND*)637int ProcessListISMethods::fillTable(Session* session, TableList* tables)
592{638{
593 Table *table= tables->table;639 Table *table= tables->table;
594 const CHARSET_INFO * const cs= system_charset_info;640 const CHARSET_INFO * const cs= system_charset_info;
@@ -615,6 +661,14 @@
615 continue;661 continue;
616662
617 table->restoreRecordAsDefault();663 table->restoreRecordAsDefault();
664 table->setWriteSet(0);
665 table->setWriteSet(1);
666 table->setWriteSet(2);
667 table->setWriteSet(3);
668 table->setWriteSet(4);
669 table->setWriteSet(5);
670 table->setWriteSet(6);
671 table->setWriteSet(7);
618 /* ID */672 /* ID */
619 table->field[0]->store((int64_t) tmp->thread_id, true);673 table->field[0]->store((int64_t) tmp->thread_id, true);
620 /* USER */674 /* USER */
@@ -667,11 +721,7 @@
667 table->field[7]->set_notnull();721 table->field[7]->set_notnull();
668 }722 }
669723
670 if (schema_table_store_record(session, table))724 tables->schema_table->addRow(table->record[0], table->s->reclength);
671 {
672 pthread_mutex_unlock(&LOCK_thread_count);
673 return(1);
674 }
675 }725 }
676 }726 }
677727
@@ -680,10 +730,10 @@
680}730}
681731
682int732int
683RefConstraintsISMethods::processTable(Session *session, TableList *tables,733RefConstraintsISMethods::processTable(plugin::InfoSchemaTable *,
734 Session *session, TableList *tables,
684 Table *table, bool res,735 Table *table, bool res,
685 LEX_STRING *db_name, LEX_STRING *table_name)736 LEX_STRING *db_name, LEX_STRING *table_name)
686 const
687{737{
688 const CHARSET_INFO * const cs= system_charset_info;738 const CHARSET_INFO * const cs= system_charset_info;
689739
@@ -709,6 +759,15 @@
709 while ((f_key_info= it++))759 while ((f_key_info= it++))
710 {760 {
711 table->restoreRecordAsDefault();761 table->restoreRecordAsDefault();
762 table->setWriteSet(1);
763 table->setWriteSet(2);
764 table->setWriteSet(4);
765 table->setWriteSet(5);
766 table->setWriteSet(6);
767 table->setWriteSet(7);
768 table->setWriteSet(8);
769 table->setWriteSet(9);
770 table->setWriteSet(10);
712 table->field[1]->store(db_name->str, db_name->length, cs);771 table->field[1]->store(db_name->str, db_name->length, cs);
713 table->field[9]->store(table_name->str, table_name->length, cs);772 table->field[9]->store(table_name->str, table_name->length, cs);
714 table->field[2]->store(f_key_info->forein_id->str,773 table->field[2]->store(f_key_info->forein_id->str,
@@ -732,26 +791,29 @@
732 f_key_info->update_method->length, cs);791 f_key_info->update_method->length, cs);
733 table->field[8]->store(f_key_info->delete_method->str,792 table->field[8]->store(f_key_info->delete_method->str,
734 f_key_info->delete_method->length, cs);793 f_key_info->delete_method->length, cs);
735 if (schema_table_store_record(session, table))794 tables->schema_table->addRow(table->record[0],
736 {795 table->s->reclength);
737 return (1);
738 }
739 }796 }
740 }797 }
741 return (0);798 return (0);
742}799}
743800
744static bool store_schema_schemata(Session* session, Table *table, LEX_STRING *db_name,801static bool store_schema_schemata(Session *, Table *table, LEX_STRING *db_name,
745 const CHARSET_INFO * const cs)802 const CHARSET_INFO * const cs)
746{803{
747 table->restoreRecordAsDefault();804 table->restoreRecordAsDefault();
805 table->setWriteSet(1);
806 table->setWriteSet(2);
807 table->setWriteSet(3);
748 table->field[1]->store(db_name->str, db_name->length, system_charset_info);808 table->field[1]->store(db_name->str, db_name->length, system_charset_info);
749 table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);809 table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);
750 table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);810 table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
751 return schema_table_store_record(session, table);811 TableList *tmp= table->pos_in_table_list;
812 tmp->schema_table->addRow(table->record[0], table->s->reclength);
813 return 0;
752}814}
753815
754int SchemataISMethods::fillTable(Session *session, TableList *tables, COND *cond)816int SchemataISMethods::fillTable(Session *session, TableList *tables)
755{817{
756 /*818 /*
757 TODO: fill_schema_shemata() is called when new client is connected.819 TODO: fill_schema_shemata() is called when new client is connected.
@@ -762,6 +824,8 @@
762 vector<LEX_STRING*> db_names;824 vector<LEX_STRING*> db_names;
763 bool with_i_schema;825 bool with_i_schema;
764 Table *table= tables->table;826 Table *table= tables->table;
827 /* the WHERE clause */
828 COND *cond= table->reginfo.join_tab->select_cond;
765829
766 if (get_lookup_field_values(session, cond, tables, &lookup_field_vals))830 if (get_lookup_field_values(session, cond, tables, &lookup_field_vals))
767 return(0);831 return(0);
@@ -810,7 +874,7 @@
810 return(0);874 return(0);
811}875}
812876
813int SchemataISMethods::oldFormat(Session *session, drizzled::plugin::InfoSchemaTable *schema_table)877int SchemataISMethods::oldFormat(Session *session, plugin::InfoSchemaTable *schema_table)
814 const878 const
815{879{
816 char tmp[128];880 char tmp[128];
@@ -840,10 +904,11 @@
840 return 0;904 return 0;
841}905}
842906
843int StatsISMethods::processTable(Session *session, TableList *tables,907int StatsISMethods::processTable(plugin::InfoSchemaTable *store_table,
844 Table *table, bool res,908 Session *session, TableList *tables,
845 LEX_STRING *db_name,909 Table *table, bool res,
846 LEX_STRING *table_name) const910 LEX_STRING *db_name,
911 LEX_STRING *table_name)
847{912{
848 const CHARSET_INFO * const cs= system_charset_info;913 const CHARSET_INFO * const cs= system_charset_info;
849 if (res)914 if (res)
@@ -881,6 +946,19 @@
881 for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++)946 for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++)
882 {947 {
883 table->restoreRecordAsDefault();948 table->restoreRecordAsDefault();
949 table->setWriteSet(1);
950 table->setWriteSet(2);
951 table->setWriteSet(3);
952 table->setWriteSet(4);
953 table->setWriteSet(5);
954 table->setWriteSet(6);
955 table->setWriteSet(8);
956 table->setWriteSet(9);
957 table->setWriteSet(10);
958 table->setWriteSet(12);
959 table->setWriteSet(13);
960 table->setWriteSet(14);
961 table->setWriteSet(15);
884 table->field[1]->store(db_name->str, db_name->length, cs);962 table->field[1]->store(db_name->str, db_name->length, cs);
885 table->field[2]->store(table_name->str, table_name->length, cs);963 table->field[2]->store(table_name->str, table_name->length, cs);
886 table->field[3]->store((int64_t) ((key_info->flags &964 table->field[3]->store((int64_t) ((key_info->flags &
@@ -938,17 +1016,15 @@
938 table->field[15]->store(key_info->comment.str,1016 table->field[15]->store(key_info->comment.str,
939 key_info->comment.length, cs);1017 key_info->comment.length, cs);
940 }1018 }
941 if (schema_table_store_record(session, table))1019 store_table->addRow(table->record[0],
942 {1020 table->s->reclength);
943 return (1);
944 }
945 }1021 }
946 }1022 }
947 }1023 }
948 return(res);1024 return res;
949}1025}
9501026
951int StatusISMethods::fillTable(Session *session, TableList *tables, COND *)1027int StatusISMethods::fillTable(Session *session, TableList *tables)
952{1028{
953 LEX *lex= session->lex;1029 LEX *lex= session->lex;
954 const char *wild= lex->wild ? lex->wild->ptr() : NULL;1030 const char *wild= lex->wild ? lex->wild->ptr() : NULL;
@@ -988,24 +1064,32 @@
988 return(res);1064 return(res);
989}1065}
9901066
991static bool store_constraints(Session *session, Table *table, LEX_STRING *db_name,1067static bool store_constraints(Session *, Table *table, LEX_STRING *db_name,
992 LEX_STRING *table_name, const char *key_name,1068 LEX_STRING *table_name, const char *key_name,
993 uint32_t key_len, const char *con_type, uint32_t con_len)1069 uint32_t key_len, const char *con_type, uint32_t con_len)
994{1070{
995 const CHARSET_INFO * const cs= system_charset_info;1071 const CHARSET_INFO * const cs= system_charset_info;
996 table->restoreRecordAsDefault();1072 table->restoreRecordAsDefault();
1073 table->setWriteSet(1);
1074 table->setWriteSet(2);
1075 table->setWriteSet(3);
1076 table->setWriteSet(4);
1077 table->setWriteSet(5);
997 table->field[1]->store(db_name->str, db_name->length, cs);1078 table->field[1]->store(db_name->str, db_name->length, cs);
998 table->field[2]->store(key_name, key_len, cs);1079 table->field[2]->store(key_name, key_len, cs);
999 table->field[3]->store(db_name->str, db_name->length, cs);1080 table->field[3]->store(db_name->str, db_name->length, cs);
1000 table->field[4]->store(table_name->str, table_name->length, cs);1081 table->field[4]->store(table_name->str, table_name->length, cs);
1001 table->field[5]->store(con_type, con_len, cs);1082 table->field[5]->store(con_type, con_len, cs);
1002 return schema_table_store_record(session, table);1083 TableList *tmp= table->pos_in_table_list;
1084 tmp->schema_table->addRow(table->record[0], table->s->reclength);
1085 return false;
1003}1086}
10041087
1005int TabConstraintsISMethods::processTable(Session *session, TableList *tables,1088int TabConstraintsISMethods::processTable(plugin::InfoSchemaTable *,
1089 Session *session, TableList *tables,
1006 Table *table, bool res,1090 Table *table, bool res,
1007 LEX_STRING *db_name,1091 LEX_STRING *db_name,
1008 LEX_STRING *table_name) const1092 LEX_STRING *table_name)
1009{1093{
1010 if (res)1094 if (res)
1011 {1095 {
@@ -1070,16 +1154,36 @@
1070 return (res);1154 return (res);
1071}1155}
10721156
1073int TablesISMethods::processTable(Session *session, TableList *tables,1157int TablesISMethods::processTable(plugin::InfoSchemaTable *store_table,
1074 Table *table, bool res,1158 Session *session, TableList *tables,
1075 LEX_STRING *db_name,1159 Table *table, bool res,
1076 LEX_STRING *table_name) const1160 LEX_STRING *db_name,
1161 LEX_STRING *table_name)
1077{1162{
1078 const char *tmp_buff;1163 const char *tmp_buff;
1079 DRIZZLE_TIME time;1164 DRIZZLE_TIME time;
1080 const CHARSET_INFO * const cs= system_charset_info;1165 const CHARSET_INFO * const cs= system_charset_info;
10811166
1082 table->restoreRecordAsDefault();1167 table->restoreRecordAsDefault();
1168 table->setWriteSet(1);
1169 table->setWriteSet(2);
1170 table->setWriteSet(3);
1171 table->setWriteSet(4);
1172 table->setWriteSet(5);
1173 table->setWriteSet(6);
1174 table->setWriteSet(7);
1175 table->setWriteSet(8);
1176 table->setWriteSet(9);
1177 table->setWriteSet(11);
1178 table->setWriteSet(12);
1179 table->setWriteSet(13);
1180 table->setWriteSet(14);
1181 table->setWriteSet(15);
1182 table->setWriteSet(16);
1183 table->setWriteSet(17);
1184 table->setWriteSet(18);
1185 table->setWriteSet(19);
1186 table->setWriteSet(20);
1083 table->field[1]->store(db_name->str, db_name->length, cs);1187 table->field[1]->store(db_name->str, db_name->length, cs);
1084 table->field[2]->store(table_name->str, table_name->length, cs);1188 table->field[2]->store(table_name->str, table_name->length, cs);
1085 if (res)1189 if (res)
@@ -1245,7 +1349,8 @@
1245 }1349 }
1246 }1350 }
1247 }1351 }
1248 return (schema_table_store_record(session, table));1352 store_table->addRow(table->record[0], table->s->reclength);
1353 return false;
1249}1354}
12501355
12511356
@@ -1291,7 +1396,7 @@
1291 return 0;1396 return 0;
1292}1397}
12931398
1294int VariablesISMethods::fillTable(Session *session, TableList *tables, COND *)1399int VariablesISMethods::fillTable(Session *session, TableList *tables)
1295{1400{
1296 int res= 0;1401 int res= 0;
1297 LEX *lex= session->lex;1402 LEX *lex= session->lex;
12981403
=== modified file 'plugin/info_schema/info_schema_methods.h'
--- plugin/info_schema/info_schema_methods.h 2009-09-25 20:13:37 +0000
+++ plugin/info_schema/info_schema_methods.h 2009-10-29 23:56:14 +0000
@@ -34,8 +34,7 @@
34{34{
35public:35public:
36 virtual int fillTable(Session *session, 36 virtual int fillTable(Session *session,
37 TableList *tables,37 TableList *tables);
38 COND *cond);
39 virtual int oldFormat(Session *session,38 virtual int oldFormat(Session *session,
40 drizzled::plugin::InfoSchemaTable *schema_table) const;39 drizzled::plugin::InfoSchemaTable *schema_table) const;
41};40};
@@ -50,8 +49,7 @@
50{49{
51public:50public:
52 virtual int fillTable(Session *session,51 virtual int fillTable(Session *session,
53 TableList *tables,52 TableList *tables);
54 COND *cond);
55};53};
5654
57/**55/**
@@ -64,8 +62,7 @@
64{62{
65public:63public:
66 virtual int fillTable(Session *session,64 virtual int fillTable(Session *session,
67 TableList *tables,65 TableList *tables);
68 COND *cond);
69};66};
7067
71/**68/**
@@ -90,9 +87,11 @@
90class KeyColUsageISMethods : public drizzled::plugin::InfoSchemaMethods87class KeyColUsageISMethods : public drizzled::plugin::InfoSchemaMethods
91{88{
92public:89public:
93 virtual int processTable(Session *session, TableList *tables,90 virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table,
91 Session *session,
92 TableList *tables,
94 Table *table, bool res, LEX_STRING *db_name,93 Table *table, bool res, LEX_STRING *db_name,
95 LEX_STRING *table_name) const;94 LEX_STRING *table_name);
96};95};
9796
98/**97/**
@@ -105,8 +104,7 @@
105{104{
106public:105public:
107 virtual int fillTable(Session *session,106 virtual int fillTable(Session *session,
108 TableList *tables,107 TableList *tables);
109 COND *cond);
110};108};
111109
112/**110/**
@@ -119,8 +117,7 @@
119{117{
120public:118public:
121 virtual int fillTable(Session *session,119 virtual int fillTable(Session *session,
122 TableList *tables,120 TableList *tables);
123 COND *cond);
124};121};
125122
126/**123/**
@@ -133,8 +130,7 @@
133{130{
134public:131public:
135 virtual int fillTable(Session *session,132 virtual int fillTable(Session *session,
136 TableList *tables,133 TableList *tables);
137 COND *cond);
138};134};
139135
140/**136/**
@@ -159,9 +155,10 @@
159 *155 *
160 * @return 0 on success; 1 on failure156 * @return 0 on success; 1 on failure
161 */157 */
162 virtual int processTable(Session *session, TableList *tables,158 virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table,
159 Session *session, TableList *tables,
163 Table *table, bool res, LEX_STRING *db_name,160 Table *table, bool res, LEX_STRING *db_name,
164 LEX_STRING *table_name) const;161 LEX_STRING *table_name);
165};162};
166163
167/**164/**
@@ -174,8 +171,7 @@
174{171{
175public:172public:
176 virtual int fillTable(Session *session,173 virtual int fillTable(Session *session,
177 TableList *tables,174 TableList *tables);
178 COND *cond);
179 virtual int oldFormat(Session *session,175 virtual int oldFormat(Session *session,
180 drizzled::plugin::InfoSchemaTable *schema_table) const;176 drizzled::plugin::InfoSchemaTable *schema_table) const;
181};177};
@@ -189,9 +185,11 @@
189class StatsISMethods : public drizzled::plugin::InfoSchemaMethods185class StatsISMethods : public drizzled::plugin::InfoSchemaMethods
190{186{
191public:187public:
192 virtual int processTable(Session *session, TableList *tables,188 virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table,
189 Session *session,
190 TableList *tables,
193 Table *table, bool res, LEX_STRING *db_name,191 Table *table, bool res, LEX_STRING *db_name,
194 LEX_STRING *table_name) const;192 LEX_STRING *table_name);
195};193};
196194
197/**195/**
@@ -204,8 +202,7 @@
204{202{
205public:203public:
206 virtual int fillTable(Session *session, 204 virtual int fillTable(Session *session,
207 TableList *tables,205 TableList *tables);
208 COND *cond);
209};206};
210207
211/**208/**
@@ -217,9 +214,10 @@
217class TabConstraintsISMethods : public drizzled::plugin::InfoSchemaMethods214class TabConstraintsISMethods : public drizzled::plugin::InfoSchemaMethods
218{215{
219public:216public:
220 virtual int processTable(Session *session, TableList *tables,217 virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table,
218 Session *session, TableList *tables,
221 Table *table, bool res, LEX_STRING *db_name,219 Table *table, bool res, LEX_STRING *db_name,
222 LEX_STRING *table_name) const;220 LEX_STRING *table_name);
223};221};
224222
225/**223/**
@@ -231,9 +229,10 @@
231class TablesISMethods : public drizzled::plugin::InfoSchemaMethods229class TablesISMethods : public drizzled::plugin::InfoSchemaMethods
232{230{
233public:231public:
234 virtual int processTable(Session *session, TableList *tables,232 virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table,
233 Session *session, TableList *tables,
235 Table *table, bool res, LEX_STRING *db_name,234 Table *table, bool res, LEX_STRING *db_name,
236 LEX_STRING *table_name) const;235 LEX_STRING *table_name);
237};236};
238237
239/**238/**
@@ -259,8 +258,7 @@
259{258{
260public:259public:
261 virtual int fillTable(Session *session, 260 virtual int fillTable(Session *session,
262 TableList *tables,261 TableList *tables);
263 COND *cond);
264};262};
265263
266#endif /* PLUGIN_INFO_SCHEMA_INFO_SCHEMA_METHODS_H */264#endif /* PLUGIN_INFO_SCHEMA_INFO_SCHEMA_METHODS_H */
267265
=== added directory 'plugin/info_schema_engine'
=== added file 'plugin/info_schema_engine/info_schema_cursor.cc'
--- plugin/info_schema_engine/info_schema_cursor.cc 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/info_schema_cursor.cc 2009-10-29 23:56:14 +0000
@@ -0,0 +1,144 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "drizzled/server_includes.h"
20#include "drizzled/join_table.h"
21#include "drizzled/session.h"
22#include "info_schema_cursor.h"
23#include "open_tables.h"
24
25#include <string>
26#include <map>
27
28using namespace std;
29using namespace drizzled;
30
31int InfoSchemaCursor::open(const char *name, int, uint32_t)
32{
33 string table_name(name);
34 string i_s_prefix("./information_schema/");
35 table_name.erase(0, i_s_prefix.length());
36
37 OpenTables &open_tables= OpenTables::singleton();
38 if (! (share= open_tables.getShare(table_name)))
39 {
40 return HA_ERR_OUT_OF_MEM;
41 }
42
43 assert(share);
44
45 thr_lock_data_init(share->getThreadLock(), &data_lock, NULL);
46
47 return 0;
48}
49
50int InfoSchemaCursor::close()
51{
52 OpenTables &open_tables= OpenTables::singleton();
53 open_tables.freeShare();
54 return 0;
55}
56
57int InfoSchemaCursor::info(uint32_t flags)
58{
59 /*
60 * If this flag is set, then we know that the time of the last
61 * modification needs to be modified.
62 */
63 if (flags & HA_STATUS_TIME)
64 {
65 }
66
67 if (flags & HA_STATUS_VARIABLE)
68 {
69 stats.records= 1;
70 }
71
72 /*
73 * If this flag is set, then we know that the auto_increment value needs
74 * to be updated.
75 */
76 if (flags & HA_STATUS_AUTO)
77 {
78 stats.auto_increment_value= 1;
79 }
80
81 return 0;
82}
83
84int InfoSchemaCursor::rnd_init(bool)
85{
86 TableList *tmp= table->pos_in_table_list;
87 plugin::InfoSchemaTable *sch_table= share->getInfoSchemaTable();
88 if (sch_table)
89 {
90 sch_table->fillTable(ha_session(),
91 tmp);
92 iter= sch_table->getRows().begin();
93 }
94 return 0;
95}
96
97int InfoSchemaCursor::rnd_next(unsigned char *buf)
98{
99 ha_statistic_increment(&SSV::ha_read_rnd_next_count);
100 plugin::InfoSchemaTable *sch_table= share->getInfoSchemaTable();
101 if (iter != sch_table->getRows().end() &&
102 ! sch_table->getRows().empty())
103 {
104 (*iter)->copyRecordInto(buf);
105 ++iter;
106 return 0;
107 }
108 sch_table->clearRows();
109 return HA_ERR_END_OF_FILE;
110}
111
112int InfoSchemaCursor::rnd_pos(unsigned char *, unsigned char *)
113{
114 ha_statistic_increment(&SSV::ha_read_rnd_count);
115 return HA_ERR_WRONG_COMMAND;
116}
117
118void InfoSchemaCursor::position(const unsigned char *)
119{
120 return;
121}
122
123THR_LOCK_DATA **InfoSchemaCursor::store_lock(Session *session,
124 THR_LOCK_DATA **to,
125 enum thr_lock_type lock_type)
126{
127 /* borrowed from archive and BDB engines. TODO: understand this! */
128 if (lock_type != TL_IGNORE && data_lock.type == TL_UNLOCK)
129 {
130 if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) &&
131 ! session_tablespace_op(session))
132 {
133 lock_type= TL_WRITE_ALLOW_WRITE;
134 }
135 if (lock_type == TL_READ_NO_INSERT)
136 {
137 lock_type= TL_READ;
138 }
139 data_lock.type= lock_type;
140 }
141 *to++= &data_lock;
142 return to;
143}
144
0145
=== added file 'plugin/info_schema_engine/info_schema_cursor.h'
--- plugin/info_schema_engine/info_schema_cursor.h 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/info_schema_cursor.h 2009-10-29 23:56:14 +0000
@@ -0,0 +1,175 @@
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2009 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H
22#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H
23
24#include <drizzled/cursor.h>
25#include <drizzled/show.h>
26#include <drizzled/plugin/info_schema_table.h>
27#include <mysys/thr_lock.h>
28
29/*
30 * Shared structure for correct LOCK operation
31 */
32class InfoSchemaShare
33{
34public:
35 InfoSchemaShare()
36 :
37 use_count(0),
38 lock(),
39 i_s_table(NULL)
40 {}
41
42 ~InfoSchemaShare()
43 {
44 thr_lock_delete(&lock);
45 }
46
47 uint32_t getUseCount() const
48 {
49 return use_count;
50 }
51
52 void incUseCount()
53 {
54 use_count++;
55 }
56
57 void decUseCount()
58 {
59 use_count--;
60 }
61
62 const std::string &getName() const
63 {
64 return i_s_table->getTableName();
65 }
66
67 void initThreadLock()
68 {
69 thr_lock_init(&lock);
70 }
71
72 THR_LOCK *getThreadLock()
73 {
74 return &lock;
75 }
76
77 void setInfoSchemaTable(const std::string &name)
78 {
79 i_s_table= drizzled::plugin::InfoSchemaTable::getTable(name.c_str());
80 }
81
82 drizzled::plugin::InfoSchemaTable *getInfoSchemaTable()
83 {
84 return i_s_table;
85 }
86
87
88private:
89
90 uint32_t use_count;
91 THR_LOCK lock;
92 drizzled::plugin::InfoSchemaTable *i_s_table;
93};
94
95class InfoSchemaCursor : public Cursor
96{
97public:
98
99 InfoSchemaCursor(drizzled::plugin::StorageEngine *engine_arg, TableShare *table_arg)
100 :
101 Cursor(engine_arg, table_arg)
102 {}
103
104 ~InfoSchemaCursor() {}
105
106 const char *table_type() const
107 {
108 return "INFORMATION_SCHEMA";
109 }
110
111 /*
112 The name of the index type that will be used for display
113 don't implement this method unless you really have indexes
114 */
115 const char *index_type(uint32_t)
116 {
117 return NULL;
118 }
119
120 uint64_t table_flags() const
121 {
122 return (HA_NULL_IN_KEY |
123 HA_CAN_INDEX_BLOBS |
124 HA_AUTO_PART_KEY);
125 }
126
127 uint32_t index_flags(uint32_t, uint32_t, bool) const
128 {
129 return 0;
130 }
131
132 /* open a table */
133 int open(const char *name, int mode, uint32_t test_if_locked);
134
135 /* close a table */
136 int close(void);
137
138 /* provide info to the optimizer */
139 int info(uint32_t flag);
140
141 /* preparation for table scan (is this true?) */
142 int rnd_init(bool scan);
143
144 /* get the next row and copy it into buf */
145 int rnd_next(unsigned char *buf);
146
147 /* locate row pointed to by pos, copy it into buf */
148 int rnd_pos(unsigned char *buf, unsigned char *pos);
149
150 /* record position of a record for reordering */
151 void position(const unsigned char *record);
152
153 /*
154 * @todo: return actual upper bound of number of records in the table.
155 * (e.g. save number of records seen on full table scan and/or use file size
156 * as upper bound)
157 */
158 ha_rows estimate_rows_upper_bound()
159 {
160 return HA_POS_ERROR;
161 }
162
163 THR_LOCK_DATA **store_lock(Session *session,
164 THR_LOCK_DATA **to,
165 enum thr_lock_type lock_type);
166
167private:
168
169 THR_LOCK_DATA data_lock;
170 InfoSchemaShare *share;
171 drizzled::plugin::InfoSchemaTable::Rows::iterator iter;
172
173};
174
175#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H */
0176
=== added file 'plugin/info_schema_engine/info_schema_engine.cc'
--- plugin/info_schema_engine/info_schema_engine.cc 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/info_schema_engine.cc 2009-10-29 23:56:14 +0000
@@ -0,0 +1,195 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <drizzled/server_includes.h>
20#include <drizzled/show.h>
21#include "info_schema_engine.h"
22#include "info_schema_cursor.h"
23#include "open_tables.h"
24
25#include <string>
26#include <map>
27
28using namespace std;
29using namespace drizzled;
30
31static const string engine_name("INFORMATION_SCHEMA");
32
33int InfoSchemaEngine::getTableProtoImplementation(const char *path,
34 message::Table *table_proto)
35{
36 string table_name(path);
37 string i_s_prefix("./information_schema/");
38
39 if (table_name.compare(0, i_s_prefix.length(), i_s_prefix) != 0)
40 {
41 return ENOENT;
42 }
43
44 if (! table_proto)
45 {
46 return EEXIST;
47 }
48
49 table_name.erase(0, i_s_prefix.length());
50 plugin::InfoSchemaTable *schema_table= plugin::InfoSchemaTable::getTable(table_name.c_str());
51
52 if (! schema_table)
53 {
54 return ENOENT;
55 }
56
57 table_proto->set_name(table_name);
58 table_proto->set_type(message::Table::STANDARD);
59
60 message::Table::StorageEngine *protoengine= table_proto->mutable_engine();
61 protoengine->set_name(engine_name);
62
63 message::Table::TableOptions *table_options= table_proto->mutable_options();
64 table_options->set_collation_id(default_charset_info->number);
65 table_options->set_collation(default_charset_info->name);
66
67 const plugin::InfoSchemaTable::Columns &columns= schema_table->getColumns();
68 plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin();
69
70 while (iter != columns.end())
71 {
72 const plugin::ColumnInfo *column= *iter;
73 /* get the various proto variables we need */
74 message::Table::Field *proto_field= table_proto->add_field();
75 message::Table::Field::FieldOptions *field_options=
76 proto_field->mutable_options();
77 message::Table::Field::FieldConstraints *field_constraints=
78 proto_field->mutable_constraints();
79
80 proto_field->set_name(column->getName());
81 field_options->set_default_value("0");
82
83 if (column->getFlags() & MY_I_S_MAYBE_NULL)
84 {
85 field_options->set_default_null(true);
86 field_constraints->set_is_nullable(true);
87 }
88
89 if (column->getFlags() & MY_I_S_UNSIGNED)
90 {
91 field_constraints->set_is_unsigned(true);
92 }
93
94 switch(column->getType())
95 {
96 case DRIZZLE_TYPE_TINY:
97 case DRIZZLE_TYPE_LONG:
98 proto_field->set_type(message::Table::Field::INTEGER);
99 field_options->set_length(MAX_INT_WIDTH);
100 break;
101 case DRIZZLE_TYPE_DOUBLE:
102 proto_field->set_type(message::Table::Field::DOUBLE);
103 break;
104 case DRIZZLE_TYPE_NULL:
105 assert(true);
106 break;
107 case DRIZZLE_TYPE_TIMESTAMP:
108 proto_field->set_type(message::Table::Field::TIMESTAMP);
109 field_options->set_default_value("NOW()");
110 break;
111 case DRIZZLE_TYPE_LONGLONG:
112 proto_field->set_type(message::Table::Field::BIGINT);
113 field_options->set_length(MAX_BIGINT_WIDTH);
114 break;
115 case DRIZZLE_TYPE_DATETIME:
116 proto_field->set_type(message::Table::Field::DATETIME);
117 field_options->set_default_value("NOW()");
118 break;
119 case DRIZZLE_TYPE_DATE:
120 proto_field->set_type(message::Table::Field::DATE);
121 field_options->set_default_value("NOW()");
122 break;
123 case DRIZZLE_TYPE_VARCHAR:
124 {
125 message::Table::Field::StringFieldOptions *str_field_options=
126 proto_field->mutable_string_options();
127 proto_field->set_type(message::Table::Field::VARCHAR);
128 str_field_options->set_length(column->getLength());
129 field_options->set_length(column->getLength() * 4);
130 field_options->set_default_value("");
131 str_field_options->set_collation_id(default_charset_info->number);
132 str_field_options->set_collation(default_charset_info->name);
133 break;
134 }
135 case DRIZZLE_TYPE_NEWDECIMAL:
136 {
137 message::Table::Field::NumericFieldOptions *num_field_options=
138 proto_field->mutable_numeric_options();
139 proto_field->set_type(message::Table::Field::DECIMAL);
140 num_field_options->set_precision(column->getLength());
141 num_field_options->set_scale(column->getLength() % 10);
142 break;
143 }
144 default:
145 assert(true);
146 break;
147 }
148
149 ++iter;
150 }
151
152 return EEXIST;
153}
154
155static plugin::StorageEngine *info_schema_engine= NULL;
156
157static int init(plugin::Registry &registry)
158{
159 info_schema_engine= new(std::nothrow) InfoSchemaEngine(engine_name);
160 if (! info_schema_engine)
161 {
162 return true;
163 }
164
165 /* we are good to go */
166 registry.add(info_schema_engine);
167
168 return false;
169}
170
171static int deinit(plugin::Registry &registry)
172{
173 if (info_schema_engine)
174 {
175 registry.remove(info_schema_engine);
176 delete info_schema_engine;
177 }
178 return false;
179}
180
181drizzle_declare_plugin(info_schema_engine)
182{
183 "info_schema_engine",
184 "0.2",
185 "Padraig O'Sullivan",
186 "INFORMATION_SCHEMA Storage Engine",
187 PLUGIN_LICENSE_GPL,
188 init, /* Plugin Init */
189 deinit, /* Plugin Deinit */
190 NULL, /* status variables */
191 NULL, /* system variables */
192 NULL /* config options */
193}
194drizzle_declare_plugin_end;
195
0196
=== added file 'plugin/info_schema_engine/info_schema_engine.h'
--- plugin/info_schema_engine/info_schema_engine.h 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/info_schema_engine.h 2009-10-29 23:56:14 +0000
@@ -0,0 +1,91 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H
20#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H
21
22#include <drizzled/error.h>
23#include "info_schema_cursor.h"
24#include "table_name_iterator.h"
25
26#include <string>
27
28class InfoSchemaEngine : public drizzled::plugin::StorageEngine
29{
30public:
31
32 InfoSchemaEngine(const std::string &in_name)
33 :
34 drizzled::plugin::StorageEngine(in_name,
35 HTON_CREATE_NOT_SUPPORTED)
36 {}
37
38 ~InfoSchemaEngine() {}
39
40 virtual Cursor *create(TableShare *table,
41 MEM_ROOT *mem_root)
42 {
43 return new(mem_root) InfoSchemaCursor(this, table);
44 }
45
46 const char **bas_ext() const
47 {
48 return NULL;
49 }
50
51 int createTableImplementation(Session *,
52 const char *,
53 Table *,
54 HA_CREATE_INFO *,
55 drizzled::message::Table *)
56 {
57 my_error(ER_ILLEGAL_HA_CREATE_OPTION,
58 MYF(0),
59 drizzled::plugin::StorageEngine::resolveName(this).c_str(),
60 "CREATE TABLE");
61 return -1;
62 }
63
64 int deleteTableImplementation(Session *,
65 const std::string &table_path)
66 {
67 std::string i_s_prefix("./information_schema/");
68 if (table_path.compare(0, i_s_prefix.length(), i_s_prefix) == 0)
69 {
70 my_error(ER_DBACCESS_DENIED_ERROR,
71 MYF(0),
72 "",
73 "",
74 INFORMATION_SCHEMA_NAME.c_str());
75 return ER_DBACCESS_DENIED_ERROR;
76 }
77 return ENOENT;
78 }
79
80 int getTableProtoImplementation(const char *path,
81 drizzled::message::Table *table_proto);
82
83 drizzled::plugin::TableNameIteratorImplementation *tableNameIterator(const std::string &database)
84 {
85 return new InfoSchemaTableNameIterator(database);
86 }
87
88
89};
90
91#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H */
092
=== added file 'plugin/info_schema_engine/open_tables.cc'
--- plugin/info_schema_engine/open_tables.cc 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/open_tables.cc 2009-10-29 23:56:14 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <drizzled/server_includes.h>
20#include "info_schema_cursor.h"
21#include "open_tables.h"
22
23#include <string>
24#include <map>
25
26using namespace std;
27using namespace drizzled;
28
29InfoSchemaShare *OpenTables::getShare(const string &name)
30{
31 map<const string, InfoSchemaShare *>::iterator it;
32 pthread_mutex_lock(&mutex);
33
34 it= open_tables.find(name);
35 if (it != open_tables.end())
36 {
37 share= (*it).second;
38 }
39 else
40 {
41 share= NULL;
42 }
43
44 if (! share)
45 {
46 share= new(std::nothrow) InfoSchemaShare();
47 if (! share)
48 {
49 pthread_mutex_unlock(&mutex);
50 return NULL;
51 }
52 /* get the I_S table */
53 share->setInfoSchemaTable(name);
54 open_tables[name]= share;
55 share->initThreadLock();
56 }
57 share->incUseCount();
58 pthread_mutex_unlock(&mutex);
59
60 return share;
61}
62
63void OpenTables::freeShare()
64{
65 pthread_mutex_lock(&mutex);
66 share->decUseCount();
67 if (share->getUseCount() == 0)
68 {
69 open_tables.erase(share->getName());
70 }
71 pthread_mutex_unlock(&mutex);
72}
073
=== added file 'plugin/info_schema_engine/open_tables.h'
--- plugin/info_schema_engine/open_tables.h 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/open_tables.h 2009-10-29 23:56:14 +0000
@@ -0,0 +1,77 @@
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2009 Sun Microsystems
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H
21#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H
22
23#include "info_schema_cursor.h"
24
25#include <string>
26#include <vector>
27#include <map>
28
29/**
30 * @class OpenTables
31 *
32 * Class which tracks all the open tables for the I_S storage engine.
33 * Encapsulating this functionality in a class will make it easier for us to
34 * change things such as whether a std::map or HASH is used to lookup the
35 * open tables.
36 */
37class OpenTables
38{
39public:
40
41 static OpenTables &singleton()
42 {
43 static OpenTables open_tabs;
44 return open_tabs;
45 }
46
47 InfoSchemaShare *getShare(const std::string &name);
48
49 void freeShare();
50
51private:
52
53 pthread_mutex_t mutex;
54
55 std::map<const std::string, InfoSchemaShare *>
56 open_tables;
57
58 InfoSchemaShare *share;
59
60 OpenTables()
61 :
62 mutex(),
63 open_tables(),
64 share(NULL)
65 {
66 pthread_mutex_init(&mutex, MY_MUTEX_INIT_FAST);
67 }
68
69 ~OpenTables()
70 {
71 pthread_mutex_destroy(&mutex);
72 }
73
74 OpenTables(const OpenTables&);
75};
76
77#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H */
078
=== added file 'plugin/info_schema_engine/plugin.ini'
--- plugin/info_schema_engine/plugin.ini 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/plugin.ini 2009-10-29 23:56:17 +0000
@@ -0,0 +1,9 @@
1[plugin]
2name=info_schema_engine
3title=INFORMATION_SCHEMA Storage Engine
4description=Engine for INFORMATION_SCHEMA tables
5sources=info_schema_engine.cc info_schema_cursor.cc open_tables.cc
6 table_name_iterator.cc
7headers=info_schema_engine.h info_schema_cursor.h open_tables.h
8 table_name_iterator.h
9load_by_default= yes
010
=== added file 'plugin/info_schema_engine/table_name_iterator.cc'
--- plugin/info_schema_engine/table_name_iterator.cc 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/table_name_iterator.cc 2009-10-29 23:56:17 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <drizzled/server_includes.h>
20#include <drizzled/plugin/info_schema_table.h>
21#include <drizzled/plugin/storage_engine.h>
22#include "table_name_iterator.h"
23
24#include <string>
25
26using namespace std;
27using namespace drizzled;
28
29int InfoSchemaTableNameIterator::next(string *name)
30{
31start:
32 if (iter == all_schema_tables.end())
33 {
34 return -1;
35 }
36
37 plugin::InfoSchemaTable *table= *iter;
38
39 if (table->isHidden())
40 {
41 ++iter;
42 goto start;
43 }
44
45 if (name)
46 {
47 name->assign(table->getTableName());
48 }
49
50 ++iter;
51
52 return 0;
53}
054
=== added file 'plugin/info_schema_engine/table_name_iterator.h'
--- plugin/info_schema_engine/table_name_iterator.h 1970-01-01 00:00:00 +0000
+++ plugin/info_schema_engine/table_name_iterator.h 2009-10-29 23:56:17 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2009 Sun Microsystems
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H
20#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H
21
22#include <drizzled/plugin/info_schema_table.h>
23#include <drizzled/plugin/storage_engine.h>
24
25#include <vector>
26#include <string>
27
28class InfoSchemaTableNameIterator : public drizzled::plugin::TableNameIteratorImplementation
29{
30public:
31
32 InfoSchemaTableNameIterator(const std::string &database)
33 :
34 drizzled::plugin::TableNameIteratorImplementation(database)
35 {
36 /*
37 * If the database passed to the constructor is not the I_S database
38 * then we set the iterator to the end of the vector of schema tables to
39 * ensure that the next() method will not return any tables.
40 */
41 if (database.compare(INFORMATION_SCHEMA_NAME) == 0)
42 {
43 iter= drizzled::all_schema_tables.begin();
44 }
45 else
46 {
47 iter= drizzled::all_schema_tables.end();
48 }
49 }
50
51 ~InfoSchemaTableNameIterator() {}
52
53 int next(std::string *name);
54
55private:
56
57 std::vector<drizzled::plugin::InfoSchemaTable *>::iterator iter;
58
59};
60
61#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H */
062
=== modified file 'plugin/innobase/handler/ha_innodb.cc'
--- plugin/innobase/handler/ha_innodb.cc 2009-10-16 10:27:33 +0000
+++ plugin/innobase/handler/ha_innodb.cc 2009-10-29 23:56:17 +0000
@@ -376,7 +376,7 @@
376 UNIV_INTERN int renameTableImplementation(Session* session,376 UNIV_INTERN int renameTableImplementation(Session* session,
377 const char* from, 377 const char* from,
378 const char* to);378 const char* to);
379 UNIV_INTERN int deleteTableImplementation(Session* session, const string table_path);379 UNIV_INTERN int deleteTableImplementation(Session* session, const string &table_path);
380};380};
381381
382/** @brief Initialize the default value of innodb_commit_concurrency.382/** @brief Initialize the default value of innodb_commit_concurrency.
@@ -5959,7 +5959,7 @@
5959InnobaseEngine::deleteTableImplementation(5959InnobaseEngine::deleteTableImplementation(
5960/*======================*/5960/*======================*/
5961 Session *session,5961 Session *session,
5962 const string table_path) /* in: table name */5962 const string &table_path) /* in: table name */
5963{5963{
5964 int error;5964 int error;
5965 trx_t* parent_trx;5965 trx_t* parent_trx;
59665966
=== modified file 'plugin/innobase/handler/i_s.cc'
--- plugin/innobase/handler/i_s.cc 2009-10-13 16:18:59 +0000
+++ plugin/innobase/handler/i_s.cc 2009-10-29 23:56:17 +0000
@@ -112,7 +112,6 @@
112*/112*/
113113
114/* XXX these are defined in mysql_priv.h inside #ifdef DRIZZLE_SERVER */114/* XXX these are defined in mysql_priv.h inside #ifdef DRIZZLE_SERVER */
115bool schema_table_store_record(Session *session, Table *table);
116void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);115void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
117116
118/*******************************************************************//**117/*******************************************************************//**
@@ -205,8 +204,7 @@
205 DRIZZLE_TYPE_VARCHAR,204 DRIZZLE_TYPE_VARCHAR,
206 0,205 0,
207 0,206 0,
208 "",207 ""),
209 SKIP_OPEN_TABLE),
210208
211#define IDX_TRX_STATE 1209#define IDX_TRX_STATE 1
212 drizzled::plugin::ColumnInfo("trx_state",210 drizzled::plugin::ColumnInfo("trx_state",
@@ -214,8 +212,7 @@
214 DRIZZLE_TYPE_VARCHAR,212 DRIZZLE_TYPE_VARCHAR,
215 0,213 0,
216 0,214 0,
217 "",215 ""),
218 SKIP_OPEN_TABLE),
219216
220#define IDX_TRX_STARTED 2217#define IDX_TRX_STARTED 2
221 drizzled::plugin::ColumnInfo("trx_started",218 drizzled::plugin::ColumnInfo("trx_started",
@@ -223,8 +220,7 @@
223 DRIZZLE_TYPE_DATETIME,220 DRIZZLE_TYPE_DATETIME,
224 0,221 0,
225 0,222 0,
226 "",223 ""),
227 SKIP_OPEN_TABLE),
228224
229#define IDX_TRX_REQUESTED_LOCK_ID 3225#define IDX_TRX_REQUESTED_LOCK_ID 3
230 drizzled::plugin::ColumnInfo("trx_requested_lock_id",226 drizzled::plugin::ColumnInfo("trx_requested_lock_id",
@@ -232,8 +228,7 @@
232 DRIZZLE_TYPE_VARCHAR,228 DRIZZLE_TYPE_VARCHAR,
233 0,229 0,
234 MY_I_S_MAYBE_NULL,230 MY_I_S_MAYBE_NULL,
235 "",231 ""),
236 SKIP_OPEN_TABLE),
237232
238#define IDX_TRX_WAIT_STARTED 4233#define IDX_TRX_WAIT_STARTED 4
239 drizzled::plugin::ColumnInfo("trx_wait_started",234 drizzled::plugin::ColumnInfo("trx_wait_started",
@@ -241,8 +236,7 @@
241 DRIZZLE_TYPE_DATETIME,236 DRIZZLE_TYPE_DATETIME,
242 0,237 0,
243 MY_I_S_MAYBE_NULL,238 MY_I_S_MAYBE_NULL,
244 "",239 ""),
245 SKIP_OPEN_TABLE),
246240
247#define IDX_TRX_WEIGHT 5241#define IDX_TRX_WEIGHT 5
248 drizzled::plugin::ColumnInfo("trx_weight",242 drizzled::plugin::ColumnInfo("trx_weight",
@@ -250,8 +244,7 @@
250 DRIZZLE_TYPE_LONGLONG,244 DRIZZLE_TYPE_LONGLONG,
251 0,245 0,
252 MY_I_S_UNSIGNED,246 MY_I_S_UNSIGNED,
253 "",247 ""),
254 SKIP_OPEN_TABLE),
255248
256#define IDX_TRX_DRIZZLE_THREAD_ID 6249#define IDX_TRX_DRIZZLE_THREAD_ID 6
257 drizzled::plugin::ColumnInfo("trx_mysql_thread_id",250 drizzled::plugin::ColumnInfo("trx_mysql_thread_id",
@@ -259,8 +252,7 @@
259 DRIZZLE_TYPE_LONGLONG,252 DRIZZLE_TYPE_LONGLONG,
260 0,253 0,
261 MY_I_S_UNSIGNED,254 MY_I_S_UNSIGNED,
262 "",255 ""),
263 SKIP_OPEN_TABLE),
264256
265#define IDX_TRX_QUERY 7257#define IDX_TRX_QUERY 7
266 drizzled::plugin::ColumnInfo("trx_query",258 drizzled::plugin::ColumnInfo("trx_query",
@@ -268,8 +260,7 @@
268 DRIZZLE_TYPE_VARCHAR,260 DRIZZLE_TYPE_VARCHAR,
269 0,261 0,
270 MY_I_S_MAYBE_NULL,262 MY_I_S_MAYBE_NULL,
271 "",263 ""),
272 SKIP_OPEN_TABLE),
273264
274 drizzled::plugin::ColumnInfo()265 drizzled::plugin::ColumnInfo()
275};266};
@@ -283,8 +274,6 @@
283fill_innodb_trx_from_cache(274fill_innodb_trx_from_cache(
284/*=======================*/275/*=======================*/
285 trx_i_s_cache_t* cache, /*!< in: cache to read from */276 trx_i_s_cache_t* cache, /*!< in: cache to read from */
286 Session* session,/*!< in: used to call
287 schema_table_store_record() */
288 Table* table) /*!< in/out: fill this table */277 Table* table) /*!< in/out: fill this table */
289{278{
290 Field** fields;279 Field** fields;
@@ -351,7 +340,9 @@
351 OK(field_store_string(fields[IDX_TRX_QUERY],340 OK(field_store_string(fields[IDX_TRX_QUERY],
352 row->trx_query));341 row->trx_query));
353342
354 OK(schema_table_store_record(session, table));343 TableList *tmp_list= table->pos_in_table_list;
344 tmp_list->schema_table->addRow(table->record[0],
345 table->s->reclength);
355 }346 }
356347
357 return(0);348 return(0);
@@ -383,8 +374,7 @@
383 DRIZZLE_TYPE_VARCHAR,374 DRIZZLE_TYPE_VARCHAR,
384 0,375 0,
385 0,376 0,
386 "",377 ""),
387 SKIP_OPEN_TABLE),
388378
389#define IDX_LOCK_TRX_ID 1379#define IDX_LOCK_TRX_ID 1
390 drizzled::plugin::ColumnInfo("lock_trx_id",380 drizzled::plugin::ColumnInfo("lock_trx_id",
@@ -392,8 +382,7 @@
392 DRIZZLE_TYPE_VARCHAR,382 DRIZZLE_TYPE_VARCHAR,
393 0,383 0,
394 0,384 0,
395 "",385 ""),
396 SKIP_OPEN_TABLE),
397386
398#define IDX_LOCK_MODE 2387#define IDX_LOCK_MODE 2
399 drizzled::plugin::ColumnInfo("lock_mode",388 drizzled::plugin::ColumnInfo("lock_mode",
@@ -402,8 +391,7 @@
402 DRIZZLE_TYPE_VARCHAR,391 DRIZZLE_TYPE_VARCHAR,
403 0,392 0,
404 0,393 0,
405 "",394 ""),
406 SKIP_OPEN_TABLE),
407395
408#define IDX_LOCK_TYPE 3396#define IDX_LOCK_TYPE 3
409 drizzled::plugin::ColumnInfo("lock_type",397 drizzled::plugin::ColumnInfo("lock_type",
@@ -411,8 +399,7 @@
411 DRIZZLE_TYPE_VARCHAR,399 DRIZZLE_TYPE_VARCHAR,
412 0,400 0,
413 0,401 0,
414 "",402 ""),
415 SKIP_OPEN_TABLE),
416403
417#define IDX_LOCK_TABLE 4404#define IDX_LOCK_TABLE 4
418 drizzled::plugin::ColumnInfo("lock_table",405 drizzled::plugin::ColumnInfo("lock_table",
@@ -420,8 +407,7 @@
420 DRIZZLE_TYPE_VARCHAR,407 DRIZZLE_TYPE_VARCHAR,
421 0,408 0,
422 0,409 0,
423 "",410 ""),
424 SKIP_OPEN_TABLE),
425411
426#define IDX_LOCK_INDEX 5412#define IDX_LOCK_INDEX 5
427 drizzled::plugin::ColumnInfo("lock_index",413 drizzled::plugin::ColumnInfo("lock_index",
@@ -429,8 +415,7 @@
429 DRIZZLE_TYPE_VARCHAR,415 DRIZZLE_TYPE_VARCHAR,
430 0,416 0,
431 MY_I_S_MAYBE_NULL,417 MY_I_S_MAYBE_NULL,
432 "",418 ""),
433 SKIP_OPEN_TABLE),
434419
435#define IDX_LOCK_SPACE 6420#define IDX_LOCK_SPACE 6
436 drizzled::plugin::ColumnInfo("lock_space",421 drizzled::plugin::ColumnInfo("lock_space",
@@ -438,8 +423,7 @@
438 DRIZZLE_TYPE_LONGLONG,423 DRIZZLE_TYPE_LONGLONG,
439 0,424 0,
440 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,425 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
441 "",426 ""),
442 SKIP_OPEN_TABLE),
443427
444#define IDX_LOCK_PAGE 7428#define IDX_LOCK_PAGE 7
445 drizzled::plugin::ColumnInfo("lock_page",429 drizzled::plugin::ColumnInfo("lock_page",
@@ -447,8 +431,7 @@
447 DRIZZLE_TYPE_LONGLONG,431 DRIZZLE_TYPE_LONGLONG,
448 0,432 0,
449 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,433 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
450 "",434 ""),
451 SKIP_OPEN_TABLE),
452435
453#define IDX_LOCK_REC 8436#define IDX_LOCK_REC 8
454 drizzled::plugin::ColumnInfo("lock_rec",437 drizzled::plugin::ColumnInfo("lock_rec",
@@ -456,8 +439,7 @@
456 DRIZZLE_TYPE_LONGLONG,439 DRIZZLE_TYPE_LONGLONG,
457 0,440 0,
458 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,441 MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
459 "",442 ""),
460 SKIP_OPEN_TABLE),
461443
462#define IDX_LOCK_DATA 9444#define IDX_LOCK_DATA 9
463 drizzled::plugin::ColumnInfo("lock_data",445 drizzled::plugin::ColumnInfo("lock_data",
@@ -465,8 +447,7 @@
465 DRIZZLE_TYPE_VARCHAR,447 DRIZZLE_TYPE_VARCHAR,
466 0,448 0,
467 MY_I_S_MAYBE_NULL,449 MY_I_S_MAYBE_NULL,
468 "",450 ""),
469 SKIP_OPEN_TABLE),
470451
471 drizzled::plugin::ColumnInfo()452 drizzled::plugin::ColumnInfo()
472};453};
@@ -571,7 +552,9 @@
571 OK(field_store_string(fields[IDX_LOCK_DATA],552 OK(field_store_string(fields[IDX_LOCK_DATA],
572 row->lock_data));553 row->lock_data));
573554
574 OK(schema_table_store_record(session, table));555 TableList *tmp_list= table->pos_in_table_list;
556 tmp_list->schema_table->addRow(table->record[0],
557 table->s->reclength);
575 }558 }
576559
577 return(0);560 return(0);
@@ -603,8 +586,7 @@
603 DRIZZLE_TYPE_VARCHAR,586 DRIZZLE_TYPE_VARCHAR,
604 0,587 0,
605 0,588 0,
606 "",589 ""),
607 SKIP_OPEN_TABLE),
608590
609#define IDX_REQUESTED_LOCK_ID 1591#define IDX_REQUESTED_LOCK_ID 1
610 drizzled::plugin::ColumnInfo("requested_lock_id",592 drizzled::plugin::ColumnInfo("requested_lock_id",
@@ -612,8 +594,7 @@
612 DRIZZLE_TYPE_VARCHAR,594 DRIZZLE_TYPE_VARCHAR,
613 0,595 0,
614 0,596 0,
615 "",597 ""),
616 SKIP_OPEN_TABLE),
617598
618#define IDX_BLOCKING_TRX_ID 2599#define IDX_BLOCKING_TRX_ID 2
619 drizzled::plugin::ColumnInfo("blocking_trx_id",600 drizzled::plugin::ColumnInfo("blocking_trx_id",
@@ -621,8 +602,7 @@
621 DRIZZLE_TYPE_VARCHAR,602 DRIZZLE_TYPE_VARCHAR,
622 0,603 0,
623 0,604 0,
624 "",605 ""),
625 SKIP_OPEN_TABLE),
626606
627#define IDX_BLOCKING_LOCK_ID 3607#define IDX_BLOCKING_LOCK_ID 3
628 drizzled::plugin::ColumnInfo("blocking_lock_id",608 drizzled::plugin::ColumnInfo("blocking_lock_id",
@@ -630,8 +610,7 @@
630 DRIZZLE_TYPE_VARCHAR,610 DRIZZLE_TYPE_VARCHAR,
631 0,611 0,
632 0,612 0,
633 "",613 ""),
634 SKIP_OPEN_TABLE),
635614
636 drizzled::plugin::ColumnInfo()615 drizzled::plugin::ColumnInfo()
637};616};
@@ -645,8 +624,6 @@
645fill_innodb_lock_waits_from_cache(624fill_innodb_lock_waits_from_cache(
646/*==============================*/625/*==============================*/
647 trx_i_s_cache_t* cache, /*!< in: cache to read from */626 trx_i_s_cache_t* cache, /*!< in: cache to read from */
648 Session* session,/*!< in: used to call
649 schema_table_store_record() */
650 Table* table) /*!< in/out: fill this table */627 Table* table) /*!< in/out: fill this table */
651{628{
652 Field** fields;629 Field** fields;
@@ -699,7 +676,9 @@
699 blocking_lock_id,676 blocking_lock_id,
700 sizeof(blocking_lock_id))));677 sizeof(blocking_lock_id))));
701678
702 OK(schema_table_store_record(session, table));679 TableList *tmp_list= table->pos_in_table_list;
680 tmp_list->schema_table->addRow(table->record[0],
681 table->s->reclength);
703 }682 }
704683
705 return(0);684 return(0);
@@ -734,8 +713,7 @@
734TrxISMethods::fillTable(713TrxISMethods::fillTable(
735/*======================*/714/*======================*/
736 Session* session,/*!< in: thread */715 Session* session,/*!< in: thread */
737 TableList* tables, /*!< in/out: tables to fill */716 TableList* tables) /*!< in/out: tables to fill */
738 COND* ) /*!< in: condition (not used) */
739{717{
740 const char* table_name;718 const char* table_name;
741 int ret;719 int ret;
@@ -771,7 +749,7 @@
771 if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {749 if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {
772750
773 if (fill_innodb_trx_from_cache(751 if (fill_innodb_trx_from_cache(
774 cache, session, tables->table) != 0) {752 cache, tables->table) != 0) {
775753
776 ret = 1;754 ret = 1;
777 }755 }
@@ -787,7 +765,7 @@
787 } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {765 } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {
788766
789 if (fill_innodb_lock_waits_from_cache(767 if (fill_innodb_lock_waits_from_cache(
790 cache, session, tables->table) != 0) {768 cache, tables->table) != 0) {
791769
792 ret = 1;770 ret = 1;
793 }771 }
@@ -826,48 +804,42 @@
826 DRIZZLE_TYPE_LONG,804 DRIZZLE_TYPE_LONG,
827 0,805 0,
828 0,806 0,
829 "Compressed Page Size",807 "Compressed Page Size"),
830 SKIP_OPEN_TABLE),
831808
832 drizzled::plugin::ColumnInfo("compress_ops",809 drizzled::plugin::ColumnInfo("compress_ops",
833 MY_INT32_NUM_DECIMAL_DIGITS,810 MY_INT32_NUM_DECIMAL_DIGITS,
834 DRIZZLE_TYPE_LONG,811 DRIZZLE_TYPE_LONG,
835 0,812 0,
836 0,813 0,
837 "Total Number of Compressions",814 "Total Number of Compressions"),
838 SKIP_OPEN_TABLE),
839815
840 drizzled::plugin::ColumnInfo("compress_ops_ok",816 drizzled::plugin::ColumnInfo("compress_ops_ok",
841 MY_INT32_NUM_DECIMAL_DIGITS,817 MY_INT32_NUM_DECIMAL_DIGITS,
842 DRIZZLE_TYPE_LONG,818 DRIZZLE_TYPE_LONG,
843 0,819 0,
844 0,820 0,
845 "Total Number of Successful Compressions",821 "Total Number of Successful Compressions"),
846 SKIP_OPEN_TABLE),
847822
848 drizzled::plugin::ColumnInfo("compress_time",823 drizzled::plugin::ColumnInfo("compress_time",
849 MY_INT32_NUM_DECIMAL_DIGITS,824 MY_INT32_NUM_DECIMAL_DIGITS,
850 DRIZZLE_TYPE_LONG,825 DRIZZLE_TYPE_LONG,
851 0,826 0,
852 0,827 0,
853 "Total Duration of Compressions in Seconds",828 "Total Duration of Compressions in Seconds"),
854 SKIP_OPEN_TABLE),
855829
856 drizzled::plugin::ColumnInfo("uncompress_ops",830 drizzled::plugin::ColumnInfo("uncompress_ops",
857 MY_INT32_NUM_DECIMAL_DIGITS,831 MY_INT32_NUM_DECIMAL_DIGITS,
858 DRIZZLE_TYPE_LONG,832 DRIZZLE_TYPE_LONG,
859 0,833 0,
860 0,834 0,
861 "Total Number of Decompressions",835 "Total Number of Decompressions"),
862 SKIP_OPEN_TABLE),
863836
864 drizzled::plugin::ColumnInfo("uncompress_time",837 drizzled::plugin::ColumnInfo("uncompress_time",
865 MY_INT32_NUM_DECIMAL_DIGITS,838 MY_INT32_NUM_DECIMAL_DIGITS,
866 DRIZZLE_TYPE_LONG,839 DRIZZLE_TYPE_LONG,
867 0,840 0,
868 0,841 0,
869 "Total Duration of Decompressions in Seconds",842 "Total Duration of Decompressions in Seconds"),
870 SKIP_OPEN_TABLE),
871843
872 drizzled::plugin::ColumnInfo()844 drizzled::plugin::ColumnInfo()
873};845};
@@ -883,7 +855,6 @@
883/*=============*/855/*=============*/
884 Session* session,/*!< in: thread */856 Session* session,/*!< in: thread */
885 TableList* tables, /*!< in/out: tables to fill */857 TableList* tables, /*!< in/out: tables to fill */
886 COND* , /*!< in: condition (ignored) */
887 ibool reset) /*!< in: TRUE=reset cumulated counts */858 ibool reset) /*!< in: TRUE=reset cumulated counts */
888{859{
889 Table* table = (Table *) tables->table;860 Table* table = (Table *) tables->table;
@@ -915,10 +886,9 @@
915 memset(zip_stat, 0, sizeof *zip_stat);886 memset(zip_stat, 0, sizeof *zip_stat);
916 }887 }
917888
918 if (schema_table_store_record(session, table)) {889 TableList *tmp_list= table->pos_in_table_list;
919 status = 1;890 tmp_list->schema_table->addRow(table->record[0],
920 break;891 table->s->reclength);
921 }
922 }892 }
923893
924 return(status);894 return(status);
@@ -931,10 +901,9 @@
931CmpISMethods::fillTable(901CmpISMethods::fillTable(
932/*=========*/902/*=========*/
933 Session* session,/*!< in: thread */903 Session* session,/*!< in: thread */
934 TableList* tables, /*!< in/out: tables to fill */904 TableList* tables) /*!< in/out: tables to fill */
935 COND* cond) /*!< in: condition (ignored) */
936{905{
937 return(i_s_cmp_fill_low(session, tables, cond, FALSE));906 return(i_s_cmp_fill_low(session, tables, FALSE));
938}907}
939908
940/*******************************************************************//**909/*******************************************************************//**
@@ -944,10 +913,9 @@
944CmpResetISMethods::fillTable(913CmpResetISMethods::fillTable(
945/*===============*/914/*===============*/
946 Session* session,/*!< in: thread */915 Session* session,/*!< in: thread */
947 TableList* tables, /*!< in/out: tables to fill */916 TableList* tables) /*!< in/out: tables to fill */
948 COND* cond) /*!< in: condition (ignored) */
949{917{
950 return(i_s_cmp_fill_low(session, tables, cond, TRUE));918 return(i_s_cmp_fill_low(session, tables, TRUE));
951}919}
952920
953/*******************************************************************//**921/*******************************************************************//**
@@ -994,40 +962,35 @@
994 DRIZZLE_TYPE_LONG,962 DRIZZLE_TYPE_LONG,
995 0,963 0,
996 0,964 0,
997 "Buddy Block Size",965 "Buddy Block Size"),
998 SKIP_OPEN_TABLE),
999966
1000 drizzled::plugin::ColumnInfo("pages_used",967 drizzled::plugin::ColumnInfo("pages_used",
1001 MY_INT32_NUM_DECIMAL_DIGITS,968 MY_INT32_NUM_DECIMAL_DIGITS,
1002 DRIZZLE_TYPE_LONG,969 DRIZZLE_TYPE_LONG,
1003 0,970 0,
1004 0,971 0,
1005 "Currently in Use",972 "Currently in Use"),
1006 SKIP_OPEN_TABLE),
1007973
1008 drizzled::plugin::ColumnInfo("pages_free",974 drizzled::plugin::ColumnInfo("pages_free",
1009 MY_INT32_NUM_DECIMAL_DIGITS,975 MY_INT32_NUM_DECIMAL_DIGITS,
1010 DRIZZLE_TYPE_LONG,976 DRIZZLE_TYPE_LONG,
1011 0,977 0,
1012 0,978 0,
1013 "Currently Available",979 "Currently Available"),
1014 SKIP_OPEN_TABLE),
1015980
1016 drizzled::plugin::ColumnInfo("relocation_ops",981 drizzled::plugin::ColumnInfo("relocation_ops",
1017 MY_INT64_NUM_DECIMAL_DIGITS,982 MY_INT64_NUM_DECIMAL_DIGITS,
1018 DRIZZLE_TYPE_LONGLONG,983 DRIZZLE_TYPE_LONGLONG,
1019 0,984 0,
1020 0,985 0,
1021 "Total Number of Relocations",986 "Total Number of Relocations"),
1022 SKIP_OPEN_TABLE),
1023987
1024 drizzled::plugin::ColumnInfo("relocation_time",988 drizzled::plugin::ColumnInfo("relocation_time",
1025 MY_INT32_NUM_DECIMAL_DIGITS,989 MY_INT32_NUM_DECIMAL_DIGITS,
1026 DRIZZLE_TYPE_LONG,990 DRIZZLE_TYPE_LONG,
1027 0,991 0,
1028 0,992 0,
1029 "Total Duration of Relocations, in Seconds",993 "Total Duration of Relocations, in Seconds"),
1030 SKIP_OPEN_TABLE),
1031994
1032 drizzled::plugin::ColumnInfo()995 drizzled::plugin::ColumnInfo()
1033};996};
@@ -1042,7 +1005,6 @@
1042/*================*/1005/*================*/
1043 Session* session,/*!< in: thread */1006 Session* session,/*!< in: thread */
1044 TableList* tables, /*!< in/out: tables to fill */1007 TableList* tables, /*!< in/out: tables to fill */
1045 COND* , /*!< in: condition (ignored) */
1046 ibool reset) /*!< in: TRUE=reset cumulated counts */1008 ibool reset) /*!< in: TRUE=reset cumulated counts */
1047{1009{
1048 Table* table = (Table *) tables->table;1010 Table* table = (Table *) tables->table;
@@ -1070,10 +1032,9 @@
1070 buddy_stat->relocated_usec = 0;1032 buddy_stat->relocated_usec = 0;
1071 }1033 }
10721034
1073 if (schema_table_store_record(session, table)) {1035 TableList *tmp_list= table->pos_in_table_list;
1074 status = 1;1036 tmp_list->schema_table->addRow(table->record[0],
1075 break;1037 table->s->reclength);
1076 }
1077 }1038 }
10781039
1079 buf_pool_mutex_exit();1040 buf_pool_mutex_exit();
@@ -1087,10 +1048,9 @@
1087CmpmemISMethods::fillTable(1048CmpmemISMethods::fillTable(
1088/*============*/1049/*============*/
1089 Session* session,/*!< in: thread */1050 Session* session,/*!< in: thread */
1090 TableList* tables, /*!< in/out: tables to fill */1051 TableList* tables) /*!< in/out: tables to fill */
1091 COND* cond) /*!< in: condition (ignored) */
1092{1052{
1093 return(i_s_cmpmem_fill_low(session, tables, cond, FALSE));1053 return(i_s_cmpmem_fill_low(session, tables, FALSE));
1094}1054}
10951055
1096/*******************************************************************//**1056/*******************************************************************//**
@@ -1100,10 +1060,9 @@
1100CmpmemResetISMethods::fillTable(1060CmpmemResetISMethods::fillTable(
1101/*==================*/1061/*==================*/
1102 Session* session,/*!< in: thread */1062 Session* session,/*!< in: thread */
1103 TableList* tables, /*!< in/out: tables to fill */1063 TableList* tables) /*!< in/out: tables to fill */
1104 COND* cond) /*!< in: condition (ignored) */
1105{1064{
1106 return(i_s_cmpmem_fill_low(session, tables, cond, TRUE));1065 return(i_s_cmpmem_fill_low(session, tables, TRUE));
1107}1066}
11081067
1109/*******************************************************************//**1068/*******************************************************************//**
11101069
=== modified file 'plugin/innobase/handler/i_s.h'
--- plugin/innobase/handler/i_s.h 2009-10-13 06:36:19 +0000
+++ plugin/innobase/handler/i_s.h 2009-10-29 23:56:17 +0000
@@ -30,48 +30,42 @@
30{30{
31public:31public:
32 virtual int fillTable(Session *session,32 virtual int fillTable(Session *session,
33 TableList *tables,33 TableList *tables);
34 COND *cond);
35};34};
3635
37class LocksISMethods : public drizzled::plugin::InfoSchemaMethods36class LocksISMethods : public drizzled::plugin::InfoSchemaMethods
38{37{
39public:38public:
40 virtual int fillTable(Session *session,39 virtual int fillTable(Session *session,
41 TableList *tables,40 TableList *tables);
42 COND *cond);
43};41};
4442
45class CmpISMethods : public drizzled::plugin::InfoSchemaMethods43class CmpISMethods : public drizzled::plugin::InfoSchemaMethods
46{44{
47public:45public:
48 virtual int fillTable(Session *session,46 virtual int fillTable(Session *session,
49 TableList *tables,47 TableList *tables);
50 COND *cond);
51};48};
5249
53class CmpResetISMethods : public drizzled::plugin::InfoSchemaMethods50class CmpResetISMethods : public drizzled::plugin::InfoSchemaMethods
54{51{
55public:52public:
56 virtual int fillTable(Session *session,53 virtual int fillTable(Session *session,
57 TableList *tables,54 TableList *tables);
58 COND *cond);
59};55};
6056
61class CmpmemISMethods : public drizzled::plugin::InfoSchemaMethods57class CmpmemISMethods : public drizzled::plugin::InfoSchemaMethods
62{58{
63public:59public:
64 virtual int fillTable(Session *session,60 virtual int fillTable(Session *session,
65 TableList *tables,61 TableList *tables);
66 COND *cond);
67};62};
6863
69class CmpmemResetISMethods : public drizzled::plugin::InfoSchemaMethods64class CmpmemResetISMethods : public drizzled::plugin::InfoSchemaMethods
70{65{
71public:66public:
72 virtual int fillTable(Session *session,67 virtual int fillTable(Session *session,
73 TableList *tables,68 TableList *tables);
74 COND *cond);
75};69};
7670
77int i_s_common_deinit(drizzled::plugin::Registry &registry);71int i_s_common_deinit(drizzled::plugin::Registry &registry);
7872
=== modified file 'plugin/memcached_stats/analysis_table.cc'
--- plugin/memcached_stats/analysis_table.cc 2009-10-03 17:20:06 +0000
+++ plugin/memcached_stats/analysis_table.cc 2009-10-29 23:56:17 +0000
@@ -42,9 +42,8 @@
42using namespace std;42using namespace std;
43using namespace drizzled;43using namespace drizzled;
4444
45int MemcachedAnalysisISMethods::fillTable(Session *session,45int MemcachedAnalysisISMethods::fillTable(Session *,
46 TableList *tables,46 TableList *tables)
47 COND *)
48{47{
49 const CHARSET_INFO * const scs= system_charset_info;48 const CHARSET_INFO * const scs= system_charset_info;
50 Table *table= tables->table;49 Table *table= tables->table;
@@ -88,10 +87,8 @@
88 table->field[8]->store(report->pool_hit_ratio);87 table->field[8]->store(report->pool_hit_ratio);
8988
90 /* store the actual record now */89 /* store the actual record now */
91 if (schema_table_store_record(session, table))90 TableList *tmp_list= table->pos_in_table_list;
92 {91 tmp_list->schema_table->addRow(table->record[0], table->s->reclength);
93 return 1;
94 }
95 free(report);92 free(report);
96 }93 }
9794
@@ -110,8 +107,7 @@
110 DRIZZLE_TYPE_LONGLONG,107 DRIZZLE_TYPE_LONGLONG,
111 0,108 0,
112 0, 109 0,
113 "Num of Servers Analyzed",
114 SKIP_OPEN_TABLE);
The diff has been truncated for viewing.