Merge lp:~posulliv/drizzle/info-schema-storage-engine into lp:~drizzle-trunk/drizzle/development
- info-schema-storage-engine
- Merge into development
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brian Aker | Pending | ||
Review via email: mp+13549@code.launchpad.net |
Commit message
Description of the change
Padraig O'Sullivan (posulliv) wrote : | # |
Jay Pipes (jaypipes) wrote : | # |
Hi Padraig!
A few comments and questions... :)
1) Per our IRC conversation, you should put back the ASSERT_
2) What was the reasoning behind this change?
8 -#define PROCESS_
9 +#define PROCESS_
3) When I saw this removed from drizzled/join.cc:
92 - if ((this-
93 - return;
94 -
and this removed from drizzled/
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-
1077 - {
1078 - if (mysql_
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_
243 + InfoSchemaRecord tmp_rec(buf, len);
244 + rows.push_
245 + }
Also, rows is defined as std::vector<
void addRow(unsigned char *buf, size_t len)
{
InfoSchemaRecord *record= new InfoSchemaRecor
rows.
}
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_
435 - table, res, db_name,
436 + error= test(schema_
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-
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-
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...
- 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<
InfoSchemaRecor d>
to vector<InfoSchemaRecor d *>. 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..)
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<
InfoSchemaRecor d>
to vector<InfoSchemaRecor d *>. 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
1 | === modified file 'drizzled/definitions.h' |
2 | --- drizzled/definitions.h 2009-10-21 00:14:57 +0000 |
3 | +++ drizzled/definitions.h 2009-10-29 23:56:13 +0000 |
4 | @@ -226,7 +226,7 @@ |
5 | /** Characters shown for the command in 'show processlist'. */ |
6 | #define PROCESS_LIST_WIDTH 100 |
7 | /* Characters shown for the command in 'information_schema.processlist' */ |
8 | -#define PROCESS_LIST_INFO_WIDTH 65535 |
9 | +#define PROCESS_LIST_INFO_WIDTH 16383 |
10 | |
11 | #define PRECISION_FOR_DOUBLE 53 |
12 | #define PRECISION_FOR_FLOAT 24 |
13 | @@ -527,10 +527,6 @@ |
14 | #define MY_I_S_UNSIGNED 2 |
15 | |
16 | |
17 | -#define SKIP_OPEN_TABLE 0 // do not open table |
18 | -#define OPEN_FRM_ONLY 1 // open FRM file only |
19 | -#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files |
20 | - |
21 | /* |
22 | "Declared Type Collation" |
23 | A combination of collation and its derivation. |
24 | |
25 | === modified file 'drizzled/field/int64_t.cc' |
26 | --- drizzled/field/int64_t.cc 2009-07-10 00:01:50 +0000 |
27 | +++ drizzled/field/int64_t.cc 2009-10-29 23:56:14 +0000 |
28 | @@ -40,7 +40,7 @@ |
29 | char *end; |
30 | uint64_t tmp; |
31 | |
32 | - ASSERT_COLUMN_MARKED_FOR_WRITE; |
33 | + //ASSERT_COLUMN_MARKED_FOR_WRITE; |
34 | |
35 | tmp= cs->cset->strntoull10rnd(cs, from, len, false, &end,&error); |
36 | if (error == MY_ERRNO_ERANGE) |
37 | @@ -70,7 +70,7 @@ |
38 | int error= 0; |
39 | int64_t res; |
40 | |
41 | - ASSERT_COLUMN_MARKED_FOR_WRITE; |
42 | + //ASSERT_COLUMN_MARKED_FOR_WRITE; |
43 | |
44 | nr= rint(nr); |
45 | |
46 | @@ -106,7 +106,7 @@ |
47 | { |
48 | int error= 0; |
49 | |
50 | - ASSERT_COLUMN_MARKED_FOR_WRITE; |
51 | + //ASSERT_COLUMN_MARKED_FOR_WRITE; |
52 | |
53 | #ifdef WORDS_BIGENDIAN |
54 | if (table->s->db_low_byte_first) |
55 | @@ -124,7 +124,7 @@ |
56 | { |
57 | int64_t j; |
58 | |
59 | - ASSERT_COLUMN_MARKED_FOR_READ; |
60 | + //ASSERT_COLUMN_MARKED_FOR_READ; |
61 | |
62 | #ifdef WORDS_BIGENDIAN |
63 | if (table->s->db_low_byte_first) |
64 | @@ -143,7 +143,7 @@ |
65 | { |
66 | int64_t j; |
67 | |
68 | - ASSERT_COLUMN_MARKED_FOR_READ; |
69 | + //ASSERT_COLUMN_MARKED_FOR_READ; |
70 | |
71 | #ifdef WORDS_BIGENDIAN |
72 | if (table->s->db_low_byte_first) |
73 | @@ -165,7 +165,7 @@ |
74 | char *to=(char*) val_buffer->ptr(); |
75 | int64_t j; |
76 | |
77 | - ASSERT_COLUMN_MARKED_FOR_READ; |
78 | + //ASSERT_COLUMN_MARKED_FOR_READ; |
79 | |
80 | #ifdef WORDS_BIGENDIAN |
81 | if (table->s->db_low_byte_first) |
82 | |
83 | === modified file 'drizzled/field/long.cc' |
84 | --- drizzled/field/long.cc 2009-07-10 00:01:50 +0000 |
85 | +++ drizzled/field/long.cc 2009-10-29 23:56:14 +0000 |
86 | @@ -62,7 +62,7 @@ |
87 | int32_t res; |
88 | nr=rint(nr); |
89 | |
90 | - ASSERT_COLUMN_MARKED_FOR_WRITE; |
91 | + //ASSERT_COLUMN_MARKED_FOR_WRITE; |
92 | |
93 | if (nr < (double) INT32_MIN) |
94 | { |
95 | |
96 | === modified file 'drizzled/join.cc' |
97 | --- drizzled/join.cc 2009-10-06 19:51:49 +0000 |
98 | +++ drizzled/join.cc 2009-10-29 23:56:13 +0000 |
99 | @@ -1245,9 +1245,6 @@ |
100 | return; |
101 | } |
102 | |
103 | - if ((this->select_lex->options & OPTION_SCHEMA_TABLE) && get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC)) |
104 | - return; |
105 | - |
106 | if (select_options & SELECT_DESCRIBE) |
107 | { |
108 | /* |
109 | |
110 | === modified file 'drizzled/plugin/info_schema_table.h' |
111 | --- drizzled/plugin/info_schema_table.h 2009-10-06 19:14:39 +0000 |
112 | +++ drizzled/plugin/info_schema_table.h 2009-10-29 23:56:14 +0000 |
113 | @@ -25,6 +25,9 @@ |
114 | |
115 | namespace drizzled |
116 | { |
117 | + |
118 | +extern std::vector<plugin::InfoSchemaTable *> all_schema_tables; |
119 | + |
120 | namespace plugin |
121 | { |
122 | |
123 | @@ -35,9 +38,6 @@ |
124 | * Header file which contains all classes related to I_S |
125 | */ |
126 | |
127 | -typedef class Item COND; |
128 | - |
129 | - |
130 | /** |
131 | * @class ColumnInfo |
132 | * @brief |
133 | @@ -51,16 +51,14 @@ |
134 | enum enum_field_types in_type, |
135 | int32_t in_value, |
136 | uint32_t in_flags, |
137 | - const std::string& in_old_name, |
138 | - uint32_t in_open_method) |
139 | + const std::string& in_old_name) |
140 | : |
141 | name(in_name), |
142 | length(in_length), |
143 | type(in_type), |
144 | value(in_value), |
145 | flags(in_flags), |
146 | - old_name(in_old_name), |
147 | - open_method(in_open_method) |
148 | + old_name(in_old_name) |
149 | {} |
150 | |
151 | ColumnInfo() |
152 | @@ -69,8 +67,7 @@ |
153 | length(0), |
154 | type(DRIZZLE_TYPE_VARCHAR), |
155 | flags(0), |
156 | - old_name(), |
157 | - open_method(SKIP_OPEN_TABLE) |
158 | + old_name() |
159 | {} |
160 | |
161 | /** |
162 | @@ -97,14 +94,6 @@ |
163 | } |
164 | |
165 | /** |
166 | - * @return the open method for this column. |
167 | - */ |
168 | - uint32_t getOpenMethod() const |
169 | - { |
170 | - return open_method; |
171 | - } |
172 | - |
173 | - /** |
174 | * @return the flags for this column. |
175 | */ |
176 | uint32_t getFlags() const |
177 | @@ -174,12 +163,6 @@ |
178 | */ |
179 | const std::string old_name; |
180 | |
181 | - /** |
182 | - * This should be one of @c SKIP_OPEN_TABLE, |
183 | - * @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE. |
184 | - */ |
185 | - uint32_t open_method; |
186 | - |
187 | }; |
188 | |
189 | /** |
190 | @@ -192,18 +175,72 @@ |
191 | public: |
192 | virtual ~InfoSchemaMethods() {} |
193 | |
194 | - virtual Table *createSchemaTable(Session *session, |
195 | - TableList *table_list) const; |
196 | virtual int fillTable(Session *session, |
197 | - TableList *tables, |
198 | - COND *cond); |
199 | - virtual int processTable(Session *session, TableList *tables, |
200 | + TableList *tables); |
201 | + virtual int processTable(InfoSchemaTable *store_table, |
202 | + Session *session, TableList *tables, |
203 | Table *table, bool res, LEX_STRING *db_name, |
204 | - LEX_STRING *table_name) const; |
205 | + LEX_STRING *table_name); |
206 | virtual int oldFormat(Session *session, |
207 | InfoSchemaTable *schema_table) const; |
208 | }; |
209 | |
210 | +class InfoSchemaRecord |
211 | +{ |
212 | +public: |
213 | + InfoSchemaRecord() |
214 | + : |
215 | + record(NULL), |
216 | + rec_len(0) |
217 | + {} |
218 | + |
219 | + InfoSchemaRecord(unsigned char *buf, |
220 | + size_t in_len) |
221 | + : |
222 | + record(NULL), |
223 | + rec_len(in_len) |
224 | + { |
225 | + record= new unsigned char[rec_len]; |
226 | + memcpy(record, buf, rec_len); |
227 | + } |
228 | + |
229 | + InfoSchemaRecord(const InfoSchemaRecord &rhs) |
230 | + : |
231 | + record(NULL), |
232 | + rec_len(rhs.rec_len) |
233 | + { |
234 | + record= new unsigned char[rec_len]; |
235 | + memcpy(record, rhs.record, rec_len); |
236 | + } |
237 | + |
238 | + ~InfoSchemaRecord() |
239 | + { |
240 | + if (record) |
241 | + { |
242 | + delete [] record; |
243 | + } |
244 | + } |
245 | + |
246 | + void copyRecordInto(unsigned char *buf) |
247 | + { |
248 | + memcpy(buf, record, rec_len); |
249 | + } |
250 | + |
251 | +private: |
252 | + unsigned char *record; |
253 | + size_t rec_len; |
254 | +}; |
255 | + |
256 | +class DeleteRows |
257 | +{ |
258 | +public: |
259 | + template<typename T> |
260 | + inline void operator()(const T *ptr) const |
261 | + { |
262 | + delete ptr; |
263 | + } |
264 | +}; |
265 | + |
266 | /** |
267 | * @class InfoSchemaTable |
268 | * @brief |
269 | @@ -217,6 +254,7 @@ |
270 | public: |
271 | |
272 | typedef std::vector<const ColumnInfo *> Columns; |
273 | + typedef std::vector<InfoSchemaRecord *> Rows; |
274 | |
275 | InfoSchemaTable(const std::string& tab_name, |
276 | Columns& in_column_info, |
277 | @@ -234,6 +272,7 @@ |
278 | second_column_index(idx_col2), |
279 | requested_object(req_object), |
280 | column_info(in_column_info), |
281 | + rows(), |
282 | i_s_methods(in_methods) |
283 | {} |
284 | |
285 | @@ -246,11 +285,17 @@ |
286 | second_column_index(0), |
287 | requested_object(0), |
288 | column_info(), |
289 | + rows(), |
290 | i_s_methods(NULL) |
291 | {} |
292 | |
293 | virtual ~InfoSchemaTable() |
294 | - {} |
295 | + { |
296 | + /* de-allocate memory in the rows */ |
297 | + for_each(rows.begin(), |
298 | + rows.end(), |
299 | + DeleteRows()); |
300 | + } |
301 | |
302 | /** |
303 | * Set the methods available on this I_S table. |
304 | @@ -262,31 +307,15 @@ |
305 | } |
306 | |
307 | /** |
308 | - * Create the temporary I_S tables using schema_table data. |
309 | - * |
310 | - * @param[in] session a session handler |
311 | - * @param[in] table_list Used to pass I_S table information (fields, |
312 | - * tables, parameters, etc.) and table name |
313 | - * @retval \# pointer to created table |
314 | - * @retval NULL Can't create table |
315 | - */ |
316 | - Table *createSchemaTable(Session *session, TableList *table_list) const |
317 | - { |
318 | - Table *retval= i_s_methods->createSchemaTable(session, table_list); |
319 | - return retval; |
320 | - } |
321 | - |
322 | - /** |
323 | * Fill I_S table. |
324 | * |
325 | * @param[in] session a session handler |
326 | * @param[in] tables I_S table |
327 | - * @param[in] cond 'WHERE' condition |
328 | * @return 0 on success; 1 on error |
329 | */ |
330 | - int fillTable(Session *session, TableList *tables, COND *cond) |
331 | + int fillTable(Session *session, TableList *tables) |
332 | { |
333 | - int retval= i_s_methods->fillTable(session, tables, cond); |
334 | + int retval= i_s_methods->fillTable(session, tables); |
335 | return retval; |
336 | } |
337 | |
338 | @@ -295,7 +324,6 @@ |
339 | * |
340 | * @param[in] session a session handler |
341 | * @param[in] tables table list (processed table) |
342 | - * @param[in] table I_S table |
343 | * @param[in] res 1 means error during opening of the processed table |
344 | * 0 means processed table opened without error |
345 | * @param[in] db_name database name |
346 | @@ -303,9 +331,9 @@ |
347 | * @return 0 on success; 1 on error |
348 | */ |
349 | int processTable(Session *session, TableList *tables, Table *table, |
350 | - bool res, LEX_STRING *db_name, LEX_STRING *tab_name) const |
351 | + bool res, LEX_STRING *db_name, LEX_STRING *tab_name) |
352 | { |
353 | - int retval= i_s_methods->processTable(session, tables, table, |
354 | + int retval= i_s_methods->processTable(this, session, tables, table, |
355 | res, db_name, tab_name); |
356 | return retval; |
357 | } |
358 | @@ -410,6 +438,19 @@ |
359 | return column_info; |
360 | } |
361 | |
362 | + Rows &getRows() |
363 | + { |
364 | + return rows; |
365 | + } |
366 | + |
367 | + void clearRows() |
368 | + { |
369 | + for_each(rows.begin(), |
370 | + rows.end(), |
371 | + DeleteRows()); |
372 | + rows.clear(); |
373 | + } |
374 | + |
375 | /** |
376 | * @param[in] index the index of this column |
377 | * @return the name for the column at the given index |
378 | @@ -419,13 +460,10 @@ |
379 | return column_info[index]->getName(); |
380 | } |
381 | |
382 | - /** |
383 | - * @param[in] index the index of this column |
384 | - * @return the open method for the column at the given index |
385 | - */ |
386 | - uint32_t getColumnOpenMethod(int index) const |
387 | + void addRow(unsigned char *buf, size_t len) |
388 | { |
389 | - return column_info[index]->getOpenMethod(); |
390 | + InfoSchemaRecord *record= new InfoSchemaRecord(buf, len); |
391 | + rows.push_back(record); |
392 | } |
393 | |
394 | private: |
395 | @@ -464,6 +502,8 @@ |
396 | */ |
397 | Columns column_info; |
398 | |
399 | + Rows rows; |
400 | + |
401 | /** |
402 | * Contains the methods available on this I_S table. |
403 | */ |
404 | |
405 | === modified file 'drizzled/plugin/storage_engine.cc' |
406 | --- drizzled/plugin/storage_engine.cc 2009-10-19 04:52:19 +0000 |
407 | +++ drizzled/plugin/storage_engine.cc 2009-10-29 23:56:14 +0000 |
408 | @@ -137,7 +137,7 @@ |
409 | !0 Error |
410 | */ |
411 | int plugin::StorageEngine::deleteTableImplementation(Session *, |
412 | - const string table_path) |
413 | + const string &table_path) |
414 | { |
415 | int error= 0; |
416 | int enoent_or_zero= ENOENT; // Error if no file was deleted |
417 | @@ -757,16 +757,19 @@ |
418 | |
419 | if (dirp == NULL) |
420 | { |
421 | - if (my_errno == ENOENT) |
422 | - my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str()); |
423 | - else |
424 | - my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno); |
425 | - return(ENOENT); |
426 | + if (my_errno != ENOENT) |
427 | + { |
428 | + my_error(ER_CANT_READ_DIR, |
429 | + MYF(ME_BELL + ME_WAITTANG), |
430 | + path, |
431 | + my_errno); |
432 | + } |
433 | + return ENOENT; |
434 | } |
435 | current_entry= -1; |
436 | } |
437 | |
438 | - while(true) |
439 | + while (true) |
440 | { |
441 | current_entry++; |
442 | |
443 | @@ -844,7 +847,7 @@ |
444 | |
445 | err= current_implementation->next(name); |
446 | |
447 | - if (err == -1) |
448 | + if (err == -1 || err == ENOENT) |
449 | { |
450 | if (current_implementation != default_implementation) |
451 | { |
452 | @@ -852,6 +855,19 @@ |
453 | current_implementation= NULL; |
454 | goto next; |
455 | } |
456 | + if (current_implementation == default_implementation) |
457 | + { |
458 | + if (database.compare(INFORMATION_SCHEMA_NAME) == 0) |
459 | + { |
460 | + return -1; |
461 | + } |
462 | + if (err == ENOENT) |
463 | + { |
464 | + my_error(ER_BAD_DB_ERROR, |
465 | + MYF(ME_BELL + ME_WAITTANG), |
466 | + database.c_str()); |
467 | + } |
468 | + } |
469 | } |
470 | |
471 | return err; |
472 | |
473 | === modified file 'drizzled/plugin/storage_engine.h' |
474 | --- drizzled/plugin/storage_engine.h 2009-10-16 10:27:33 +0000 |
475 | +++ drizzled/plugin/storage_engine.h 2009-10-29 23:56:14 +0000 |
476 | @@ -54,6 +54,7 @@ |
477 | HTON_BIT_TEMPORARY_ONLY, |
478 | HTON_BIT_FILE_BASED, // use for check_lowercase_names |
479 | HTON_BIT_HAS_DATA_DICTIONARY, |
480 | + HTON_BIT_CREATE_NOT_SUPPORTED, // Engine does support the creation of tables |
481 | HTON_BIT_SIZE |
482 | }; |
483 | |
484 | @@ -67,6 +68,7 @@ |
485 | static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_ONLY(1 << HTON_BIT_TEMPORARY_ONLY); |
486 | static const std::bitset<HTON_BIT_SIZE> HTON_FILE_BASED(1 << HTON_BIT_FILE_BASED); |
487 | static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DATA_DICTIONARY(1 << HTON_BIT_HAS_DATA_DICTIONARY); |
488 | +static const std::bitset<HTON_BIT_SIZE> HTON_CREATE_NOT_SUPPORTED(1 << HTON_BIT_CREATE_NOT_SUPPORTED); |
489 | |
490 | class Table; |
491 | |
492 | @@ -276,7 +278,7 @@ |
493 | const char *from, const char *to); |
494 | |
495 | virtual int deleteTableImplementation(Session* session, |
496 | - const std::string table_path); |
497 | + const std::string &table_path); |
498 | |
499 | public: |
500 | int doCreateTable(Session *session, const char *path, |
501 | |
502 | === modified file 'drizzled/show.cc' |
503 | --- drizzled/show.cc 2009-10-16 00:38:56 +0000 |
504 | +++ drizzled/show.cc 2009-10-29 23:56:14 +0000 |
505 | @@ -63,8 +63,6 @@ |
506 | |
507 | static void store_key_options(String *packet, Table *table, KEY *key_info); |
508 | |
509 | - |
510 | - |
511 | int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr) |
512 | { |
513 | register int flag; |
514 | @@ -225,9 +223,6 @@ |
515 | if (session->client->sendFields(&field_list)) |
516 | return true; |
517 | { |
518 | - if (table_list->schema_table) |
519 | - session->client->store(table_list->schema_table->getTableName().c_str()); |
520 | - else |
521 | session->client->store(table_list->table->alias); |
522 | } |
523 | |
524 | @@ -1016,35 +1011,6 @@ |
525 | return; |
526 | } |
527 | |
528 | -/* |
529 | - Store record to I_S table, convert HEAP table |
530 | - to MyISAM if necessary |
531 | - |
532 | - SYNOPSIS |
533 | - schema_table_store_record() |
534 | - session thread Cursor |
535 | - table Information schema table to be updated |
536 | - |
537 | - RETURN |
538 | - 0 success |
539 | - 1 error |
540 | -*/ |
541 | - |
542 | -bool schema_table_store_record(Session *session, Table *table) |
543 | -{ |
544 | - int error; |
545 | - if ((error= table->file->ha_write_row(table->record[0]))) |
546 | - { |
547 | - Tmp_Table_Param *param= table->pos_in_table_list->schema_table_param; |
548 | - |
549 | - if (create_myisam_from_heap(session, table, param->start_recinfo, |
550 | - ¶m->recinfo, error, 0)) |
551 | - return true; |
552 | - } |
553 | - return false; |
554 | -} |
555 | - |
556 | - |
557 | static int make_table_list(Session *session, Select_Lex *sel, |
558 | LEX_STRING *db_name, LEX_STRING *table_name) |
559 | { |
560 | @@ -1484,14 +1450,6 @@ |
561 | return 0; |
562 | } |
563 | |
564 | - /* |
565 | - This call will add all matching the wildcards (if specified) IS tables |
566 | - to the list |
567 | - */ |
568 | - if (with_i_schema) |
569 | - return plugin::InfoSchemaTable::addTableToList(session, table_names, |
570 | - lookup_field_vals->table_value.str); |
571 | - |
572 | string db(db_name->str); |
573 | |
574 | plugin::TableNameIterator tniter(db); |
575 | @@ -1593,13 +1551,16 @@ |
576 | |
577 | |
578 | table->setWriteSet(); |
579 | - error= test(schema_table->processTable(session, show_table_list, |
580 | - table, res, db_name, |
581 | + error= test(schema_table->processTable(session, |
582 | + show_table_list, |
583 | + table, |
584 | + res, |
585 | + db_name, |
586 | table_name)); |
587 | session->temporary_tables= 0; |
588 | session->close_tables_for_reopen(&show_table_list); |
589 | |
590 | - return(error); |
591 | + return error; |
592 | } |
593 | |
594 | |
595 | @@ -1641,114 +1602,13 @@ |
596 | return 0; |
597 | } |
598 | } |
599 | - if (schema_table_store_record(session, table)) |
600 | - return 1; |
601 | + TableList *tmp= table->pos_in_table_list; |
602 | + tmp->schema_table->addRow(table->record[0], table->s->reclength); |
603 | return 0; |
604 | } |
605 | |
606 | |
607 | /** |
608 | - @brief Get open table method |
609 | - |
610 | - @details The function calculates the method which will be used |
611 | - for table opening: |
612 | - SKIP_OPEN_TABLE - do not open table |
613 | - OPEN_FRM_ONLY - open FRM file only |
614 | - OPEN_FULL_TABLE - open FRM, data, index files |
615 | - @param[in] tables I_S table table_list |
616 | - @param[in] schema_table I_S table struct |
617 | - |
618 | - @return return a set of flags |
619 | - @retval SKIP_OPEN_TABLE | OPEN_FRM_ONLY | OPEN_FULL_TABLE |
620 | -*/ |
621 | - |
622 | -static uint32_t get_table_open_method(TableList *tables, |
623 | - plugin::InfoSchemaTable *schema_table) |
624 | -{ |
625 | - /* |
626 | - determine which method will be used for table opening |
627 | - */ |
628 | - if (schema_table->getRequestedObject() & OPTIMIZE_I_S_TABLE) |
629 | - { |
630 | - Field **ptr, *field; |
631 | - int table_open_method= 0, field_indx= 0; |
632 | - for (ptr= tables->table->field; (field= *ptr) ; ptr++) |
633 | - { |
634 | - if (field->isReadSet()) |
635 | - table_open_method|= schema_table->getColumnOpenMethod(field_indx); |
636 | - field_indx++; |
637 | - } |
638 | - return table_open_method; |
639 | - } |
640 | - /* I_S tables which use get_all_tables but can not be optimized */ |
641 | - return (uint32_t) OPEN_FULL_TABLE; |
642 | -} |
643 | - |
644 | - |
645 | -/** |
646 | - @brief Fill I_S table with data from FRM file only |
647 | - |
648 | - @param[in] session thread Cursor |
649 | - @param[in] table Table struct for I_S table |
650 | - @param[in] schema_table I_S table struct |
651 | - @param[in] db_name database name |
652 | - @param[in] table_name table name |
653 | - |
654 | - @return Operation status |
655 | - @retval 0 Table is processed and we can continue |
656 | - with new table |
657 | - @retval 1 It's view and we have to use |
658 | - open_tables function for this table |
659 | -*/ |
660 | - |
661 | -static int fill_schema_table_from_frm(Session *session,TableList *tables, |
662 | - plugin::InfoSchemaTable *schema_table, |
663 | - LEX_STRING *db_name, |
664 | - LEX_STRING *table_name) |
665 | -{ |
666 | - Table *table= tables->table; |
667 | - TableShare *share; |
668 | - Table tbl; |
669 | - TableList table_list; |
670 | - uint32_t res= 0; |
671 | - int error; |
672 | - char key[MAX_DBKEY_LENGTH]; |
673 | - uint32_t key_length; |
674 | - |
675 | - memset(&tbl, 0, sizeof(Table)); |
676 | - |
677 | - table_list.table_name= table_name->str; |
678 | - table_list.db= db_name->str; |
679 | - |
680 | - key_length= table_list.create_table_def_key(key); |
681 | - pthread_mutex_lock(&LOCK_open); /* Locking to get table share when filling schema table from FRM */ |
682 | - share= TableShare::getShare(session, &table_list, key, key_length, 0, &error); |
683 | - if (!share) |
684 | - { |
685 | - res= 0; |
686 | - goto err; |
687 | - } |
688 | - |
689 | - { |
690 | - tbl.s= share; |
691 | - table_list.table= &tbl; |
692 | - res= schema_table->processTable(session, &table_list, table, |
693 | - res, db_name, table_name); |
694 | - } |
695 | - /* For the moment we just set everything to read */ |
696 | - table->setReadSet(); |
697 | - |
698 | - TableShare::release(share); |
699 | - |
700 | -err: |
701 | - pthread_mutex_unlock(&LOCK_open); |
702 | - session->clear_error(); |
703 | - return res; |
704 | -} |
705 | - |
706 | - |
707 | - |
708 | -/** |
709 | @brief Fill I_S tables whose data are retrieved |
710 | from frm files and storage engine |
711 | |
712 | @@ -1760,13 +1620,12 @@ |
713 | |
714 | @param[in] session thread Cursor |
715 | @param[in] tables I_S table |
716 | - @param[in] cond 'WHERE' condition |
717 | |
718 | @return Operation status |
719 | @retval 0 success |
720 | @retval 1 error |
721 | */ |
722 | -int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables, COND *cond) |
723 | +int plugin::InfoSchemaMethods::fillTable(Session *session, TableList *tables) |
724 | { |
725 | LEX *lex= session->lex; |
726 | Table *table= tables->table; |
727 | @@ -1779,11 +1638,12 @@ |
728 | bool with_i_schema; |
729 | vector<LEX_STRING*> db_names, table_names; |
730 | COND *partial_cond= 0; |
731 | + /* the WHERE condition */ |
732 | + COND *cond= table->reginfo.join_tab->select_cond; |
733 | uint32_t derived_tables= lex->derived_tables; |
734 | int error= 1; |
735 | Open_tables_state open_tables_state_backup; |
736 | Query_tables_list query_tables_list_backup; |
737 | - uint32_t table_open_method; |
738 | bool old_value= session->no_warnings_for_error; |
739 | |
740 | /* |
741 | @@ -1793,8 +1653,6 @@ |
742 | */ |
743 | session->reset_n_backup_open_tables_state(&open_tables_state_backup); |
744 | |
745 | - tables->table_open_method= table_open_method= |
746 | - get_table_open_method(tables, schema_table); |
747 | /* |
748 | this branch processes SHOW FIELDS, SHOW INDEXES commands. |
749 | see sql_parse.cc, prepare_schema_table() function where |
750 | @@ -1813,14 +1671,14 @@ |
751 | goto err; |
752 | } |
753 | |
754 | - if (!lookup_field_vals.wild_db_value && !lookup_field_vals.wild_table_value) |
755 | + if (! lookup_field_vals.wild_db_value && ! lookup_field_vals.wild_table_value) |
756 | { |
757 | /* |
758 | if lookup value is empty string then |
759 | it's impossible table name or db name |
760 | */ |
761 | - if ((lookup_field_vals.db_value.str && !lookup_field_vals.db_value.str[0]) || |
762 | - (lookup_field_vals.table_value.str && !lookup_field_vals.table_value.str[0])) |
763 | + if ((lookup_field_vals.db_value.str && ! lookup_field_vals.db_value.str[0]) || |
764 | + (lookup_field_vals.table_value.str && ! lookup_field_vals.table_value.str[0])) |
765 | { |
766 | error= 0; |
767 | goto err; |
768 | @@ -1828,12 +1686,16 @@ |
769 | } |
770 | |
771 | if (lookup_field_vals.db_value.length && |
772 | - !lookup_field_vals.wild_db_value) |
773 | + ! lookup_field_vals.wild_db_value) |
774 | + { |
775 | tables->has_db_lookup_value= true; |
776 | + } |
777 | |
778 | if (lookup_field_vals.table_value.length && |
779 | - !lookup_field_vals.wild_table_value) |
780 | + ! lookup_field_vals.wild_table_value) |
781 | + { |
782 | tables->has_table_lookup_value= true; |
783 | + } |
784 | |
785 | if (tables->has_db_lookup_value && tables->has_table_lookup_value) |
786 | partial_cond= 0; |
787 | @@ -1874,55 +1736,36 @@ |
788 | table->field[schema_table->getSecondColumnIndex()]-> |
789 | store((*table_name)->str, (*table_name)->length, system_charset_info); |
790 | |
791 | - if (!partial_cond || partial_cond->val_int()) |
792 | + if (! partial_cond || partial_cond->val_int()) |
793 | { |
794 | - /* |
795 | - If table is I_S.tables and open_table_method is 0 (eg SKIP_OPEN) |
796 | - we can skip table opening and we don't have lookup value for |
797 | - table name or lookup value is wild string(table name list is |
798 | - already created by make_table_name_list() function). |
799 | - */ |
800 | - if (! table_open_method && |
801 | - schema_table->getTableName().compare("TABLES") == 0 && |
802 | - (! lookup_field_vals.table_value.length || |
803 | - lookup_field_vals.wild_table_value)) |
804 | - { |
805 | - if (schema_table_store_record(session, table)) |
806 | - goto err; /* Out of space in temporary table */ |
807 | - continue; |
808 | - } |
809 | - |
810 | - /* SHOW Table NAMES command */ |
811 | if (schema_table->getTableName().compare("TABLE_NAMES") == 0) |
812 | { |
813 | - if (fill_schema_table_names(session, tables->table, *db_name, |
814 | - *table_name, with_i_schema)) |
815 | + if (fill_schema_table_names(session, |
816 | + tables->table, |
817 | + *db_name, |
818 | + *table_name, |
819 | + with_i_schema)) |
820 | + { |
821 | continue; |
822 | + } |
823 | } |
824 | else |
825 | { |
826 | - if (!(table_open_method & ~OPEN_FRM_ONLY) && |
827 | - !with_i_schema) |
828 | - { |
829 | - if (!fill_schema_table_from_frm(session, tables, schema_table, *db_name, |
830 | - *table_name)) |
831 | - continue; |
832 | - } |
833 | - |
834 | LEX_STRING tmp_lex_string, orig_db_name; |
835 | - /* |
836 | - Set the parent lex of 'sel' because it is needed by |
837 | - sel.init_query() which is called inside make_table_list. |
838 | - */ |
839 | session->no_warnings_for_error= 1; |
840 | sel.parent_lex= lex; |
841 | - /* db_name can be changed in make_table_list() func */ |
842 | - if (!session->make_lex_string(&orig_db_name, (*db_name)->str, |
843 | - (*db_name)->length, false)) |
844 | + if (! session->make_lex_string(&orig_db_name, |
845 | + (*db_name)->str, |
846 | + (*db_name)->length, |
847 | + false)) |
848 | + { |
849 | goto err; |
850 | + } |
851 | |
852 | if (make_table_list(session, &sel, *db_name, *table_name)) |
853 | + { |
854 | goto err; |
855 | + } |
856 | |
857 | TableList *show_table_list= (TableList*) sel.table_list.first; |
858 | lex->all_selects_list= &sel; |
859 | @@ -1933,38 +1776,41 @@ |
860 | res= session->openTables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH); |
861 | lex->sql_command= save_sql_command; |
862 | /* |
863 | - XXX-> show_table_list has a flag i_is_requested, |
864 | - and when it's set, openTables() |
865 | - can return an error without setting an error message |
866 | - in Session, which is a hack. This is why we have to |
867 | - check for res, then for session->is_error() only then |
868 | - for session->main_da.sql_errno(). |
869 | - */ |
870 | + XXX-> show_table_list has a flag i_is_requested, |
871 | + and when it's set, openTables() |
872 | + can return an error without setting an error message |
873 | + in Session, which is a hack. This is why we have to |
874 | + check for res, then for session->is_error() only then |
875 | + for session->main_da.sql_errno(). |
876 | + */ |
877 | if (res && session->is_error() && |
878 | session->main_da.sql_errno() == ER_NO_SUCH_TABLE) |
879 | { |
880 | /* |
881 | - Hide error for not existing table. |
882 | - This error can occur for example when we use |
883 | - where condition with db name and table name and this |
884 | - table does not exist. |
885 | - */ |
886 | + Hide error for not existing table. |
887 | + This error can occur for example when we use |
888 | + where condition with db name and table name and this |
889 | + table does not exist. |
890 | + */ |
891 | res= 0; |
892 | session->clear_error(); |
893 | } |
894 | else |
895 | { |
896 | /* |
897 | - We should use show_table_list->alias instead of |
898 | - show_table_list->table_name because table_name |
899 | - could be changed during opening of I_S tables. It's safe |
900 | - to use alias because alias contains original table name |
901 | - in this case. |
902 | - */ |
903 | + We should use show_table_list->alias instead of |
904 | + show_table_list->table_name because table_name |
905 | + could be changed during opening of I_S tables. It's safe |
906 | + to use alias because alias contains original table name |
907 | + in this case. |
908 | + */ |
909 | session->make_lex_string(&tmp_lex_string, show_table_list->alias, |
910 | - strlen(show_table_list->alias), false); |
911 | - res= schema_table->processTable(session, show_table_list, table, |
912 | - res, &orig_db_name, |
913 | + strlen(show_table_list->alias), false); |
914 | + res= schema_table->processTable(session, |
915 | + show_table_list, |
916 | + table, |
917 | + res, |
918 | + &orig_db_name, |
919 | &tmp_lex_string); |
920 | session->close_tables_for_reopen(&show_table_list); |
921 | } |
922 | @@ -2092,10 +1938,12 @@ |
923 | } |
924 | |
925 | |
926 | -int plugin::InfoSchemaMethods::processTable(Session *session, TableList *tables, |
927 | +int plugin::InfoSchemaMethods::processTable( |
928 | + plugin::InfoSchemaTable *store_table, |
929 | + Session *session, TableList *tables, |
930 | Table *table, bool res, |
931 | LEX_STRING *db_name, |
932 | - LEX_STRING *table_name) const |
933 | + LEX_STRING *table_name) |
934 | { |
935 | LEX *lex= session->lex; |
936 | const char *wild= lex->wild ? lex->wild->ptr() : NULL; |
937 | @@ -2119,7 +1967,7 @@ |
938 | session->clear_error(); |
939 | res= 0; |
940 | } |
941 | - return(res); |
942 | + return res; |
943 | } |
944 | |
945 | show_table= tables->table; |
946 | @@ -2138,7 +1986,7 @@ |
947 | } |
948 | |
949 | /* For the moment we just set everything to read */ |
950 | - if (!show_table->read_set) |
951 | + if (! show_table->read_set) |
952 | { |
953 | show_table->def_read_set.setAll(); |
954 | show_table->read_set= &show_table->def_read_set; |
955 | @@ -2206,109 +2054,9 @@ |
956 | table->field[20]->store((const char*) pos, |
957 | strlen((const char*) pos), cs); |
958 | } |
959 | - if (schema_table_store_record(session, table)) |
960 | - return(1); |
961 | - } |
962 | - return(0); |
963 | -} |
964 | - |
965 | - |
966 | -Table *plugin::InfoSchemaMethods::createSchemaTable(Session *session, TableList *table_list) |
967 | - const |
968 | -{ |
969 | - int field_count= 0; |
970 | - Item *item; |
971 | - Table *table; |
972 | - List<Item> field_list; |
973 | - const CHARSET_INFO * const cs= system_charset_info; |
974 | - const plugin::InfoSchemaTable::Columns &columns= table_list->schema_table->getColumns(); |
975 | - plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
976 | - |
977 | - while (iter != columns.end()) |
978 | - { |
979 | - const plugin::ColumnInfo *column= *iter; |
980 | - switch (column->getType()) { |
981 | - case DRIZZLE_TYPE_LONG: |
982 | - case DRIZZLE_TYPE_LONGLONG: |
983 | - if (!(item= new Item_return_int(column->getName().c_str(), |
984 | - column->getLength(), |
985 | - column->getType(), |
986 | - column->getValue()))) |
987 | - { |
988 | - return(0); |
989 | - } |
990 | - item->unsigned_flag= (column->getFlags() & MY_I_S_UNSIGNED); |
991 | - break; |
992 | - case DRIZZLE_TYPE_DATE: |
993 | - case DRIZZLE_TYPE_TIMESTAMP: |
994 | - case DRIZZLE_TYPE_DATETIME: |
995 | - if (!(item=new Item_return_date_time(column->getName().c_str(), |
996 | - column->getType()))) |
997 | - { |
998 | - return(0); |
999 | - } |
1000 | - break; |
1001 | - case DRIZZLE_TYPE_DOUBLE: |
1002 | - if ((item= new Item_float(column->getName().c_str(), 0.0, NOT_FIXED_DEC, |
1003 | - column->getLength())) == NULL) |
1004 | - return NULL; |
1005 | - break; |
1006 | - case DRIZZLE_TYPE_NEWDECIMAL: |
1007 | - if (!(item= new Item_decimal((int64_t) column->getValue(), false))) |
1008 | - { |
1009 | - return(0); |
1010 | - } |
1011 | - item->unsigned_flag= (column->getFlags() & MY_I_S_UNSIGNED); |
1012 | - item->decimals= column->getLength() % 10; |
1013 | - item->max_length= (column->getLength()/100)%100; |
1014 | - if (item->unsigned_flag == 0) |
1015 | - item->max_length+= 1; |
1016 | - if (item->decimals > 0) |
1017 | - item->max_length+= 1; |
1018 | - item->set_name(column->getName().c_str(), |
1019 | - column->getName().length(), cs); |
1020 | - break; |
1021 | - case DRIZZLE_TYPE_BLOB: |
1022 | - if (!(item= new Item_blob(column->getName().c_str(), |
1023 | - column->getLength()))) |
1024 | - { |
1025 | - return(0); |
1026 | - } |
1027 | - break; |
1028 | - default: |
1029 | - if (!(item= new Item_empty_string("", column->getLength(), cs))) |
1030 | - { |
1031 | - return(0); |
1032 | - } |
1033 | - item->set_name(column->getName().c_str(), |
1034 | - column->getName().length(), cs); |
1035 | - break; |
1036 | - } |
1037 | - field_list.push_back(item); |
1038 | - item->maybe_null= (column->getFlags() & MY_I_S_MAYBE_NULL); |
1039 | - field_count++; |
1040 | - ++iter; |
1041 | - } |
1042 | - Tmp_Table_Param *tmp_table_param = |
1043 | - (Tmp_Table_Param*) (session->alloc(sizeof(Tmp_Table_Param))); |
1044 | - tmp_table_param->init(); |
1045 | - tmp_table_param->table_charset= cs; |
1046 | - tmp_table_param->field_count= field_count; |
1047 | - tmp_table_param->schema_table= 1; |
1048 | - Select_Lex *select_lex= session->lex->current_select; |
1049 | - if (!(table= create_tmp_table(session, tmp_table_param, |
1050 | - field_list, (order_st*) 0, 0, 0, |
1051 | - (select_lex->options | session->options | |
1052 | - TMP_TABLE_ALL_COLUMNS), |
1053 | - HA_POS_ERROR, table_list->alias))) |
1054 | - return(0); |
1055 | - my_bitmap_map* bitmaps= |
1056 | - (my_bitmap_map*) session->alloc(bitmap_buffer_size(field_count)); |
1057 | - table->def_read_set.init((my_bitmap_map*) bitmaps, field_count); |
1058 | - table->read_set= &table->def_read_set; |
1059 | - table->read_set->clearAll(); |
1060 | - table_list->schema_table_param= tmp_table_param; |
1061 | - return(table); |
1062 | + store_table->addRow(table->record[0], table->s->reclength); |
1063 | + } |
1064 | + return 0; |
1065 | } |
1066 | |
1067 | |
1068 | @@ -2358,47 +2106,6 @@ |
1069 | |
1070 | |
1071 | /* |
1072 | - Create information_schema table |
1073 | - |
1074 | - SYNOPSIS |
1075 | - mysql_schema_table() |
1076 | - session thread Cursor |
1077 | - lex pointer to LEX |
1078 | - table_list pointer to table_list |
1079 | - |
1080 | - RETURN |
1081 | - true on error |
1082 | -*/ |
1083 | - |
1084 | -bool mysql_schema_table(Session *session, LEX *, TableList *table_list) |
1085 | -{ |
1086 | - Table *table; |
1087 | - if (!(table= table_list->schema_table->createSchemaTable(session, table_list))) |
1088 | - return true; |
1089 | - table->s->tmp_table= SYSTEM_TMP_TABLE; |
1090 | - /* |
1091 | - This test is necessary to make |
1092 | - case insensitive file systems + |
1093 | - upper case table names(information schema tables) + |
1094 | - views |
1095 | - working correctly |
1096 | - */ |
1097 | - if (table_list->schema_table_name) |
1098 | - table->alias_name_used= my_strcasecmp(table_alias_charset, |
1099 | - table_list->schema_table_name, |
1100 | - table_list->alias); |
1101 | - table_list->table_name= table->s->table_name.str; |
1102 | - table_list->table_name_length= table->s->table_name.length; |
1103 | - table_list->table= table; |
1104 | - table->next= session->derived_tables; |
1105 | - session->derived_tables= table; |
1106 | - table_list->select_lex->options |= OPTION_SCHEMA_TABLE; |
1107 | - |
1108 | - return false; |
1109 | -} |
1110 | - |
1111 | - |
1112 | -/* |
1113 | Generate select from information_schema table |
1114 | |
1115 | SYNOPSIS |
1116 | @@ -2432,91 +2139,3 @@ |
1117 | return false; |
1118 | } |
1119 | |
1120 | - |
1121 | -/* |
1122 | - Fill temporary schema tables before SELECT |
1123 | - |
1124 | - SYNOPSIS |
1125 | - get_schema_tables_result() |
1126 | - join join which use schema tables |
1127 | - executed_place place where I_S table processed |
1128 | - |
1129 | - RETURN |
1130 | - false success |
1131 | - true error |
1132 | -*/ |
1133 | - |
1134 | -bool get_schema_tables_result(JOIN *join, |
1135 | - enum enum_schema_table_state executed_place) |
1136 | -{ |
1137 | - JoinTable *tmp_join_tab= join->join_tab+join->tables; |
1138 | - Session *session= join->session; |
1139 | - LEX *lex= session->lex; |
1140 | - bool result= 0; |
1141 | - |
1142 | - session->no_warnings_for_error= 1; |
1143 | - for (JoinTable *tab= join->join_tab; tab < tmp_join_tab; tab++) |
1144 | - { |
1145 | - if (!tab->table || !tab->table->pos_in_table_list) |
1146 | - break; |
1147 | - |
1148 | - TableList *table_list= tab->table->pos_in_table_list; |
1149 | - if (table_list->schema_table) |
1150 | - { |
1151 | - bool is_subselect= (&lex->unit != lex->current_select->master_unit() && |
1152 | - lex->current_select->master_unit()->item); |
1153 | - |
1154 | - |
1155 | - /* skip I_S optimizations specific to get_all_tables */ |
1156 | - if (session->lex->describe && |
1157 | - (table_list->schema_table->isOptimizationPossible() != true)) |
1158 | - { |
1159 | - continue; |
1160 | - } |
1161 | - |
1162 | - /* |
1163 | - If schema table is already processed and |
1164 | - the statement is not a subselect then |
1165 | - we don't need to fill this table again. |
1166 | - If schema table is already processed and |
1167 | - schema_table_state != executed_place then |
1168 | - table is already processed and |
1169 | - we should skip second data processing. |
1170 | - */ |
1171 | - if (table_list->schema_table_state && |
1172 | - (!is_subselect || table_list->schema_table_state != executed_place)) |
1173 | - continue; |
1174 | - |
1175 | - /* |
1176 | - if table is used in a subselect and |
1177 | - table has been processed earlier with the same |
1178 | - 'executed_place' value then we should refresh the table. |
1179 | - */ |
1180 | - if (table_list->schema_table_state && is_subselect) |
1181 | - { |
1182 | - table_list->table->file->extra(HA_EXTRA_NO_CACHE); |
1183 | - table_list->table->file->extra(HA_EXTRA_RESET_STATE); |
1184 | - table_list->table->file->ha_delete_all_rows(); |
1185 | - table_list->table->free_io_cache(); |
1186 | - table_list->table->filesort_free_buffers(true); |
1187 | - table_list->table->null_row= 0; |
1188 | - } |
1189 | - else |
1190 | - table_list->table->file->stats.records= 0; |
1191 | - |
1192 | - if (table_list->schema_table->fillTable(session, table_list, |
1193 | - tab->select_cond)) |
1194 | - { |
1195 | - result= 1; |
1196 | - join->error= 1; |
1197 | - tab->read_record.file= table_list->table->file; |
1198 | - table_list->schema_table_state= executed_place; |
1199 | - break; |
1200 | - } |
1201 | - tab->read_record.file= table_list->table->file; |
1202 | - table_list->schema_table_state= executed_place; |
1203 | - } |
1204 | - } |
1205 | - session->no_warnings_for_error= 0; |
1206 | - return(result); |
1207 | -} |
1208 | |
1209 | === modified file 'drizzled/show.h' |
1210 | --- drizzled/show.h 2009-09-29 22:52:00 +0000 |
1211 | +++ drizzled/show.h 2009-10-29 23:56:14 +0000 |
1212 | @@ -70,16 +70,12 @@ |
1213 | |
1214 | int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg); |
1215 | |
1216 | -bool schema_table_store_record(Session *session, Table *table); |
1217 | - |
1218 | int get_quote_char_for_identifier(); |
1219 | int wild_case_compare(const CHARSET_INFO * const cs, |
1220 | const char *str,const char *wildstr); |
1221 | |
1222 | bool make_schema_select(Session *session, Select_Lex *sel, |
1223 | const std::string& schema_table_name); |
1224 | -bool mysql_schema_table(Session *session, LEX *lex, TableList *table_list); |
1225 | -bool get_schema_tables_result(JOIN *join, enum enum_schema_table_state executed_place); |
1226 | |
1227 | bool mysqld_show_open_tables(Session *session,const char *wild); |
1228 | bool mysqld_show_logs(Session *session); |
1229 | |
1230 | === modified file 'drizzled/sql_base.cc' |
1231 | --- drizzled/sql_base.cc 2009-10-16 10:27:33 +0000 |
1232 | +++ drizzled/sql_base.cc 2009-10-29 23:56:14 +0000 |
1233 | @@ -2139,18 +2139,6 @@ |
1234 | { |
1235 | continue; |
1236 | } |
1237 | - /* |
1238 | - If this TableList object is a placeholder for an information_schema |
1239 | - table, create a temporary table to represent the information_schema |
1240 | - table in the query. Do not fill it yet - will be filled during |
1241 | - execution. |
1242 | - */ |
1243 | - if (tables->schema_table) |
1244 | - { |
1245 | - if (mysql_schema_table(this, lex, tables) == false) |
1246 | - continue; |
1247 | - return -1; |
1248 | - } |
1249 | (*counter)++; |
1250 | |
1251 | /* |
1252 | |
1253 | === modified file 'drizzled/sql_select.cc' |
1254 | --- drizzled/sql_select.cc 2009-10-16 10:27:33 +0000 |
1255 | +++ drizzled/sql_select.cc 2009-10-29 23:56:14 +0000 |
1256 | @@ -5294,11 +5294,6 @@ |
1257 | } |
1258 | } |
1259 | |
1260 | - /* Fill schema tables with data before filesort if it's necessary */ |
1261 | - if ((join->select_lex->options & OPTION_SCHEMA_TABLE) && |
1262 | - get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX)) |
1263 | - goto err; |
1264 | - |
1265 | if (table->s->tmp_table) |
1266 | table->file->info(HA_STATUS_VARIABLE); // Get record count |
1267 | table->sort.found_records=filesort(session, table,join->sortorder, length, |
1268 | @@ -6935,12 +6930,6 @@ |
1269 | if (table_list->schema_table && |
1270 | table_list->schema_table->getRequestedObject() & OPTIMIZE_I_S_TABLE) |
1271 | { |
1272 | - if (!table_list->table_open_method) |
1273 | - extra.append(STRING_WITH_LEN("; Skip_open_table")); |
1274 | - else if (table_list->table_open_method == OPEN_FRM_ONLY) |
1275 | - extra.append(STRING_WITH_LEN("; Open_frm_only")); |
1276 | - else |
1277 | - extra.append(STRING_WITH_LEN("; Open_full_table")); |
1278 | if (table_list->has_db_lookup_value && |
1279 | table_list->has_table_lookup_value) |
1280 | extra.append(STRING_WITH_LEN("; Scanned 0 databases")); |
1281 | |
1282 | === modified file 'drizzled/sql_table.cc' |
1283 | --- drizzled/sql_table.cc 2009-10-19 19:19:38 +0000 |
1284 | +++ drizzled/sql_table.cc 2009-10-29 23:56:14 +0000 |
1285 | @@ -385,18 +385,12 @@ |
1286 | { |
1287 | bool error, need_start_waiting= false; |
1288 | |
1289 | - if (tables && tables->schema_table) |
1290 | - { |
1291 | - my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.c_str()); |
1292 | - return(true); |
1293 | - } |
1294 | - |
1295 | /* mark for close and remove all cached entries */ |
1296 | |
1297 | - if (!drop_temporary) |
1298 | + if (! drop_temporary) |
1299 | { |
1300 | - if (!(need_start_waiting= !wait_if_global_read_lock(session, 0, 1))) |
1301 | - return(true); |
1302 | + if (! (need_start_waiting= ! wait_if_global_read_lock(session, 0, 1))) |
1303 | + return true; |
1304 | } |
1305 | |
1306 | /* |
1307 | @@ -2437,19 +2431,7 @@ |
1308 | pthread_mutex_lock(&LOCK_open); /* We lock for CREATE TABLE LIKE to copy table definition */ |
1309 | { |
1310 | int protoerr= EEXIST; |
1311 | - |
1312 | - if (src_table->schema_table) |
1313 | - { |
1314 | - if (create_like_schema_frm(session, src_table, create_info, &src_proto)) |
1315 | - { |
1316 | - pthread_mutex_unlock(&LOCK_open); |
1317 | - goto err; |
1318 | - } |
1319 | - } |
1320 | - else |
1321 | - { |
1322 | - protoerr= plugin::StorageEngine::getTableProto(src_path, &src_proto); |
1323 | - } |
1324 | + protoerr= plugin::StorageEngine::getTableProto(src_path, &src_proto); |
1325 | |
1326 | message::Table new_proto(src_proto); |
1327 | |
1328 | |
1329 | === modified file 'drizzled/table.cc' |
1330 | --- drizzled/table.cc 2009-10-20 16:11:52 +0000 |
1331 | +++ drizzled/table.cc 2009-10-29 23:56:14 +0000 |
1332 | @@ -283,6 +283,12 @@ |
1333 | |
1334 | share->storage_engine= plugin::StorageEngine::findByName(session, table.engine().name()); |
1335 | |
1336 | + if (! share->storage_engine) |
1337 | + { |
1338 | + share->storage_engine= plugin::StorageEngine::findByName(session, |
1339 | + table.engine().name()); |
1340 | + } |
1341 | + |
1342 | message::Table::TableOptions table_options; |
1343 | |
1344 | if (table.has_options()) |
1345 | |
1346 | === modified file 'drizzled/table_list.h' |
1347 | --- drizzled/table_list.h 2009-10-20 16:11:52 +0000 |
1348 | +++ drizzled/table_list.h 2009-10-29 23:56:14 +0000 |
1349 | @@ -126,9 +126,8 @@ |
1350 | is_alias(false), |
1351 | is_fqtn(false), |
1352 | has_db_lookup_value(false), |
1353 | - has_table_lookup_value(false), |
1354 | - table_open_method(0) |
1355 | - {} |
1356 | + has_table_lookup_value(false) |
1357 | + {} |
1358 | |
1359 | /** |
1360 | * List of tables local to a subquery (used by SQL_LIST). Considers |
1361 | @@ -246,7 +245,6 @@ |
1362 | |
1363 | bool has_db_lookup_value; |
1364 | bool has_table_lookup_value; |
1365 | - uint32_t table_open_method; |
1366 | enum enum_schema_table_state schema_table_state; |
1367 | |
1368 | void set_underlying_merge(); |
1369 | |
1370 | === modified file 'plugin/archive/ha_archive.cc' |
1371 | --- plugin/archive/ha_archive.cc 2009-10-19 04:52:19 +0000 |
1372 | +++ plugin/archive/ha_archive.cc 2009-10-29 23:56:14 +0000 |
1373 | @@ -174,11 +174,9 @@ |
1374 | dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0)); |
1375 | if (dirp == NULL) |
1376 | { |
1377 | - if (my_errno == ENOENT) |
1378 | - my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str()); |
1379 | - else |
1380 | + if (my_errno != ENOENT) |
1381 | my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno); |
1382 | - return(ENOENT); |
1383 | + return ENOENT; |
1384 | } |
1385 | current_entry= -1; |
1386 | } |
1387 | |
1388 | === modified file 'plugin/blackhole/ha_blackhole.cc' |
1389 | --- plugin/blackhole/ha_blackhole.cc 2009-10-16 01:56:08 +0000 |
1390 | +++ plugin/blackhole/ha_blackhole.cc 2009-10-29 23:56:14 +0000 |
1391 | @@ -46,7 +46,7 @@ |
1392 | int createTableImplementation(Session*, const char *, Table *, |
1393 | HA_CREATE_INFO *, drizzled::message::Table*); |
1394 | |
1395 | - int deleteTableImplementation(Session*, const string table_name); |
1396 | + int deleteTableImplementation(Session*, const string &table_name); |
1397 | }; |
1398 | |
1399 | /* Static declarations for shared structures */ |
1400 | @@ -105,7 +105,7 @@ |
1401 | return(0); |
1402 | } |
1403 | |
1404 | -int BlackholeEngine::deleteTableImplementation(Session*, const string path) |
1405 | +int BlackholeEngine::deleteTableImplementation(Session*, const string &path) |
1406 | { |
1407 | if (unlink(path.c_str()) != 0) |
1408 | { |
1409 | |
1410 | === modified file 'plugin/heap/ha_heap.cc' |
1411 | --- plugin/heap/ha_heap.cc 2009-10-16 10:27:33 +0000 |
1412 | +++ plugin/heap/ha_heap.cc 2009-10-29 23:56:14 +0000 |
1413 | @@ -72,14 +72,14 @@ |
1414 | |
1415 | int renameTableImplementation(Session*, const char * from, const char * to); |
1416 | |
1417 | - int deleteTableImplementation(Session *, const string table_path); |
1418 | + int deleteTableImplementation(Session *, const string &table_path); |
1419 | }; |
1420 | |
1421 | /* |
1422 | We have to ignore ENOENT entries as the HEAP table is created on open and |
1423 | not when doing a CREATE on the table. |
1424 | */ |
1425 | -int HeapEngine::deleteTableImplementation(Session*, const string table_path) |
1426 | +int HeapEngine::deleteTableImplementation(Session*, const string &table_path) |
1427 | { |
1428 | return heap_delete_table(table_path.c_str()); |
1429 | } |
1430 | |
1431 | === modified file 'plugin/info_schema/info_schema_columns.cc' |
1432 | --- plugin/info_schema/info_schema_columns.cc 2009-09-22 17:56:50 +0000 |
1433 | +++ plugin/info_schema/info_schema_columns.cc 2009-10-29 23:56:14 +0000 |
1434 | @@ -44,8 +44,7 @@ |
1435 | DRIZZLE_TYPE_VARCHAR, |
1436 | 0, |
1437 | 0, |
1438 | - "Charset", |
1439 | - SKIP_OPEN_TABLE); |
1440 | + "Charset"); |
1441 | if (name_col == NULL) |
1442 | { |
1443 | return true; |
1444 | @@ -56,8 +55,7 @@ |
1445 | DRIZZLE_TYPE_VARCHAR, |
1446 | 0, |
1447 | 0, |
1448 | - "Default collation", |
1449 | - SKIP_OPEN_TABLE); |
1450 | + "Default collation"); |
1451 | if (collate_col == NULL) |
1452 | { |
1453 | return true; |
1454 | @@ -68,8 +66,7 @@ |
1455 | DRIZZLE_TYPE_VARCHAR, |
1456 | 0, |
1457 | 0, |
1458 | - "Description", |
1459 | - SKIP_OPEN_TABLE); |
1460 | + "Description"); |
1461 | if (descrip_col == NULL) |
1462 | { |
1463 | return true; |
1464 | @@ -80,8 +77,7 @@ |
1465 | DRIZZLE_TYPE_LONGLONG, |
1466 | 0, |
1467 | 0, |
1468 | - "Maxlen", |
1469 | - SKIP_OPEN_TABLE); |
1470 | + "Maxlen"); |
1471 | if (len_col == NULL) |
1472 | { |
1473 | return true; |
1474 | @@ -108,8 +104,7 @@ |
1475 | DRIZZLE_TYPE_VARCHAR, |
1476 | 0, |
1477 | 0, |
1478 | - "Collation", |
1479 | - SKIP_OPEN_TABLE); |
1480 | + "Collation"); |
1481 | if (name_col == NULL) |
1482 | { |
1483 | return true; |
1484 | @@ -120,8 +115,7 @@ |
1485 | DRIZZLE_TYPE_VARCHAR, |
1486 | 0, |
1487 | 0, |
1488 | - "Default collation", |
1489 | - SKIP_OPEN_TABLE); |
1490 | + "Default collation"); |
1491 | if (char_set_col == NULL) |
1492 | { |
1493 | return true; |
1494 | @@ -132,8 +126,7 @@ |
1495 | DRIZZLE_TYPE_VARCHAR, |
1496 | 0, |
1497 | 0, |
1498 | - "Charset", |
1499 | - SKIP_OPEN_TABLE); |
1500 | + "Charset"); |
1501 | if (descrip_col == NULL) |
1502 | { |
1503 | return true; |
1504 | @@ -144,8 +137,7 @@ |
1505 | DRIZZLE_TYPE_LONGLONG, |
1506 | 0, |
1507 | 0, |
1508 | - "Id", |
1509 | - SKIP_OPEN_TABLE); |
1510 | + "Id"); |
1511 | if (id_col == NULL) |
1512 | { |
1513 | return true; |
1514 | @@ -156,8 +148,7 @@ |
1515 | DRIZZLE_TYPE_VARCHAR, |
1516 | 0, |
1517 | 0, |
1518 | - "Default", |
1519 | - SKIP_OPEN_TABLE); |
1520 | + "Default"); |
1521 | if (default_col == NULL) |
1522 | { |
1523 | return true; |
1524 | @@ -168,8 +159,7 @@ |
1525 | DRIZZLE_TYPE_VARCHAR, |
1526 | 0, |
1527 | 0, |
1528 | - "Compiled", |
1529 | - SKIP_OPEN_TABLE); |
1530 | + "Compiled"); |
1531 | if (compiled_col == NULL) |
1532 | { |
1533 | return true; |
1534 | @@ -180,8 +170,7 @@ |
1535 | DRIZZLE_TYPE_LONGLONG, |
1536 | 0, |
1537 | 0, |
1538 | - "Sortlen", |
1539 | - SKIP_OPEN_TABLE); |
1540 | + "Sortlen"); |
1541 | if (sortlen_col == NULL) |
1542 | { |
1543 | return true; |
1544 | @@ -211,8 +200,7 @@ |
1545 | DRIZZLE_TYPE_VARCHAR, |
1546 | 0, |
1547 | 0, |
1548 | - "", |
1549 | - SKIP_OPEN_TABLE); |
1550 | + ""); |
1551 | if (name_col == NULL) |
1552 | { |
1553 | return true; |
1554 | @@ -223,8 +211,7 @@ |
1555 | DRIZZLE_TYPE_VARCHAR, |
1556 | 0, |
1557 | 0, |
1558 | - "", |
1559 | - SKIP_OPEN_TABLE); |
1560 | + ""); |
1561 | if (char_set_col == NULL) |
1562 | { |
1563 | return true; |
1564 | @@ -249,8 +236,7 @@ |
1565 | DRIZZLE_TYPE_VARCHAR, |
1566 | 0, |
1567 | 1, |
1568 | - "", |
1569 | - OPEN_FRM_ONLY); |
1570 | + ""); |
1571 | if (tab_cat == NULL) |
1572 | { |
1573 | return true; |
1574 | @@ -261,8 +247,7 @@ |
1575 | DRIZZLE_TYPE_VARCHAR, |
1576 | 0, |
1577 | 0, |
1578 | - "", |
1579 | - OPEN_FRM_ONLY); |
1580 | + ""); |
1581 | if (tab_sch == NULL) |
1582 | { |
1583 | return true; |
1584 | @@ -273,8 +258,7 @@ |
1585 | DRIZZLE_TYPE_VARCHAR, |
1586 | 0, |
1587 | 0, |
1588 | - "", |
1589 | - OPEN_FRM_ONLY); |
1590 | + ""); |
1591 | if (tab_name == NULL) |
1592 | { |
1593 | return true; |
1594 | @@ -285,8 +269,7 @@ |
1595 | DRIZZLE_TYPE_VARCHAR, |
1596 | 0, |
1597 | 0, |
1598 | - "Field", |
1599 | - OPEN_FRM_ONLY); |
1600 | + "Field"); |
1601 | if (col_name == NULL) |
1602 | { |
1603 | return true; |
1604 | @@ -297,20 +280,19 @@ |
1605 | DRIZZLE_TYPE_LONGLONG, |
1606 | 0, |
1607 | MY_I_S_UNSIGNED, |
1608 | - "", |
1609 | - OPEN_FRM_ONLY); |
1610 | + ""); |
1611 | if (ord_pos == NULL) |
1612 | { |
1613 | return true; |
1614 | } |
1615 | |
1616 | const drizzled::plugin::ColumnInfo *col_def= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_DEFAULT", |
1617 | - MAX_FIELD_VARCHARLENGTH, |
1618 | + 64, |
1619 | + //MAX_FIELD_VARCHARLENGTH, |
1620 | DRIZZLE_TYPE_VARCHAR, |
1621 | 0, |
1622 | 1, |
1623 | - "Default", |
1624 | - OPEN_FRM_ONLY); |
1625 | + "Default"); |
1626 | if (col_def == NULL) |
1627 | { |
1628 | return true; |
1629 | @@ -321,8 +303,7 @@ |
1630 | DRIZZLE_TYPE_VARCHAR, |
1631 | 0, |
1632 | 0, |
1633 | - "Null", |
1634 | - OPEN_FRM_ONLY); |
1635 | + "Null"); |
1636 | if (is_nullable == NULL) |
1637 | { |
1638 | return true; |
1639 | @@ -333,8 +314,7 @@ |
1640 | DRIZZLE_TYPE_VARCHAR, |
1641 | 0, |
1642 | 0, |
1643 | - "", |
1644 | - OPEN_FRM_ONLY); |
1645 | + ""); |
1646 | if (data_type == NULL) |
1647 | { |
1648 | return true; |
1649 | @@ -345,8 +325,7 @@ |
1650 | DRIZZLE_TYPE_LONGLONG, |
1651 | 0, |
1652 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
1653 | - "", |
1654 | - OPEN_FRM_ONLY); |
1655 | + ""); |
1656 | if (max_len == NULL) |
1657 | { |
1658 | return true; |
1659 | @@ -357,8 +336,7 @@ |
1660 | DRIZZLE_TYPE_LONGLONG, |
1661 | 0, |
1662 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
1663 | - "", |
1664 | - OPEN_FRM_ONLY); |
1665 | + ""); |
1666 | if (octet_len == NULL) |
1667 | { |
1668 | return true; |
1669 | @@ -369,8 +347,7 @@ |
1670 | DRIZZLE_TYPE_LONGLONG, |
1671 | 0, |
1672 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
1673 | - "", |
1674 | - OPEN_FRM_ONLY); |
1675 | + ""); |
1676 | if (num_prec == NULL) |
1677 | { |
1678 | return true; |
1679 | @@ -381,8 +358,7 @@ |
1680 | DRIZZLE_TYPE_LONGLONG, |
1681 | 0, |
1682 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
1683 | - "", |
1684 | - OPEN_FRM_ONLY); |
1685 | + ""); |
1686 | if (num_scale == NULL) |
1687 | { |
1688 | return true; |
1689 | @@ -393,8 +369,7 @@ |
1690 | DRIZZLE_TYPE_VARCHAR, |
1691 | 0, |
1692 | 1, |
1693 | - "", |
1694 | - OPEN_FRM_ONLY); |
1695 | + ""); |
1696 | if (char_set_name == NULL) |
1697 | { |
1698 | return true; |
1699 | @@ -405,20 +380,19 @@ |
1700 | DRIZZLE_TYPE_VARCHAR, |
1701 | 0, |
1702 | 1, |
1703 | - "Collation", |
1704 | - OPEN_FRM_ONLY); |
1705 | + "Collation"); |
1706 | if (coll_name == NULL) |
1707 | { |
1708 | return true; |
1709 | } |
1710 | |
1711 | const drizzled::plugin::ColumnInfo *col_type= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_TYPE", |
1712 | - 65535, |
1713 | + 64, |
1714 | + //65535, |
1715 | DRIZZLE_TYPE_VARCHAR, |
1716 | 0, |
1717 | 0, |
1718 | - "Type", |
1719 | - OPEN_FRM_ONLY); |
1720 | + "Type"); |
1721 | if (col_type == NULL) |
1722 | { |
1723 | return true; |
1724 | @@ -429,8 +403,7 @@ |
1725 | DRIZZLE_TYPE_VARCHAR, |
1726 | 0, |
1727 | 0, |
1728 | - "Key", |
1729 | - OPEN_FRM_ONLY); |
1730 | + "Key"); |
1731 | if (col_key == NULL) |
1732 | { |
1733 | return true; |
1734 | @@ -441,8 +414,7 @@ |
1735 | DRIZZLE_TYPE_VARCHAR, |
1736 | 0, |
1737 | 0, |
1738 | - "Extra", |
1739 | - OPEN_FRM_ONLY); |
1740 | + "Extra"); |
1741 | if (extra == NULL) |
1742 | { |
1743 | return true; |
1744 | @@ -453,8 +425,7 @@ |
1745 | DRIZZLE_TYPE_VARCHAR, |
1746 | 0, |
1747 | 0, |
1748 | - "Privileges", |
1749 | - OPEN_FRM_ONLY); |
1750 | + "Privileges"); |
1751 | if (priv == NULL) |
1752 | { |
1753 | return true; |
1754 | @@ -465,8 +436,7 @@ |
1755 | DRIZZLE_TYPE_VARCHAR, |
1756 | 0, |
1757 | 0, |
1758 | - "Comment", |
1759 | - OPEN_FRM_ONLY); |
1760 | + "Comment"); |
1761 | if (col_comment == NULL) |
1762 | { |
1763 | return true; |
1764 | @@ -477,8 +447,7 @@ |
1765 | DRIZZLE_TYPE_VARCHAR, |
1766 | 0, |
1767 | 0, |
1768 | - "Storage", |
1769 | - OPEN_FRM_ONLY); |
1770 | + "Storage"); |
1771 | if (storage == NULL) |
1772 | { |
1773 | return true; |
1774 | @@ -489,8 +458,7 @@ |
1775 | DRIZZLE_TYPE_VARCHAR, |
1776 | 0, |
1777 | 0, |
1778 | - "Format", |
1779 | - OPEN_FRM_ONLY); |
1780 | + "Format"); |
1781 | if (format == NULL) |
1782 | { |
1783 | return true; |
1784 | @@ -531,8 +499,7 @@ |
1785 | DRIZZLE_TYPE_VARCHAR, |
1786 | 0, |
1787 | 1, |
1788 | - "", |
1789 | - OPEN_FULL_TABLE); |
1790 | + ""); |
1791 | if (cat == NULL) |
1792 | { |
1793 | return true; |
1794 | @@ -543,8 +510,7 @@ |
1795 | DRIZZLE_TYPE_VARCHAR, |
1796 | 0, |
1797 | 0, |
1798 | - "", |
1799 | - OPEN_FULL_TABLE); |
1800 | + ""); |
1801 | if (sch == NULL) |
1802 | { |
1803 | return true; |
1804 | @@ -555,8 +521,7 @@ |
1805 | DRIZZLE_TYPE_VARCHAR, |
1806 | 0, |
1807 | 0, |
1808 | - "", |
1809 | - OPEN_FULL_TABLE); |
1810 | + ""); |
1811 | if (name == NULL) |
1812 | { |
1813 | return true; |
1814 | @@ -567,8 +532,7 @@ |
1815 | DRIZZLE_TYPE_VARCHAR, |
1816 | 0, |
1817 | 1, |
1818 | - "", |
1819 | - OPEN_FULL_TABLE); |
1820 | + ""); |
1821 | if (tab_cat == NULL) |
1822 | { |
1823 | return true; |
1824 | @@ -579,8 +543,7 @@ |
1825 | DRIZZLE_TYPE_VARCHAR, |
1826 | 0, |
1827 | 0, |
1828 | - "", |
1829 | - OPEN_FULL_TABLE); |
1830 | + ""); |
1831 | if (tab_sch == NULL) |
1832 | { |
1833 | return true; |
1834 | @@ -591,8 +554,7 @@ |
1835 | DRIZZLE_TYPE_VARCHAR, |
1836 | 0, |
1837 | 0, |
1838 | - "", |
1839 | - OPEN_FULL_TABLE); |
1840 | + ""); |
1841 | if (tab_name == NULL) |
1842 | { |
1843 | return true; |
1844 | @@ -603,8 +565,7 @@ |
1845 | DRIZZLE_TYPE_VARCHAR, |
1846 | 0, |
1847 | 0, |
1848 | - "", |
1849 | - OPEN_FULL_TABLE); |
1850 | + ""); |
1851 | if (col_name == NULL) |
1852 | { |
1853 | return true; |
1854 | @@ -614,8 +575,7 @@ |
1855 | DRIZZLE_TYPE_LONGLONG, |
1856 | 0, |
1857 | 0, |
1858 | - "", |
1859 | - OPEN_FULL_TABLE); |
1860 | + ""); |
1861 | if (ord_pos == NULL) |
1862 | { |
1863 | return true; |
1864 | @@ -626,8 +586,7 @@ |
1865 | DRIZZLE_TYPE_LONGLONG, |
1866 | 0, |
1867 | 1, |
1868 | - "", |
1869 | - OPEN_FULL_TABLE); |
1870 | + ""); |
1871 | if (pos_in_uniq == NULL) |
1872 | { |
1873 | return true; |
1874 | @@ -638,8 +597,7 @@ |
1875 | DRIZZLE_TYPE_VARCHAR, |
1876 | 0, |
1877 | 1, |
1878 | - "", |
1879 | - OPEN_FULL_TABLE); |
1880 | + ""); |
1881 | if (ref_tab_sch == NULL) |
1882 | { |
1883 | return true; |
1884 | @@ -650,8 +608,7 @@ |
1885 | DRIZZLE_TYPE_VARCHAR, |
1886 | 0, |
1887 | 1, |
1888 | - "", |
1889 | - OPEN_FULL_TABLE); |
1890 | + ""); |
1891 | if (ref_tab_name == NULL) |
1892 | { |
1893 | return true; |
1894 | @@ -662,8 +619,7 @@ |
1895 | DRIZZLE_TYPE_VARCHAR, |
1896 | 0, |
1897 | 1, |
1898 | - "", |
1899 | - OPEN_FULL_TABLE); |
1900 | + ""); |
1901 | if (ref_col_name == NULL) |
1902 | { |
1903 | return true; |
1904 | @@ -692,8 +648,7 @@ |
1905 | DRIZZLE_TYPE_VARCHAR, |
1906 | 0, |
1907 | 0, |
1908 | - "Database", |
1909 | - SKIP_OPEN_TABLE); |
1910 | + "Database"); |
1911 | if (db == NULL) |
1912 | { |
1913 | return true; |
1914 | @@ -704,8 +659,7 @@ |
1915 | DRIZZLE_TYPE_VARCHAR, |
1916 | 0, |
1917 | 0, |
1918 | - "Table", |
1919 | - SKIP_OPEN_TABLE); |
1920 | + "Table"); |
1921 | if (tab == NULL) |
1922 | { |
1923 | return true; |
1924 | @@ -716,8 +670,7 @@ |
1925 | DRIZZLE_TYPE_LONGLONG, |
1926 | 0, |
1927 | 0, |
1928 | - "In_use", |
1929 | - SKIP_OPEN_TABLE); |
1930 | + "In_use"); |
1931 | if (in_use == NULL) |
1932 | { |
1933 | return true; |
1934 | @@ -728,8 +681,7 @@ |
1935 | DRIZZLE_TYPE_LONGLONG, |
1936 | 0, |
1937 | 0, |
1938 | - "Name_locked", |
1939 | - SKIP_OPEN_TABLE); |
1940 | + "Name_locked"); |
1941 | if (name_locked == NULL) |
1942 | { |
1943 | return true; |
1944 | @@ -750,8 +702,7 @@ |
1945 | DRIZZLE_TYPE_VARCHAR, |
1946 | 0, |
1947 | 0, |
1948 | - "Name", |
1949 | - SKIP_OPEN_TABLE); |
1950 | + "Name"); |
1951 | if (name == NULL) |
1952 | { |
1953 | return true; |
1954 | @@ -762,8 +713,7 @@ |
1955 | DRIZZLE_TYPE_VARCHAR, |
1956 | 0, |
1957 | 0, |
1958 | - "", |
1959 | - SKIP_OPEN_TABLE); |
1960 | + ""); |
1961 | if (ver == NULL) |
1962 | { |
1963 | return true; |
1964 | @@ -774,8 +724,7 @@ |
1965 | DRIZZLE_TYPE_VARCHAR, |
1966 | 0, |
1967 | 0, |
1968 | - "Status", |
1969 | - SKIP_OPEN_TABLE); |
1970 | + "Status"); |
1971 | if (stat == NULL) |
1972 | { |
1973 | return true; |
1974 | @@ -786,20 +735,19 @@ |
1975 | DRIZZLE_TYPE_VARCHAR, |
1976 | 0, |
1977 | 1, |
1978 | - "", |
1979 | - SKIP_OPEN_TABLE); |
1980 | + ""); |
1981 | if (aut == NULL) |
1982 | { |
1983 | return true; |
1984 | } |
1985 | |
1986 | const drizzled::plugin::ColumnInfo *descrip= new(std::nothrow) drizzled::plugin::ColumnInfo("PLUGIN_DESCRIPTION", |
1987 | - 65535, |
1988 | + 64, |
1989 | + //65535, |
1990 | DRIZZLE_TYPE_VARCHAR, |
1991 | 0, |
1992 | 1, |
1993 | - "", |
1994 | - SKIP_OPEN_TABLE); |
1995 | + ""); |
1996 | if (descrip == NULL) |
1997 | { |
1998 | return true; |
1999 | @@ -810,8 +758,7 @@ |
2000 | DRIZZLE_TYPE_VARCHAR, |
2001 | 0, |
2002 | 1, |
2003 | - "License", |
2004 | - SKIP_OPEN_TABLE); |
2005 | + "License"); |
2006 | if (lic == NULL) |
2007 | { |
2008 | return true; |
2009 | @@ -837,8 +784,7 @@ |
2010 | DRIZZLE_TYPE_LONGLONG, |
2011 | 0, |
2012 | 0, |
2013 | - "Id", |
2014 | - SKIP_OPEN_TABLE); |
2015 | + "Id"); |
2016 | if (id_col == NULL) |
2017 | { |
2018 | return true; |
2019 | @@ -849,8 +795,7 @@ |
2020 | DRIZZLE_TYPE_VARCHAR, |
2021 | 0, |
2022 | 0, |
2023 | - "User", |
2024 | - SKIP_OPEN_TABLE); |
2025 | + "User"); |
2026 | if (user_col == NULL) |
2027 | { |
2028 | return true; |
2029 | @@ -861,8 +806,7 @@ |
2030 | DRIZZLE_TYPE_VARCHAR, |
2031 | 0, |
2032 | 0, |
2033 | - "Host", |
2034 | - SKIP_OPEN_TABLE); |
2035 | + "Host"); |
2036 | if (host_col == NULL) |
2037 | { |
2038 | return true; |
2039 | @@ -873,8 +817,7 @@ |
2040 | DRIZZLE_TYPE_VARCHAR, |
2041 | 0, |
2042 | 1, |
2043 | - "Db", |
2044 | - SKIP_OPEN_TABLE); |
2045 | + "Db"); |
2046 | if (db_col == NULL) |
2047 | { |
2048 | return true; |
2049 | @@ -885,8 +828,7 @@ |
2050 | DRIZZLE_TYPE_VARCHAR, |
2051 | 0, |
2052 | 0, |
2053 | - "Command", |
2054 | - SKIP_OPEN_TABLE); |
2055 | + "Command"); |
2056 | if (command_col == NULL) |
2057 | { |
2058 | return true; |
2059 | @@ -897,8 +839,7 @@ |
2060 | DRIZZLE_TYPE_LONGLONG, |
2061 | 0, |
2062 | 0, |
2063 | - "Time", |
2064 | - SKIP_OPEN_TABLE); |
2065 | + "Time"); |
2066 | if (time_col == NULL) |
2067 | { |
2068 | return true; |
2069 | @@ -909,8 +850,7 @@ |
2070 | DRIZZLE_TYPE_VARCHAR, |
2071 | 0, |
2072 | 1, |
2073 | - "State", |
2074 | - SKIP_OPEN_TABLE); |
2075 | + "State"); |
2076 | if (state_col == NULL) |
2077 | { |
2078 | return true; |
2079 | @@ -921,8 +861,7 @@ |
2080 | DRIZZLE_TYPE_VARCHAR, |
2081 | 0, |
2082 | 1, |
2083 | - "Info", |
2084 | - SKIP_OPEN_TABLE); |
2085 | + "Info"); |
2086 | if (info_col == NULL) |
2087 | { |
2088 | return true; |
2089 | @@ -953,8 +892,7 @@ |
2090 | DRIZZLE_TYPE_VARCHAR, |
2091 | 0, |
2092 | 1, |
2093 | - "", |
2094 | - OPEN_FULL_TABLE); |
2095 | + ""); |
2096 | |
2097 | if (cat == NULL) |
2098 | { |
2099 | @@ -966,8 +904,7 @@ |
2100 | DRIZZLE_TYPE_VARCHAR, |
2101 | 0, |
2102 | 0, |
2103 | - "", |
2104 | - OPEN_FULL_TABLE); |
2105 | + ""); |
2106 | if (sch == NULL) |
2107 | { |
2108 | return true; |
2109 | @@ -978,8 +915,7 @@ |
2110 | DRIZZLE_TYPE_VARCHAR, |
2111 | 0, |
2112 | 0, |
2113 | - "", |
2114 | - OPEN_FULL_TABLE); |
2115 | + ""); |
2116 | if (name == NULL) |
2117 | { |
2118 | return true; |
2119 | @@ -990,8 +926,7 @@ |
2120 | DRIZZLE_TYPE_VARCHAR, |
2121 | 0, |
2122 | 1, |
2123 | - "", |
2124 | - OPEN_FULL_TABLE); |
2125 | + ""); |
2126 | if (uniq_cat == NULL) |
2127 | { |
2128 | return true; |
2129 | @@ -1002,8 +937,7 @@ |
2130 | DRIZZLE_TYPE_VARCHAR, |
2131 | 0, |
2132 | 0, |
2133 | - "", |
2134 | - OPEN_FULL_TABLE); |
2135 | + ""); |
2136 | if (uniq_sch == NULL) |
2137 | { |
2138 | return true; |
2139 | @@ -1014,8 +948,7 @@ |
2140 | DRIZZLE_TYPE_VARCHAR, |
2141 | 0, |
2142 | MY_I_S_MAYBE_NULL, |
2143 | - "", |
2144 | - OPEN_FULL_TABLE); |
2145 | + ""); |
2146 | if (uniq_name == NULL) |
2147 | { |
2148 | return true; |
2149 | @@ -1026,8 +959,7 @@ |
2150 | DRIZZLE_TYPE_VARCHAR, |
2151 | 0, |
2152 | 0, |
2153 | - "", |
2154 | - OPEN_FULL_TABLE); |
2155 | + ""); |
2156 | if (match == NULL) |
2157 | { |
2158 | return true; |
2159 | @@ -1038,8 +970,7 @@ |
2160 | DRIZZLE_TYPE_VARCHAR, |
2161 | 0, |
2162 | 0, |
2163 | - "", |
2164 | - OPEN_FULL_TABLE); |
2165 | + ""); |
2166 | if (update == NULL) |
2167 | { |
2168 | return true; |
2169 | @@ -1050,8 +981,7 @@ |
2170 | DRIZZLE_TYPE_VARCHAR, |
2171 | 0, |
2172 | 0, |
2173 | - "", |
2174 | - OPEN_FULL_TABLE); |
2175 | + ""); |
2176 | if (del_rule == NULL) |
2177 | { |
2178 | return true; |
2179 | @@ -1062,8 +992,7 @@ |
2180 | DRIZZLE_TYPE_VARCHAR, |
2181 | 0, |
2182 | 0, |
2183 | - "", |
2184 | - OPEN_FULL_TABLE); |
2185 | + ""); |
2186 | if (tab_name == NULL) |
2187 | { |
2188 | return true; |
2189 | @@ -1074,8 +1003,7 @@ |
2190 | DRIZZLE_TYPE_VARCHAR, |
2191 | 0, |
2192 | 0, |
2193 | - "", |
2194 | - OPEN_FULL_TABLE); |
2195 | + ""); |
2196 | if (ref_name == NULL) |
2197 | { |
2198 | return true; |
2199 | @@ -1106,8 +1034,7 @@ |
2200 | DRIZZLE_TYPE_VARCHAR, |
2201 | 0, |
2202 | 1, |
2203 | - "", |
2204 | - SKIP_OPEN_TABLE); |
2205 | + ""); |
2206 | if (cat_name == NULL) |
2207 | { |
2208 | return true; |
2209 | @@ -1118,8 +1045,7 @@ |
2210 | DRIZZLE_TYPE_VARCHAR, |
2211 | 0, |
2212 | 0, |
2213 | - "Database", |
2214 | - SKIP_OPEN_TABLE); |
2215 | + "Database"); |
2216 | if (sch_name == NULL) |
2217 | { |
2218 | return true; |
2219 | @@ -1130,8 +1056,7 @@ |
2220 | DRIZZLE_TYPE_VARCHAR, |
2221 | 0, |
2222 | 0, |
2223 | - "", |
2224 | - SKIP_OPEN_TABLE); |
2225 | + ""); |
2226 | if (cs_name == NULL) |
2227 | { |
2228 | return true; |
2229 | @@ -1142,8 +1067,7 @@ |
2230 | DRIZZLE_TYPE_VARCHAR, |
2231 | 0, |
2232 | 0, |
2233 | - "", |
2234 | - SKIP_OPEN_TABLE); |
2235 | + ""); |
2236 | if (coll_name == NULL) |
2237 | { |
2238 | return true; |
2239 | @@ -1154,8 +1078,7 @@ |
2240 | DRIZZLE_TYPE_VARCHAR, |
2241 | 0, |
2242 | 1, |
2243 | - "", |
2244 | - SKIP_OPEN_TABLE); |
2245 | + ""); |
2246 | if (sql_path == NULL) |
2247 | { |
2248 | return true; |
2249 | @@ -1177,8 +1100,7 @@ |
2250 | DRIZZLE_TYPE_VARCHAR, |
2251 | 0, |
2252 | 1, |
2253 | - "", |
2254 | - OPEN_FRM_ONLY); |
2255 | + ""); |
2256 | if (cat == NULL) |
2257 | { |
2258 | return true; |
2259 | @@ -1189,8 +1111,7 @@ |
2260 | DRIZZLE_TYPE_VARCHAR, |
2261 | 0, |
2262 | 0, |
2263 | - "", |
2264 | - OPEN_FRM_ONLY); |
2265 | + ""); |
2266 | if (sch == NULL) |
2267 | { |
2268 | return true; |
2269 | @@ -1201,8 +1122,7 @@ |
2270 | DRIZZLE_TYPE_VARCHAR, |
2271 | 0, |
2272 | 0, |
2273 | - "Table", |
2274 | - OPEN_FRM_ONLY); |
2275 | + "Table"); |
2276 | if (name == NULL) |
2277 | { |
2278 | return true; |
2279 | @@ -1213,8 +1133,7 @@ |
2280 | DRIZZLE_TYPE_LONGLONG, |
2281 | 0, |
2282 | 0, |
2283 | - "Non_unique", |
2284 | - OPEN_FRM_ONLY); |
2285 | + "Non_unique"); |
2286 | if (uniq == NULL) |
2287 | { |
2288 | return true; |
2289 | @@ -1225,8 +1144,7 @@ |
2290 | DRIZZLE_TYPE_VARCHAR, |
2291 | 0, |
2292 | 0, |
2293 | - "", |
2294 | - OPEN_FRM_ONLY); |
2295 | + ""); |
2296 | if (idx_sch == NULL) |
2297 | { |
2298 | return true; |
2299 | @@ -1237,8 +1155,7 @@ |
2300 | DRIZZLE_TYPE_VARCHAR, |
2301 | 0, |
2302 | 0, |
2303 | - "Key_name", |
2304 | - OPEN_FRM_ONLY); |
2305 | + "Key_name"); |
2306 | if (idx_name == NULL) |
2307 | { |
2308 | return true; |
2309 | @@ -1249,8 +1166,7 @@ |
2310 | DRIZZLE_TYPE_LONGLONG, |
2311 | 0, |
2312 | 0, |
2313 | - "Seq_in_index", |
2314 | - OPEN_FRM_ONLY); |
2315 | + "Seq_in_index"); |
2316 | if (seq_in_idx == NULL) |
2317 | { |
2318 | return true; |
2319 | @@ -1261,8 +1177,7 @@ |
2320 | DRIZZLE_TYPE_VARCHAR, |
2321 | 0, |
2322 | 0, |
2323 | - "Column_name", |
2324 | - OPEN_FRM_ONLY); |
2325 | + "Column_name"); |
2326 | if (col_name == NULL) |
2327 | { |
2328 | return true; |
2329 | @@ -1273,8 +1188,7 @@ |
2330 | DRIZZLE_TYPE_VARCHAR, |
2331 | 0, |
2332 | 1, |
2333 | - "Collation", |
2334 | - OPEN_FRM_ONLY); |
2335 | + "Collation"); |
2336 | if (coll == NULL) |
2337 | { |
2338 | return true; |
2339 | @@ -1285,8 +1199,7 @@ |
2340 | DRIZZLE_TYPE_LONGLONG, |
2341 | 0, |
2342 | 1, |
2343 | - "Cardinality", |
2344 | - OPEN_FULL_TABLE); |
2345 | + "Cardinality"); |
2346 | if (card == NULL) |
2347 | { |
2348 | return true; |
2349 | @@ -1297,8 +1210,7 @@ |
2350 | DRIZZLE_TYPE_LONGLONG, |
2351 | 0, |
2352 | 1, |
2353 | - "Sub_part", |
2354 | - OPEN_FRM_ONLY); |
2355 | + "Sub_part"); |
2356 | if (sub_part == NULL) |
2357 | { |
2358 | return true; |
2359 | @@ -1309,8 +1221,7 @@ |
2360 | DRIZZLE_TYPE_VARCHAR, |
2361 | 0, |
2362 | 1, |
2363 | - "Packed", |
2364 | - OPEN_FRM_ONLY); |
2365 | + "Packed"); |
2366 | if (packed == NULL) |
2367 | { |
2368 | return true; |
2369 | @@ -1321,8 +1232,7 @@ |
2370 | DRIZZLE_TYPE_VARCHAR, |
2371 | 0, |
2372 | 0, |
2373 | - "Null", |
2374 | - OPEN_FRM_ONLY); |
2375 | + "Null"); |
2376 | if (nullable == NULL) |
2377 | { |
2378 | return true; |
2379 | @@ -1333,8 +1243,7 @@ |
2380 | DRIZZLE_TYPE_VARCHAR, |
2381 | 0, |
2382 | 0, |
2383 | - "Index_type", |
2384 | - OPEN_FULL_TABLE); |
2385 | + "Index_type"); |
2386 | if (idx_type == NULL) |
2387 | { |
2388 | return true; |
2389 | @@ -1345,8 +1254,7 @@ |
2390 | DRIZZLE_TYPE_VARCHAR, |
2391 | 0, |
2392 | 1, |
2393 | - "Comment", |
2394 | - OPEN_FRM_ONLY); |
2395 | + "Comment"); |
2396 | if (comment == NULL) |
2397 | { |
2398 | return true; |
2399 | @@ -1357,8 +1265,7 @@ |
2400 | DRIZZLE_TYPE_VARCHAR, |
2401 | 0, |
2402 | 0, |
2403 | - "Index_Comment", |
2404 | - OPEN_FRM_ONLY); |
2405 | + "Index_Comment"); |
2406 | if (idx_comment == NULL) |
2407 | { |
2408 | return true; |
2409 | @@ -1391,8 +1298,7 @@ |
2410 | DRIZZLE_TYPE_VARCHAR, |
2411 | 0, |
2412 | 0, |
2413 | - "Variable_name", |
2414 | - SKIP_OPEN_TABLE); |
2415 | + "Variable_name"); |
2416 | if (name == NULL) |
2417 | { |
2418 | return true; |
2419 | @@ -1403,8 +1309,7 @@ |
2420 | DRIZZLE_TYPE_VARCHAR, |
2421 | 0, |
2422 | 1, |
2423 | - "Value", |
2424 | - SKIP_OPEN_TABLE); |
2425 | + "Value"); |
2426 | if (value == NULL) |
2427 | { |
2428 | return true; |
2429 | @@ -1423,8 +1328,7 @@ |
2430 | DRIZZLE_TYPE_VARCHAR, |
2431 | 0, |
2432 | 1, |
2433 | - "", |
2434 | - OPEN_FULL_TABLE); |
2435 | + ""); |
2436 | if (cat == NULL) |
2437 | { |
2438 | return true; |
2439 | @@ -1435,8 +1339,7 @@ |
2440 | DRIZZLE_TYPE_VARCHAR, |
2441 | 0, |
2442 | 0, |
2443 | - "", |
2444 | - OPEN_FULL_TABLE); |
2445 | + ""); |
2446 | if (sch == NULL) |
2447 | { |
2448 | return true; |
2449 | @@ -1447,8 +1350,7 @@ |
2450 | DRIZZLE_TYPE_VARCHAR, |
2451 | 0, |
2452 | 0, |
2453 | - "", |
2454 | - OPEN_FULL_TABLE); |
2455 | + ""); |
2456 | if (name == NULL) |
2457 | { |
2458 | return true; |
2459 | @@ -1459,8 +1361,7 @@ |
2460 | DRIZZLE_TYPE_VARCHAR, |
2461 | 0, |
2462 | 0, |
2463 | - "", |
2464 | - OPEN_FULL_TABLE); |
2465 | + ""); |
2466 | if (tab_sch == NULL) |
2467 | { |
2468 | return true; |
2469 | @@ -1471,8 +1372,7 @@ |
2470 | DRIZZLE_TYPE_VARCHAR, |
2471 | 0, |
2472 | 0, |
2473 | - "", |
2474 | - OPEN_FULL_TABLE); |
2475 | + ""); |
2476 | if (tab_name == NULL) |
2477 | { |
2478 | return true; |
2479 | @@ -1483,8 +1383,7 @@ |
2480 | DRIZZLE_TYPE_VARCHAR, |
2481 | 0, |
2482 | 0, |
2483 | - "", |
2484 | - OPEN_FULL_TABLE); |
2485 | + ""); |
2486 | if (type == NULL) |
2487 | { |
2488 | return true; |
2489 | @@ -1507,8 +1406,7 @@ |
2490 | DRIZZLE_TYPE_VARCHAR, |
2491 | 0, |
2492 | 1, |
2493 | - "", |
2494 | - SKIP_OPEN_TABLE); |
2495 | + ""); |
2496 | if (cat == NULL) |
2497 | { |
2498 | return true; |
2499 | @@ -1519,8 +1417,7 @@ |
2500 | DRIZZLE_TYPE_VARCHAR, |
2501 | 0, |
2502 | 0, |
2503 | - "", |
2504 | - SKIP_OPEN_TABLE); |
2505 | + ""); |
2506 | if (sch == NULL) |
2507 | { |
2508 | return true; |
2509 | @@ -1531,8 +1428,7 @@ |
2510 | DRIZZLE_TYPE_VARCHAR, |
2511 | 0, |
2512 | 0, |
2513 | - "Name", |
2514 | - SKIP_OPEN_TABLE); |
2515 | + "Name"); |
2516 | if (name == NULL) |
2517 | { |
2518 | return true; |
2519 | @@ -1543,8 +1439,7 @@ |
2520 | DRIZZLE_TYPE_VARCHAR, |
2521 | 0, |
2522 | 0, |
2523 | - "", |
2524 | - OPEN_FRM_ONLY); |
2525 | + ""); |
2526 | if (type == NULL) |
2527 | { |
2528 | return true; |
2529 | @@ -1555,8 +1450,7 @@ |
2530 | DRIZZLE_TYPE_VARCHAR, |
2531 | 0, |
2532 | 1, |
2533 | - "Engine", |
2534 | - OPEN_FRM_ONLY); |
2535 | + "Engine"); |
2536 | if (engine == NULL) |
2537 | { |
2538 | return true; |
2539 | @@ -1567,8 +1461,7 @@ |
2540 | DRIZZLE_TYPE_LONGLONG, |
2541 | 0, |
2542 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2543 | - "Version", |
2544 | - OPEN_FRM_ONLY); |
2545 | + "Version"); |
2546 | if (version == NULL) |
2547 | { |
2548 | return true; |
2549 | @@ -1579,8 +1472,7 @@ |
2550 | DRIZZLE_TYPE_VARCHAR, |
2551 | 0, |
2552 | 1, |
2553 | - "Row_format", |
2554 | - OPEN_FULL_TABLE); |
2555 | + "Row_format"); |
2556 | if (row_format == NULL) |
2557 | { |
2558 | return true; |
2559 | @@ -1591,8 +1483,7 @@ |
2560 | DRIZZLE_TYPE_LONGLONG, |
2561 | 0, |
2562 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2563 | - "Rows", |
2564 | - OPEN_FULL_TABLE); |
2565 | + "Rows"); |
2566 | if (tab_rows == NULL) |
2567 | { |
2568 | return true; |
2569 | @@ -1603,8 +1494,7 @@ |
2570 | DRIZZLE_TYPE_LONGLONG, |
2571 | 0, |
2572 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2573 | - "Avg_row_length", |
2574 | - OPEN_FULL_TABLE); |
2575 | + "Avg_row_length"); |
2576 | if (avg_row_len == NULL) |
2577 | { |
2578 | return true; |
2579 | @@ -1615,8 +1505,7 @@ |
2580 | DRIZZLE_TYPE_LONGLONG, |
2581 | 0, |
2582 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2583 | - "Data_length", |
2584 | - OPEN_FULL_TABLE); |
2585 | + "Data_length"); |
2586 | if (data_len == NULL) |
2587 | { |
2588 | return true; |
2589 | @@ -1627,8 +1516,7 @@ |
2590 | DRIZZLE_TYPE_LONGLONG, |
2591 | 0, |
2592 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2593 | - "Max_data_length", |
2594 | - OPEN_FULL_TABLE); |
2595 | + "Max_data_length"); |
2596 | if (max_data_len == NULL) |
2597 | { |
2598 | return true; |
2599 | @@ -1639,8 +1527,7 @@ |
2600 | DRIZZLE_TYPE_LONGLONG, |
2601 | 0, |
2602 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2603 | - "Index_length", |
2604 | - OPEN_FULL_TABLE); |
2605 | + "Index_length"); |
2606 | if (idx_len == NULL) |
2607 | { |
2608 | return true; |
2609 | @@ -1651,8 +1538,7 @@ |
2610 | DRIZZLE_TYPE_LONGLONG, |
2611 | 0, |
2612 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2613 | - "Data_free", |
2614 | - OPEN_FULL_TABLE); |
2615 | + "Data_free"); |
2616 | if (data_free == NULL) |
2617 | { |
2618 | return true; |
2619 | @@ -1663,8 +1549,7 @@ |
2620 | DRIZZLE_TYPE_LONGLONG, |
2621 | 0, |
2622 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2623 | - "Auto_increment", |
2624 | - OPEN_FULL_TABLE); |
2625 | + "Auto_increment"); |
2626 | if (auto_inc == NULL) |
2627 | { |
2628 | return true; |
2629 | @@ -1675,8 +1560,7 @@ |
2630 | DRIZZLE_TYPE_DATETIME, |
2631 | 0, |
2632 | 1, |
2633 | - "Create_time", |
2634 | - OPEN_FULL_TABLE); |
2635 | + "Create_time"); |
2636 | if (create_time == NULL) |
2637 | { |
2638 | return true; |
2639 | @@ -1687,8 +1571,7 @@ |
2640 | DRIZZLE_TYPE_DATETIME, |
2641 | 0, |
2642 | 1, |
2643 | - "Update_time", |
2644 | - OPEN_FULL_TABLE); |
2645 | + "Update_time"); |
2646 | if (update_time == NULL) |
2647 | { |
2648 | return true; |
2649 | @@ -1699,8 +1582,7 @@ |
2650 | DRIZZLE_TYPE_DATETIME, |
2651 | 0, |
2652 | 1, |
2653 | - "Check_time", |
2654 | - OPEN_FULL_TABLE); |
2655 | + "Check_time"); |
2656 | if (check_time == NULL) |
2657 | { |
2658 | return true; |
2659 | @@ -1711,8 +1593,7 @@ |
2660 | DRIZZLE_TYPE_VARCHAR, |
2661 | 0, |
2662 | 1, |
2663 | - "Collation", |
2664 | - OPEN_FRM_ONLY); |
2665 | + "Collation"); |
2666 | if (table_coll == NULL) |
2667 | { |
2668 | return true; |
2669 | @@ -1723,8 +1604,7 @@ |
2670 | DRIZZLE_TYPE_LONGLONG, |
2671 | 0, |
2672 | (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), |
2673 | - "Checksum", |
2674 | - OPEN_FULL_TABLE); |
2675 | + "Checksum"); |
2676 | if (checksum == NULL) |
2677 | { |
2678 | return true; |
2679 | @@ -1735,8 +1615,7 @@ |
2680 | DRIZZLE_TYPE_VARCHAR, |
2681 | 0, |
2682 | 1, |
2683 | - "Create_options", |
2684 | - OPEN_FRM_ONLY); |
2685 | + "Create_options"); |
2686 | if (create_opt == NULL) |
2687 | { |
2688 | return true; |
2689 | @@ -1747,8 +1626,7 @@ |
2690 | DRIZZLE_TYPE_VARCHAR, |
2691 | 0, |
2692 | 0, |
2693 | - "Comment", |
2694 | - OPEN_FRM_ONLY); |
2695 | + "Comment"); |
2696 | if (tab_comment == NULL) |
2697 | { |
2698 | return true; |
2699 | @@ -1787,8 +1665,7 @@ |
2700 | DRIZZLE_TYPE_VARCHAR, |
2701 | 0, |
2702 | 1, |
2703 | - "", |
2704 | - SKIP_OPEN_TABLE); |
2705 | + ""); |
2706 | if (cat == NULL) |
2707 | { |
2708 | return true; |
2709 | @@ -1799,8 +1676,7 @@ |
2710 | DRIZZLE_TYPE_VARCHAR, |
2711 | 0, |
2712 | 0, |
2713 | - "", |
2714 | - SKIP_OPEN_TABLE); |
2715 | + ""); |
2716 | if (sch == NULL) |
2717 | { |
2718 | return true; |
2719 | @@ -1811,8 +1687,7 @@ |
2720 | DRIZZLE_TYPE_VARCHAR, |
2721 | 0, |
2722 | 0, |
2723 | - "Tables_in_", |
2724 | - SKIP_OPEN_TABLE); |
2725 | + "Tables_in_"); |
2726 | if (name == NULL) |
2727 | { |
2728 | return true; |
2729 | @@ -1823,8 +1698,7 @@ |
2730 | DRIZZLE_TYPE_VARCHAR, |
2731 | 0, |
2732 | 0, |
2733 | - "Table_type", |
2734 | - OPEN_FRM_ONLY); |
2735 | + "Table_type"); |
2736 | if (type == NULL) |
2737 | { |
2738 | return true; |
2739 | |
2740 | === modified file 'plugin/info_schema/info_schema_methods.cc' |
2741 | --- plugin/info_schema/info_schema_methods.cc 2009-10-16 00:38:56 +0000 |
2742 | +++ plugin/info_schema/info_schema_methods.cc 2009-10-29 23:56:14 +0000 |
2743 | @@ -29,6 +29,7 @@ |
2744 | #include <drizzled/tztime.h> |
2745 | #include <drizzled/sql_base.h> |
2746 | #include <drizzled/plugin/client.h> |
2747 | +#include <drizzled/join_table.h> |
2748 | |
2749 | #include "info_schema_methods.h" |
2750 | |
2751 | @@ -36,6 +37,7 @@ |
2752 | #include <string> |
2753 | |
2754 | using namespace std; |
2755 | +using namespace drizzled; |
2756 | |
2757 | static inline void make_upper(char *buf) |
2758 | { |
2759 | @@ -186,6 +188,9 @@ |
2760 | break; |
2761 | } |
2762 | table->restoreRecordAsDefault(); |
2763 | + table->setWriteSet(0); |
2764 | + table->setWriteSet(1); |
2765 | + table->setWriteSet(2); |
2766 | table->field[0]->store(name_buffer, strlen(name_buffer), |
2767 | system_charset_info); |
2768 | table->field[1]->store(pos, (uint32_t) (end - pos), system_charset_info); |
2769 | @@ -193,8 +198,8 @@ |
2770 | |
2771 | pthread_mutex_unlock(&LOCK_global_system_variables); |
2772 | |
2773 | - if (schema_table_store_record(session, table)) |
2774 | - return true; |
2775 | + TableList *tmp_list= table->pos_in_table_list; |
2776 | + tmp_list->schema_table->addRow(table->record[0], table->s->reclength); |
2777 | } |
2778 | } |
2779 | } |
2780 | @@ -202,7 +207,7 @@ |
2781 | return false; |
2782 | } |
2783 | |
2784 | -int CharSetISMethods::fillTable(Session *session, TableList *tables, COND *) |
2785 | +int CharSetISMethods::fillTable(Session *session, TableList *tables) |
2786 | { |
2787 | CHARSET_INFO **cs; |
2788 | const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL; |
2789 | @@ -220,13 +225,17 @@ |
2790 | { |
2791 | const char *comment; |
2792 | table->restoreRecordAsDefault(); |
2793 | + /* set the appropriate bits in the write bitset */ |
2794 | + table->setWriteSet(0); |
2795 | + table->setWriteSet(1); |
2796 | + table->setWriteSet(2); |
2797 | + table->setWriteSet(3); |
2798 | table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs); |
2799 | table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs); |
2800 | comment= tmp_cs->comment ? tmp_cs->comment : ""; |
2801 | table->field[2]->store(comment, strlen(comment), scs); |
2802 | table->field[3]->store((int64_t) tmp_cs->mbmaxlen, true); |
2803 | - if (schema_table_store_record(session, table)) |
2804 | - return 1; |
2805 | + tables->schema_table->addRow(table->record[0], table->s->reclength); |
2806 | } |
2807 | } |
2808 | return 0; |
2809 | @@ -258,7 +267,7 @@ |
2810 | return 0; |
2811 | } |
2812 | |
2813 | -int CollationISMethods::fillTable(Session *session, TableList *tables, COND *) |
2814 | +int CollationISMethods::fillTable(Session *session, TableList *tables) |
2815 | { |
2816 | CHARSET_INFO **cs; |
2817 | const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL; |
2818 | @@ -283,6 +292,13 @@ |
2819 | { |
2820 | const char *tmp_buff; |
2821 | table->restoreRecordAsDefault(); |
2822 | + /* set the appropriate bits in the write bitset */ |
2823 | + table->setWriteSet(0); |
2824 | + table->setWriteSet(1); |
2825 | + table->setWriteSet(2); |
2826 | + table->setWriteSet(3); |
2827 | + table->setWriteSet(4); |
2828 | + table->setWriteSet(5); |
2829 | table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs); |
2830 | table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs); |
2831 | table->field[2]->store((int64_t) tmp_cl->number, true); |
2832 | @@ -291,15 +307,14 @@ |
2833 | tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : ""; |
2834 | table->field[4]->store(tmp_buff, strlen(tmp_buff), scs); |
2835 | table->field[5]->store((int64_t) tmp_cl->strxfrm_multiply, true); |
2836 | - if (schema_table_store_record(session, table)) |
2837 | - return 1; |
2838 | + tables->schema_table->addRow(table->record[0], table->s->reclength); |
2839 | } |
2840 | } |
2841 | } |
2842 | return 0; |
2843 | } |
2844 | |
2845 | -int CollCharISMethods::fillTable(Session *session, TableList *tables, COND *) |
2846 | +int CollCharISMethods::fillTable(Session *, TableList *tables) |
2847 | { |
2848 | CHARSET_INFO **cs; |
2849 | Table *table= tables->table; |
2850 | @@ -318,10 +333,11 @@ |
2851 | ! my_charset_same(tmp_cs,tmp_cl)) |
2852 | continue; |
2853 | table->restoreRecordAsDefault(); |
2854 | + table->setWriteSet(0); |
2855 | + table->setWriteSet(1); |
2856 | table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs); |
2857 | table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs); |
2858 | - if (schema_table_store_record(session, table)) |
2859 | - return 1; |
2860 | + tables->schema_table->addRow(table->record[0], table->s->reclength); |
2861 | } |
2862 | } |
2863 | return 0; |
2864 | @@ -367,6 +383,13 @@ |
2865 | int64_t idx) |
2866 | { |
2867 | const CHARSET_INFO * const cs= system_charset_info; |
2868 | + /* set the appropriate bits in the write bitset */ |
2869 | + table->setWriteSet(1); |
2870 | + table->setWriteSet(2); |
2871 | + table->setWriteSet(4); |
2872 | + table->setWriteSet(5); |
2873 | + table->setWriteSet(6); |
2874 | + table->setWriteSet(7); |
2875 | table->field[1]->store(db_name->str, db_name->length, cs); |
2876 | table->field[2]->store(key_name, key_len, cs); |
2877 | table->field[4]->store(db_name->str, db_name->length, cs); |
2878 | @@ -375,11 +398,12 @@ |
2879 | table->field[7]->store((int64_t) idx, true); |
2880 | } |
2881 | |
2882 | -int KeyColUsageISMethods::processTable(Session *session, |
2883 | - TableList *tables, |
2884 | - Table *table, bool res, |
2885 | - LEX_STRING *db_name, |
2886 | - LEX_STRING *table_name) const |
2887 | +int KeyColUsageISMethods::processTable(plugin::InfoSchemaTable *, |
2888 | + Session *session, |
2889 | + TableList *tables, |
2890 | + Table *table, bool res, |
2891 | + LEX_STRING *db_name, |
2892 | + LEX_STRING *table_name) |
2893 | { |
2894 | if (res) |
2895 | { |
2896 | @@ -418,10 +442,8 @@ |
2897 | key_part->field->field_name, |
2898 | strlen(key_part->field->field_name), |
2899 | (int64_t) f_idx); |
2900 | - if (schema_table_store_record(session, table)) |
2901 | - { |
2902 | - return (1); |
2903 | - } |
2904 | + tables->schema_table->addRow(table->record[0], |
2905 | + table->s->reclength); |
2906 | } |
2907 | } |
2908 | } |
2909 | @@ -446,6 +468,10 @@ |
2910 | f_key_info->forein_id->length, |
2911 | f_info->str, f_info->length, |
2912 | (int64_t) f_idx); |
2913 | + table->setWriteSet(8); |
2914 | + table->setWriteSet(9); |
2915 | + table->setWriteSet(10); |
2916 | + table->setWriteSet(11); |
2917 | table->field[8]->store((int64_t) f_idx, true); |
2918 | table->field[8]->set_notnull(); |
2919 | table->field[9]->store(f_key_info->referenced_db->str, |
2920 | @@ -459,10 +485,8 @@ |
2921 | table->field[11]->store(r_info->str, r_info->length, |
2922 | system_charset_info); |
2923 | table->field[11]->set_notnull(); |
2924 | - if (schema_table_store_record(session, table)) |
2925 | - { |
2926 | - return (1); |
2927 | - } |
2928 | + tables->schema_table->addRow(table->record[0], |
2929 | + table->s->reclength); |
2930 | } |
2931 | } |
2932 | } |
2933 | @@ -473,17 +497,21 @@ |
2934 | inline bool open_list_store(Table *table, open_table_list_st& open_list) |
2935 | { |
2936 | table->restoreRecordAsDefault(); |
2937 | + table->setWriteSet(0); |
2938 | + table->setWriteSet(1); |
2939 | + table->setWriteSet(2); |
2940 | + table->setWriteSet(3); |
2941 | table->field[0]->store(open_list.db.c_str(), open_list.db.length(), system_charset_info); |
2942 | table->field[1]->store(open_list.table.c_str(), open_list.table.length(), system_charset_info); |
2943 | table->field[2]->store((int64_t) open_list.in_use, true); |
2944 | table->field[3]->store((int64_t) open_list.locked, true); |
2945 | - if (schema_table_store_record(table->in_use, table)) |
2946 | - return true; |
2947 | + TableList *tmp= table->pos_in_table_list; |
2948 | + tmp->schema_table->addRow(table->record[0], table->s->reclength); |
2949 | |
2950 | return false; |
2951 | } |
2952 | |
2953 | -int OpenTablesISMethods::fillTable(Session *session, TableList *tables, COND *) |
2954 | +int OpenTablesISMethods::fillTable(Session *session, TableList *tables) |
2955 | { |
2956 | const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL; |
2957 | |
2958 | @@ -497,9 +525,16 @@ |
2959 | { |
2960 | Session *session; |
2961 | Table *table; |
2962 | + plugin::InfoSchemaTable *is_table; |
2963 | public: |
2964 | - ShowPlugins(Session *session_arg, Table *table_arg) |
2965 | - : session(session_arg), table(table_arg) {} |
2966 | + ShowPlugins(Session *session_arg, |
2967 | + Table *table_arg, |
2968 | + plugin::InfoSchemaTable *is_table_arg) |
2969 | + : |
2970 | + session(session_arg), |
2971 | + table(table_arg), |
2972 | + is_table(is_table_arg) |
2973 | + {} |
2974 | |
2975 | result_type operator() (argument_type plugin) |
2976 | { |
2977 | @@ -508,6 +543,14 @@ |
2978 | |
2979 | table->restoreRecordAsDefault(); |
2980 | |
2981 | + /* mark fields that will be written to in the write bitset */ |
2982 | + table->setWriteSet(0); |
2983 | + table->setWriteSet(1); |
2984 | + table->setWriteSet(2); |
2985 | + table->setWriteSet(3); |
2986 | + table->setWriteSet(4); |
2987 | + table->setWriteSet(5); |
2988 | + |
2989 | table->field[0]->store(plugin->getName().c_str(), |
2990 | plugin->getName().size(), cs); |
2991 | |
2992 | @@ -569,18 +612,21 @@ |
2993 | } |
2994 | table->field[5]->set_notnull(); |
2995 | |
2996 | - return schema_table_store_record(session, table); |
2997 | + is_table->addRow(table->record[0], table->s->reclength); |
2998 | + return false; |
2999 | } |
3000 | }; |
3001 | |
3002 | -int PluginsISMethods::fillTable(Session *session, TableList *tables, COND *) |
3003 | +int PluginsISMethods::fillTable(Session *session, TableList *tables) |
3004 | { |
3005 | Table *table= tables->table; |
3006 | |
3007 | drizzled::plugin::Registry ®istry= drizzled::plugin::Registry::singleton(); |
3008 | vector<drizzled::plugin::Handle *> plugins= registry.getList(true); |
3009 | vector<drizzled::plugin::Handle *>::iterator iter= |
3010 | - find_if(plugins.begin(), plugins.end(), ShowPlugins(session, table)); |
3011 | + find_if(plugins.begin(), |
3012 | + plugins.end(), |
3013 | + ShowPlugins(session, table, tables->schema_table)); |
3014 | if (iter != plugins.end()) |
3015 | { |
3016 | return 1; |
3017 | @@ -588,7 +634,7 @@ |
3018 | return (0); |
3019 | } |
3020 | |
3021 | -int ProcessListISMethods::fillTable(Session* session, TableList* tables, COND*) |
3022 | +int ProcessListISMethods::fillTable(Session* session, TableList* tables) |
3023 | { |
3024 | Table *table= tables->table; |
3025 | const CHARSET_INFO * const cs= system_charset_info; |
3026 | @@ -615,6 +661,14 @@ |
3027 | continue; |
3028 | |
3029 | table->restoreRecordAsDefault(); |
3030 | + table->setWriteSet(0); |
3031 | + table->setWriteSet(1); |
3032 | + table->setWriteSet(2); |
3033 | + table->setWriteSet(3); |
3034 | + table->setWriteSet(4); |
3035 | + table->setWriteSet(5); |
3036 | + table->setWriteSet(6); |
3037 | + table->setWriteSet(7); |
3038 | /* ID */ |
3039 | table->field[0]->store((int64_t) tmp->thread_id, true); |
3040 | /* USER */ |
3041 | @@ -667,11 +721,7 @@ |
3042 | table->field[7]->set_notnull(); |
3043 | } |
3044 | |
3045 | - if (schema_table_store_record(session, table)) |
3046 | - { |
3047 | - pthread_mutex_unlock(&LOCK_thread_count); |
3048 | - return(1); |
3049 | - } |
3050 | + tables->schema_table->addRow(table->record[0], table->s->reclength); |
3051 | } |
3052 | } |
3053 | |
3054 | @@ -680,10 +730,10 @@ |
3055 | } |
3056 | |
3057 | int |
3058 | -RefConstraintsISMethods::processTable(Session *session, TableList *tables, |
3059 | +RefConstraintsISMethods::processTable(plugin::InfoSchemaTable *, |
3060 | + Session *session, TableList *tables, |
3061 | Table *table, bool res, |
3062 | LEX_STRING *db_name, LEX_STRING *table_name) |
3063 | - const |
3064 | { |
3065 | const CHARSET_INFO * const cs= system_charset_info; |
3066 | |
3067 | @@ -709,6 +759,15 @@ |
3068 | while ((f_key_info= it++)) |
3069 | { |
3070 | table->restoreRecordAsDefault(); |
3071 | + table->setWriteSet(1); |
3072 | + table->setWriteSet(2); |
3073 | + table->setWriteSet(4); |
3074 | + table->setWriteSet(5); |
3075 | + table->setWriteSet(6); |
3076 | + table->setWriteSet(7); |
3077 | + table->setWriteSet(8); |
3078 | + table->setWriteSet(9); |
3079 | + table->setWriteSet(10); |
3080 | table->field[1]->store(db_name->str, db_name->length, cs); |
3081 | table->field[9]->store(table_name->str, table_name->length, cs); |
3082 | table->field[2]->store(f_key_info->forein_id->str, |
3083 | @@ -732,26 +791,29 @@ |
3084 | f_key_info->update_method->length, cs); |
3085 | table->field[8]->store(f_key_info->delete_method->str, |
3086 | f_key_info->delete_method->length, cs); |
3087 | - if (schema_table_store_record(session, table)) |
3088 | - { |
3089 | - return (1); |
3090 | - } |
3091 | + tables->schema_table->addRow(table->record[0], |
3092 | + table->s->reclength); |
3093 | } |
3094 | } |
3095 | return (0); |
3096 | } |
3097 | |
3098 | -static bool store_schema_schemata(Session* session, Table *table, LEX_STRING *db_name, |
3099 | +static bool store_schema_schemata(Session *, Table *table, LEX_STRING *db_name, |
3100 | const CHARSET_INFO * const cs) |
3101 | { |
3102 | table->restoreRecordAsDefault(); |
3103 | + table->setWriteSet(1); |
3104 | + table->setWriteSet(2); |
3105 | + table->setWriteSet(3); |
3106 | table->field[1]->store(db_name->str, db_name->length, system_charset_info); |
3107 | table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info); |
3108 | table->field[3]->store(cs->name, strlen(cs->name), system_charset_info); |
3109 | - return schema_table_store_record(session, table); |
3110 | + TableList *tmp= table->pos_in_table_list; |
3111 | + tmp->schema_table->addRow(table->record[0], table->s->reclength); |
3112 | + return 0; |
3113 | } |
3114 | |
3115 | -int SchemataISMethods::fillTable(Session *session, TableList *tables, COND *cond) |
3116 | +int SchemataISMethods::fillTable(Session *session, TableList *tables) |
3117 | { |
3118 | /* |
3119 | TODO: fill_schema_shemata() is called when new client is connected. |
3120 | @@ -762,6 +824,8 @@ |
3121 | vector<LEX_STRING*> db_names; |
3122 | bool with_i_schema; |
3123 | Table *table= tables->table; |
3124 | + /* the WHERE clause */ |
3125 | + COND *cond= table->reginfo.join_tab->select_cond; |
3126 | |
3127 | if (get_lookup_field_values(session, cond, tables, &lookup_field_vals)) |
3128 | return(0); |
3129 | @@ -810,7 +874,7 @@ |
3130 | return(0); |
3131 | } |
3132 | |
3133 | -int SchemataISMethods::oldFormat(Session *session, drizzled::plugin::InfoSchemaTable *schema_table) |
3134 | +int SchemataISMethods::oldFormat(Session *session, plugin::InfoSchemaTable *schema_table) |
3135 | const |
3136 | { |
3137 | char tmp[128]; |
3138 | @@ -840,10 +904,11 @@ |
3139 | return 0; |
3140 | } |
3141 | |
3142 | -int StatsISMethods::processTable(Session *session, TableList *tables, |
3143 | - Table *table, bool res, |
3144 | - LEX_STRING *db_name, |
3145 | - LEX_STRING *table_name) const |
3146 | +int StatsISMethods::processTable(plugin::InfoSchemaTable *store_table, |
3147 | + Session *session, TableList *tables, |
3148 | + Table *table, bool res, |
3149 | + LEX_STRING *db_name, |
3150 | + LEX_STRING *table_name) |
3151 | { |
3152 | const CHARSET_INFO * const cs= system_charset_info; |
3153 | if (res) |
3154 | @@ -881,6 +946,19 @@ |
3155 | for (uint32_t j=0 ; j < key_info->key_parts ; j++,key_part++) |
3156 | { |
3157 | table->restoreRecordAsDefault(); |
3158 | + table->setWriteSet(1); |
3159 | + table->setWriteSet(2); |
3160 | + table->setWriteSet(3); |
3161 | + table->setWriteSet(4); |
3162 | + table->setWriteSet(5); |
3163 | + table->setWriteSet(6); |
3164 | + table->setWriteSet(8); |
3165 | + table->setWriteSet(9); |
3166 | + table->setWriteSet(10); |
3167 | + table->setWriteSet(12); |
3168 | + table->setWriteSet(13); |
3169 | + table->setWriteSet(14); |
3170 | + table->setWriteSet(15); |
3171 | table->field[1]->store(db_name->str, db_name->length, cs); |
3172 | table->field[2]->store(table_name->str, table_name->length, cs); |
3173 | table->field[3]->store((int64_t) ((key_info->flags & |
3174 | @@ -938,17 +1016,15 @@ |
3175 | table->field[15]->store(key_info->comment.str, |
3176 | key_info->comment.length, cs); |
3177 | } |
3178 | - if (schema_table_store_record(session, table)) |
3179 | - { |
3180 | - return (1); |
3181 | - } |
3182 | + store_table->addRow(table->record[0], |
3183 | + table->s->reclength); |
3184 | } |
3185 | } |
3186 | } |
3187 | - return(res); |
3188 | + return res; |
3189 | } |
3190 | |
3191 | -int StatusISMethods::fillTable(Session *session, TableList *tables, COND *) |
3192 | +int StatusISMethods::fillTable(Session *session, TableList *tables) |
3193 | { |
3194 | LEX *lex= session->lex; |
3195 | const char *wild= lex->wild ? lex->wild->ptr() : NULL; |
3196 | @@ -988,24 +1064,32 @@ |
3197 | return(res); |
3198 | } |
3199 | |
3200 | -static bool store_constraints(Session *session, Table *table, LEX_STRING *db_name, |
3201 | +static bool store_constraints(Session *, Table *table, LEX_STRING *db_name, |
3202 | LEX_STRING *table_name, const char *key_name, |
3203 | uint32_t key_len, const char *con_type, uint32_t con_len) |
3204 | { |
3205 | const CHARSET_INFO * const cs= system_charset_info; |
3206 | table->restoreRecordAsDefault(); |
3207 | + table->setWriteSet(1); |
3208 | + table->setWriteSet(2); |
3209 | + table->setWriteSet(3); |
3210 | + table->setWriteSet(4); |
3211 | + table->setWriteSet(5); |
3212 | table->field[1]->store(db_name->str, db_name->length, cs); |
3213 | table->field[2]->store(key_name, key_len, cs); |
3214 | table->field[3]->store(db_name->str, db_name->length, cs); |
3215 | table->field[4]->store(table_name->str, table_name->length, cs); |
3216 | table->field[5]->store(con_type, con_len, cs); |
3217 | - return schema_table_store_record(session, table); |
3218 | + TableList *tmp= table->pos_in_table_list; |
3219 | + tmp->schema_table->addRow(table->record[0], table->s->reclength); |
3220 | + return false; |
3221 | } |
3222 | |
3223 | -int TabConstraintsISMethods::processTable(Session *session, TableList *tables, |
3224 | +int TabConstraintsISMethods::processTable(plugin::InfoSchemaTable *, |
3225 | + Session *session, TableList *tables, |
3226 | Table *table, bool res, |
3227 | LEX_STRING *db_name, |
3228 | - LEX_STRING *table_name) const |
3229 | + LEX_STRING *table_name) |
3230 | { |
3231 | if (res) |
3232 | { |
3233 | @@ -1070,16 +1154,36 @@ |
3234 | return (res); |
3235 | } |
3236 | |
3237 | -int TablesISMethods::processTable(Session *session, TableList *tables, |
3238 | - Table *table, bool res, |
3239 | - LEX_STRING *db_name, |
3240 | - LEX_STRING *table_name) const |
3241 | +int TablesISMethods::processTable(plugin::InfoSchemaTable *store_table, |
3242 | + Session *session, TableList *tables, |
3243 | + Table *table, bool res, |
3244 | + LEX_STRING *db_name, |
3245 | + LEX_STRING *table_name) |
3246 | { |
3247 | const char *tmp_buff; |
3248 | DRIZZLE_TIME time; |
3249 | const CHARSET_INFO * const cs= system_charset_info; |
3250 | |
3251 | table->restoreRecordAsDefault(); |
3252 | + table->setWriteSet(1); |
3253 | + table->setWriteSet(2); |
3254 | + table->setWriteSet(3); |
3255 | + table->setWriteSet(4); |
3256 | + table->setWriteSet(5); |
3257 | + table->setWriteSet(6); |
3258 | + table->setWriteSet(7); |
3259 | + table->setWriteSet(8); |
3260 | + table->setWriteSet(9); |
3261 | + table->setWriteSet(11); |
3262 | + table->setWriteSet(12); |
3263 | + table->setWriteSet(13); |
3264 | + table->setWriteSet(14); |
3265 | + table->setWriteSet(15); |
3266 | + table->setWriteSet(16); |
3267 | + table->setWriteSet(17); |
3268 | + table->setWriteSet(18); |
3269 | + table->setWriteSet(19); |
3270 | + table->setWriteSet(20); |
3271 | table->field[1]->store(db_name->str, db_name->length, cs); |
3272 | table->field[2]->store(table_name->str, table_name->length, cs); |
3273 | if (res) |
3274 | @@ -1245,7 +1349,8 @@ |
3275 | } |
3276 | } |
3277 | } |
3278 | - return (schema_table_store_record(session, table)); |
3279 | + store_table->addRow(table->record[0], table->s->reclength); |
3280 | + return false; |
3281 | } |
3282 | |
3283 | |
3284 | @@ -1291,7 +1396,7 @@ |
3285 | return 0; |
3286 | } |
3287 | |
3288 | -int VariablesISMethods::fillTable(Session *session, TableList *tables, COND *) |
3289 | +int VariablesISMethods::fillTable(Session *session, TableList *tables) |
3290 | { |
3291 | int res= 0; |
3292 | LEX *lex= session->lex; |
3293 | |
3294 | === modified file 'plugin/info_schema/info_schema_methods.h' |
3295 | --- plugin/info_schema/info_schema_methods.h 2009-09-25 20:13:37 +0000 |
3296 | +++ plugin/info_schema/info_schema_methods.h 2009-10-29 23:56:14 +0000 |
3297 | @@ -34,8 +34,7 @@ |
3298 | { |
3299 | public: |
3300 | virtual int fillTable(Session *session, |
3301 | - TableList *tables, |
3302 | - COND *cond); |
3303 | + TableList *tables); |
3304 | virtual int oldFormat(Session *session, |
3305 | drizzled::plugin::InfoSchemaTable *schema_table) const; |
3306 | }; |
3307 | @@ -50,8 +49,7 @@ |
3308 | { |
3309 | public: |
3310 | virtual int fillTable(Session *session, |
3311 | - TableList *tables, |
3312 | - COND *cond); |
3313 | + TableList *tables); |
3314 | }; |
3315 | |
3316 | /** |
3317 | @@ -64,8 +62,7 @@ |
3318 | { |
3319 | public: |
3320 | virtual int fillTable(Session *session, |
3321 | - TableList *tables, |
3322 | - COND *cond); |
3323 | + TableList *tables); |
3324 | }; |
3325 | |
3326 | /** |
3327 | @@ -90,9 +87,11 @@ |
3328 | class KeyColUsageISMethods : public drizzled::plugin::InfoSchemaMethods |
3329 | { |
3330 | public: |
3331 | - virtual int processTable(Session *session, TableList *tables, |
3332 | + virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table, |
3333 | + Session *session, |
3334 | + TableList *tables, |
3335 | Table *table, bool res, LEX_STRING *db_name, |
3336 | - LEX_STRING *table_name) const; |
3337 | + LEX_STRING *table_name); |
3338 | }; |
3339 | |
3340 | /** |
3341 | @@ -105,8 +104,7 @@ |
3342 | { |
3343 | public: |
3344 | virtual int fillTable(Session *session, |
3345 | - TableList *tables, |
3346 | - COND *cond); |
3347 | + TableList *tables); |
3348 | }; |
3349 | |
3350 | /** |
3351 | @@ -119,8 +117,7 @@ |
3352 | { |
3353 | public: |
3354 | virtual int fillTable(Session *session, |
3355 | - TableList *tables, |
3356 | - COND *cond); |
3357 | + TableList *tables); |
3358 | }; |
3359 | |
3360 | /** |
3361 | @@ -133,8 +130,7 @@ |
3362 | { |
3363 | public: |
3364 | virtual int fillTable(Session *session, |
3365 | - TableList *tables, |
3366 | - COND *cond); |
3367 | + TableList *tables); |
3368 | }; |
3369 | |
3370 | /** |
3371 | @@ -159,9 +155,10 @@ |
3372 | * |
3373 | * @return 0 on success; 1 on failure |
3374 | */ |
3375 | - virtual int processTable(Session *session, TableList *tables, |
3376 | + virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table, |
3377 | + Session *session, TableList *tables, |
3378 | Table *table, bool res, LEX_STRING *db_name, |
3379 | - LEX_STRING *table_name) const; |
3380 | + LEX_STRING *table_name); |
3381 | }; |
3382 | |
3383 | /** |
3384 | @@ -174,8 +171,7 @@ |
3385 | { |
3386 | public: |
3387 | virtual int fillTable(Session *session, |
3388 | - TableList *tables, |
3389 | - COND *cond); |
3390 | + TableList *tables); |
3391 | virtual int oldFormat(Session *session, |
3392 | drizzled::plugin::InfoSchemaTable *schema_table) const; |
3393 | }; |
3394 | @@ -189,9 +185,11 @@ |
3395 | class StatsISMethods : public drizzled::plugin::InfoSchemaMethods |
3396 | { |
3397 | public: |
3398 | - virtual int processTable(Session *session, TableList *tables, |
3399 | + virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table, |
3400 | + Session *session, |
3401 | + TableList *tables, |
3402 | Table *table, bool res, LEX_STRING *db_name, |
3403 | - LEX_STRING *table_name) const; |
3404 | + LEX_STRING *table_name); |
3405 | }; |
3406 | |
3407 | /** |
3408 | @@ -204,8 +202,7 @@ |
3409 | { |
3410 | public: |
3411 | virtual int fillTable(Session *session, |
3412 | - TableList *tables, |
3413 | - COND *cond); |
3414 | + TableList *tables); |
3415 | }; |
3416 | |
3417 | /** |
3418 | @@ -217,9 +214,10 @@ |
3419 | class TabConstraintsISMethods : public drizzled::plugin::InfoSchemaMethods |
3420 | { |
3421 | public: |
3422 | - virtual int processTable(Session *session, TableList *tables, |
3423 | + virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table, |
3424 | + Session *session, TableList *tables, |
3425 | Table *table, bool res, LEX_STRING *db_name, |
3426 | - LEX_STRING *table_name) const; |
3427 | + LEX_STRING *table_name); |
3428 | }; |
3429 | |
3430 | /** |
3431 | @@ -231,9 +229,10 @@ |
3432 | class TablesISMethods : public drizzled::plugin::InfoSchemaMethods |
3433 | { |
3434 | public: |
3435 | - virtual int processTable(Session *session, TableList *tables, |
3436 | + virtual int processTable(drizzled::plugin::InfoSchemaTable *store_table, |
3437 | + Session *session, TableList *tables, |
3438 | Table *table, bool res, LEX_STRING *db_name, |
3439 | - LEX_STRING *table_name) const; |
3440 | + LEX_STRING *table_name); |
3441 | }; |
3442 | |
3443 | /** |
3444 | @@ -259,8 +258,7 @@ |
3445 | { |
3446 | public: |
3447 | virtual int fillTable(Session *session, |
3448 | - TableList *tables, |
3449 | - COND *cond); |
3450 | + TableList *tables); |
3451 | }; |
3452 | |
3453 | #endif /* PLUGIN_INFO_SCHEMA_INFO_SCHEMA_METHODS_H */ |
3454 | |
3455 | === added directory 'plugin/info_schema_engine' |
3456 | === added file 'plugin/info_schema_engine/info_schema_cursor.cc' |
3457 | --- plugin/info_schema_engine/info_schema_cursor.cc 1970-01-01 00:00:00 +0000 |
3458 | +++ plugin/info_schema_engine/info_schema_cursor.cc 2009-10-29 23:56:14 +0000 |
3459 | @@ -0,0 +1,144 @@ |
3460 | +/* |
3461 | + * Copyright (C) 2009 Sun Microsystems |
3462 | + * |
3463 | + * This program is free software; you can redistribute it and/or modify |
3464 | + * it under the terms of the GNU General Public License as published by |
3465 | + * the Free Software Foundation; either version 2 of the License, or |
3466 | + * (at your option) any later version. |
3467 | + * |
3468 | + * This program is distributed in the hope that it will be useful, |
3469 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3470 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3471 | + * GNU General Public License for more details. |
3472 | + * |
3473 | + * You should have received a copy of the GNU General Public License |
3474 | + * along with this program; if not, write to the Free Software |
3475 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3476 | + */ |
3477 | + |
3478 | +#include "drizzled/server_includes.h" |
3479 | +#include "drizzled/join_table.h" |
3480 | +#include "drizzled/session.h" |
3481 | +#include "info_schema_cursor.h" |
3482 | +#include "open_tables.h" |
3483 | + |
3484 | +#include <string> |
3485 | +#include <map> |
3486 | + |
3487 | +using namespace std; |
3488 | +using namespace drizzled; |
3489 | + |
3490 | +int InfoSchemaCursor::open(const char *name, int, uint32_t) |
3491 | +{ |
3492 | + string table_name(name); |
3493 | + string i_s_prefix("./information_schema/"); |
3494 | + table_name.erase(0, i_s_prefix.length()); |
3495 | + |
3496 | + OpenTables &open_tables= OpenTables::singleton(); |
3497 | + if (! (share= open_tables.getShare(table_name))) |
3498 | + { |
3499 | + return HA_ERR_OUT_OF_MEM; |
3500 | + } |
3501 | + |
3502 | + assert(share); |
3503 | + |
3504 | + thr_lock_data_init(share->getThreadLock(), &data_lock, NULL); |
3505 | + |
3506 | + return 0; |
3507 | +} |
3508 | + |
3509 | +int InfoSchemaCursor::close() |
3510 | +{ |
3511 | + OpenTables &open_tables= OpenTables::singleton(); |
3512 | + open_tables.freeShare(); |
3513 | + return 0; |
3514 | +} |
3515 | + |
3516 | +int InfoSchemaCursor::info(uint32_t flags) |
3517 | +{ |
3518 | + /* |
3519 | + * If this flag is set, then we know that the time of the last |
3520 | + * modification needs to be modified. |
3521 | + */ |
3522 | + if (flags & HA_STATUS_TIME) |
3523 | + { |
3524 | + } |
3525 | + |
3526 | + if (flags & HA_STATUS_VARIABLE) |
3527 | + { |
3528 | + stats.records= 1; |
3529 | + } |
3530 | + |
3531 | + /* |
3532 | + * If this flag is set, then we know that the auto_increment value needs |
3533 | + * to be updated. |
3534 | + */ |
3535 | + if (flags & HA_STATUS_AUTO) |
3536 | + { |
3537 | + stats.auto_increment_value= 1; |
3538 | + } |
3539 | + |
3540 | + return 0; |
3541 | +} |
3542 | + |
3543 | +int InfoSchemaCursor::rnd_init(bool) |
3544 | +{ |
3545 | + TableList *tmp= table->pos_in_table_list; |
3546 | + plugin::InfoSchemaTable *sch_table= share->getInfoSchemaTable(); |
3547 | + if (sch_table) |
3548 | + { |
3549 | + sch_table->fillTable(ha_session(), |
3550 | + tmp); |
3551 | + iter= sch_table->getRows().begin(); |
3552 | + } |
3553 | + return 0; |
3554 | +} |
3555 | + |
3556 | +int InfoSchemaCursor::rnd_next(unsigned char *buf) |
3557 | +{ |
3558 | + ha_statistic_increment(&SSV::ha_read_rnd_next_count); |
3559 | + plugin::InfoSchemaTable *sch_table= share->getInfoSchemaTable(); |
3560 | + if (iter != sch_table->getRows().end() && |
3561 | + ! sch_table->getRows().empty()) |
3562 | + { |
3563 | + (*iter)->copyRecordInto(buf); |
3564 | + ++iter; |
3565 | + return 0; |
3566 | + } |
3567 | + sch_table->clearRows(); |
3568 | + return HA_ERR_END_OF_FILE; |
3569 | +} |
3570 | + |
3571 | +int InfoSchemaCursor::rnd_pos(unsigned char *, unsigned char *) |
3572 | +{ |
3573 | + ha_statistic_increment(&SSV::ha_read_rnd_count); |
3574 | + return HA_ERR_WRONG_COMMAND; |
3575 | +} |
3576 | + |
3577 | +void InfoSchemaCursor::position(const unsigned char *) |
3578 | +{ |
3579 | + return; |
3580 | +} |
3581 | + |
3582 | +THR_LOCK_DATA **InfoSchemaCursor::store_lock(Session *session, |
3583 | + THR_LOCK_DATA **to, |
3584 | + enum thr_lock_type lock_type) |
3585 | +{ |
3586 | + /* borrowed from archive and BDB engines. TODO: understand this! */ |
3587 | + if (lock_type != TL_IGNORE && data_lock.type == TL_UNLOCK) |
3588 | + { |
3589 | + if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) && |
3590 | + ! session_tablespace_op(session)) |
3591 | + { |
3592 | + lock_type= TL_WRITE_ALLOW_WRITE; |
3593 | + } |
3594 | + if (lock_type == TL_READ_NO_INSERT) |
3595 | + { |
3596 | + lock_type= TL_READ; |
3597 | + } |
3598 | + data_lock.type= lock_type; |
3599 | + } |
3600 | + *to++= &data_lock; |
3601 | + return to; |
3602 | +} |
3603 | + |
3604 | |
3605 | === added file 'plugin/info_schema_engine/info_schema_cursor.h' |
3606 | --- plugin/info_schema_engine/info_schema_cursor.h 1970-01-01 00:00:00 +0000 |
3607 | +++ plugin/info_schema_engine/info_schema_cursor.h 2009-10-29 23:56:14 +0000 |
3608 | @@ -0,0 +1,175 @@ |
3609 | +/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
3610 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
3611 | + * |
3612 | + * Copyright (C) 2009 Sun Microsystems |
3613 | + * |
3614 | + * This program is free software; you can redistribute it and/or modify |
3615 | + * it under the terms of the GNU General Public License as published by |
3616 | + * the Free Software Foundation; either version 2 of the License, or |
3617 | + * (at your option) any later version. |
3618 | + * |
3619 | + * This program is distributed in the hope that it will be useful, |
3620 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3621 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3622 | + * GNU General Public License for more details. |
3623 | + * |
3624 | + * You should have received a copy of the GNU General Public License |
3625 | + * along with this program; if not, write to the Free Software |
3626 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3627 | + */ |
3628 | + |
3629 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H |
3630 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H |
3631 | + |
3632 | +#include <drizzled/cursor.h> |
3633 | +#include <drizzled/show.h> |
3634 | +#include <drizzled/plugin/info_schema_table.h> |
3635 | +#include <mysys/thr_lock.h> |
3636 | + |
3637 | +/* |
3638 | + * Shared structure for correct LOCK operation |
3639 | + */ |
3640 | +class InfoSchemaShare |
3641 | +{ |
3642 | +public: |
3643 | + InfoSchemaShare() |
3644 | + : |
3645 | + use_count(0), |
3646 | + lock(), |
3647 | + i_s_table(NULL) |
3648 | + {} |
3649 | + |
3650 | + ~InfoSchemaShare() |
3651 | + { |
3652 | + thr_lock_delete(&lock); |
3653 | + } |
3654 | + |
3655 | + uint32_t getUseCount() const |
3656 | + { |
3657 | + return use_count; |
3658 | + } |
3659 | + |
3660 | + void incUseCount() |
3661 | + { |
3662 | + use_count++; |
3663 | + } |
3664 | + |
3665 | + void decUseCount() |
3666 | + { |
3667 | + use_count--; |
3668 | + } |
3669 | + |
3670 | + const std::string &getName() const |
3671 | + { |
3672 | + return i_s_table->getTableName(); |
3673 | + } |
3674 | + |
3675 | + void initThreadLock() |
3676 | + { |
3677 | + thr_lock_init(&lock); |
3678 | + } |
3679 | + |
3680 | + THR_LOCK *getThreadLock() |
3681 | + { |
3682 | + return &lock; |
3683 | + } |
3684 | + |
3685 | + void setInfoSchemaTable(const std::string &name) |
3686 | + { |
3687 | + i_s_table= drizzled::plugin::InfoSchemaTable::getTable(name.c_str()); |
3688 | + } |
3689 | + |
3690 | + drizzled::plugin::InfoSchemaTable *getInfoSchemaTable() |
3691 | + { |
3692 | + return i_s_table; |
3693 | + } |
3694 | + |
3695 | + |
3696 | +private: |
3697 | + |
3698 | + uint32_t use_count; |
3699 | + THR_LOCK lock; |
3700 | + drizzled::plugin::InfoSchemaTable *i_s_table; |
3701 | +}; |
3702 | + |
3703 | +class InfoSchemaCursor : public Cursor |
3704 | +{ |
3705 | +public: |
3706 | + |
3707 | + InfoSchemaCursor(drizzled::plugin::StorageEngine *engine_arg, TableShare *table_arg) |
3708 | + : |
3709 | + Cursor(engine_arg, table_arg) |
3710 | + {} |
3711 | + |
3712 | + ~InfoSchemaCursor() {} |
3713 | + |
3714 | + const char *table_type() const |
3715 | + { |
3716 | + return "INFORMATION_SCHEMA"; |
3717 | + } |
3718 | + |
3719 | + /* |
3720 | + The name of the index type that will be used for display |
3721 | + don't implement this method unless you really have indexes |
3722 | + */ |
3723 | + const char *index_type(uint32_t) |
3724 | + { |
3725 | + return NULL; |
3726 | + } |
3727 | + |
3728 | + uint64_t table_flags() const |
3729 | + { |
3730 | + return (HA_NULL_IN_KEY | |
3731 | + HA_CAN_INDEX_BLOBS | |
3732 | + HA_AUTO_PART_KEY); |
3733 | + } |
3734 | + |
3735 | + uint32_t index_flags(uint32_t, uint32_t, bool) const |
3736 | + { |
3737 | + return 0; |
3738 | + } |
3739 | + |
3740 | + /* open a table */ |
3741 | + int open(const char *name, int mode, uint32_t test_if_locked); |
3742 | + |
3743 | + /* close a table */ |
3744 | + int close(void); |
3745 | + |
3746 | + /* provide info to the optimizer */ |
3747 | + int info(uint32_t flag); |
3748 | + |
3749 | + /* preparation for table scan (is this true?) */ |
3750 | + int rnd_init(bool scan); |
3751 | + |
3752 | + /* get the next row and copy it into buf */ |
3753 | + int rnd_next(unsigned char *buf); |
3754 | + |
3755 | + /* locate row pointed to by pos, copy it into buf */ |
3756 | + int rnd_pos(unsigned char *buf, unsigned char *pos); |
3757 | + |
3758 | + /* record position of a record for reordering */ |
3759 | + void position(const unsigned char *record); |
3760 | + |
3761 | + /* |
3762 | + * @todo: return actual upper bound of number of records in the table. |
3763 | + * (e.g. save number of records seen on full table scan and/or use file size |
3764 | + * as upper bound) |
3765 | + */ |
3766 | + ha_rows estimate_rows_upper_bound() |
3767 | + { |
3768 | + return HA_POS_ERROR; |
3769 | + } |
3770 | + |
3771 | + THR_LOCK_DATA **store_lock(Session *session, |
3772 | + THR_LOCK_DATA **to, |
3773 | + enum thr_lock_type lock_type); |
3774 | + |
3775 | +private: |
3776 | + |
3777 | + THR_LOCK_DATA data_lock; |
3778 | + InfoSchemaShare *share; |
3779 | + drizzled::plugin::InfoSchemaTable::Rows::iterator iter; |
3780 | + |
3781 | +}; |
3782 | + |
3783 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_CURSOR_H */ |
3784 | |
3785 | === added file 'plugin/info_schema_engine/info_schema_engine.cc' |
3786 | --- plugin/info_schema_engine/info_schema_engine.cc 1970-01-01 00:00:00 +0000 |
3787 | +++ plugin/info_schema_engine/info_schema_engine.cc 2009-10-29 23:56:14 +0000 |
3788 | @@ -0,0 +1,195 @@ |
3789 | +/* |
3790 | + * Copyright (C) 2009 Sun Microsystems |
3791 | + * |
3792 | + * This program is free software; you can redistribute it and/or modify |
3793 | + * it under the terms of the GNU General Public License as published by |
3794 | + * the Free Software Foundation; either version 2 of the License, or |
3795 | + * (at your option) any later version. |
3796 | + * |
3797 | + * This program is distributed in the hope that it will be useful, |
3798 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3799 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3800 | + * GNU General Public License for more details. |
3801 | + * |
3802 | + * You should have received a copy of the GNU General Public License |
3803 | + * along with this program; if not, write to the Free Software |
3804 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3805 | + */ |
3806 | + |
3807 | +#include <drizzled/server_includes.h> |
3808 | +#include <drizzled/show.h> |
3809 | +#include "info_schema_engine.h" |
3810 | +#include "info_schema_cursor.h" |
3811 | +#include "open_tables.h" |
3812 | + |
3813 | +#include <string> |
3814 | +#include <map> |
3815 | + |
3816 | +using namespace std; |
3817 | +using namespace drizzled; |
3818 | + |
3819 | +static const string engine_name("INFORMATION_SCHEMA"); |
3820 | + |
3821 | +int InfoSchemaEngine::getTableProtoImplementation(const char *path, |
3822 | + message::Table *table_proto) |
3823 | +{ |
3824 | + string table_name(path); |
3825 | + string i_s_prefix("./information_schema/"); |
3826 | + |
3827 | + if (table_name.compare(0, i_s_prefix.length(), i_s_prefix) != 0) |
3828 | + { |
3829 | + return ENOENT; |
3830 | + } |
3831 | + |
3832 | + if (! table_proto) |
3833 | + { |
3834 | + return EEXIST; |
3835 | + } |
3836 | + |
3837 | + table_name.erase(0, i_s_prefix.length()); |
3838 | + plugin::InfoSchemaTable *schema_table= plugin::InfoSchemaTable::getTable(table_name.c_str()); |
3839 | + |
3840 | + if (! schema_table) |
3841 | + { |
3842 | + return ENOENT; |
3843 | + } |
3844 | + |
3845 | + table_proto->set_name(table_name); |
3846 | + table_proto->set_type(message::Table::STANDARD); |
3847 | + |
3848 | + message::Table::StorageEngine *protoengine= table_proto->mutable_engine(); |
3849 | + protoengine->set_name(engine_name); |
3850 | + |
3851 | + message::Table::TableOptions *table_options= table_proto->mutable_options(); |
3852 | + table_options->set_collation_id(default_charset_info->number); |
3853 | + table_options->set_collation(default_charset_info->name); |
3854 | + |
3855 | + const plugin::InfoSchemaTable::Columns &columns= schema_table->getColumns(); |
3856 | + plugin::InfoSchemaTable::Columns::const_iterator iter= columns.begin(); |
3857 | + |
3858 | + while (iter != columns.end()) |
3859 | + { |
3860 | + const plugin::ColumnInfo *column= *iter; |
3861 | + /* get the various proto variables we need */ |
3862 | + message::Table::Field *proto_field= table_proto->add_field(); |
3863 | + message::Table::Field::FieldOptions *field_options= |
3864 | + proto_field->mutable_options(); |
3865 | + message::Table::Field::FieldConstraints *field_constraints= |
3866 | + proto_field->mutable_constraints(); |
3867 | + |
3868 | + proto_field->set_name(column->getName()); |
3869 | + field_options->set_default_value("0"); |
3870 | + |
3871 | + if (column->getFlags() & MY_I_S_MAYBE_NULL) |
3872 | + { |
3873 | + field_options->set_default_null(true); |
3874 | + field_constraints->set_is_nullable(true); |
3875 | + } |
3876 | + |
3877 | + if (column->getFlags() & MY_I_S_UNSIGNED) |
3878 | + { |
3879 | + field_constraints->set_is_unsigned(true); |
3880 | + } |
3881 | + |
3882 | + switch(column->getType()) |
3883 | + { |
3884 | + case DRIZZLE_TYPE_TINY: |
3885 | + case DRIZZLE_TYPE_LONG: |
3886 | + proto_field->set_type(message::Table::Field::INTEGER); |
3887 | + field_options->set_length(MAX_INT_WIDTH); |
3888 | + break; |
3889 | + case DRIZZLE_TYPE_DOUBLE: |
3890 | + proto_field->set_type(message::Table::Field::DOUBLE); |
3891 | + break; |
3892 | + case DRIZZLE_TYPE_NULL: |
3893 | + assert(true); |
3894 | + break; |
3895 | + case DRIZZLE_TYPE_TIMESTAMP: |
3896 | + proto_field->set_type(message::Table::Field::TIMESTAMP); |
3897 | + field_options->set_default_value("NOW()"); |
3898 | + break; |
3899 | + case DRIZZLE_TYPE_LONGLONG: |
3900 | + proto_field->set_type(message::Table::Field::BIGINT); |
3901 | + field_options->set_length(MAX_BIGINT_WIDTH); |
3902 | + break; |
3903 | + case DRIZZLE_TYPE_DATETIME: |
3904 | + proto_field->set_type(message::Table::Field::DATETIME); |
3905 | + field_options->set_default_value("NOW()"); |
3906 | + break; |
3907 | + case DRIZZLE_TYPE_DATE: |
3908 | + proto_field->set_type(message::Table::Field::DATE); |
3909 | + field_options->set_default_value("NOW()"); |
3910 | + break; |
3911 | + case DRIZZLE_TYPE_VARCHAR: |
3912 | + { |
3913 | + message::Table::Field::StringFieldOptions *str_field_options= |
3914 | + proto_field->mutable_string_options(); |
3915 | + proto_field->set_type(message::Table::Field::VARCHAR); |
3916 | + str_field_options->set_length(column->getLength()); |
3917 | + field_options->set_length(column->getLength() * 4); |
3918 | + field_options->set_default_value(""); |
3919 | + str_field_options->set_collation_id(default_charset_info->number); |
3920 | + str_field_options->set_collation(default_charset_info->name); |
3921 | + break; |
3922 | + } |
3923 | + case DRIZZLE_TYPE_NEWDECIMAL: |
3924 | + { |
3925 | + message::Table::Field::NumericFieldOptions *num_field_options= |
3926 | + proto_field->mutable_numeric_options(); |
3927 | + proto_field->set_type(message::Table::Field::DECIMAL); |
3928 | + num_field_options->set_precision(column->getLength()); |
3929 | + num_field_options->set_scale(column->getLength() % 10); |
3930 | + break; |
3931 | + } |
3932 | + default: |
3933 | + assert(true); |
3934 | + break; |
3935 | + } |
3936 | + |
3937 | + ++iter; |
3938 | + } |
3939 | + |
3940 | + return EEXIST; |
3941 | +} |
3942 | + |
3943 | +static plugin::StorageEngine *info_schema_engine= NULL; |
3944 | + |
3945 | +static int init(plugin::Registry ®istry) |
3946 | +{ |
3947 | + info_schema_engine= new(std::nothrow) InfoSchemaEngine(engine_name); |
3948 | + if (! info_schema_engine) |
3949 | + { |
3950 | + return true; |
3951 | + } |
3952 | + |
3953 | + /* we are good to go */ |
3954 | + registry.add(info_schema_engine); |
3955 | + |
3956 | + return false; |
3957 | +} |
3958 | + |
3959 | +static int deinit(plugin::Registry ®istry) |
3960 | +{ |
3961 | + if (info_schema_engine) |
3962 | + { |
3963 | + registry.remove(info_schema_engine); |
3964 | + delete info_schema_engine; |
3965 | + } |
3966 | + return false; |
3967 | +} |
3968 | + |
3969 | +drizzle_declare_plugin(info_schema_engine) |
3970 | +{ |
3971 | + "info_schema_engine", |
3972 | + "0.2", |
3973 | + "Padraig O'Sullivan", |
3974 | + "INFORMATION_SCHEMA Storage Engine", |
3975 | + PLUGIN_LICENSE_GPL, |
3976 | + init, /* Plugin Init */ |
3977 | + deinit, /* Plugin Deinit */ |
3978 | + NULL, /* status variables */ |
3979 | + NULL, /* system variables */ |
3980 | + NULL /* config options */ |
3981 | +} |
3982 | +drizzle_declare_plugin_end; |
3983 | + |
3984 | |
3985 | === added file 'plugin/info_schema_engine/info_schema_engine.h' |
3986 | --- plugin/info_schema_engine/info_schema_engine.h 1970-01-01 00:00:00 +0000 |
3987 | +++ plugin/info_schema_engine/info_schema_engine.h 2009-10-29 23:56:14 +0000 |
3988 | @@ -0,0 +1,91 @@ |
3989 | +/* |
3990 | + * Copyright (C) 2009 Sun Microsystems |
3991 | + * |
3992 | + * This program is free software; you can redistribute it and/or modify |
3993 | + * it under the terms of the GNU General Public License as published by |
3994 | + * the Free Software Foundation; either version 2 of the License, or |
3995 | + * (at your option) any later version. |
3996 | + * |
3997 | + * This program is distributed in the hope that it will be useful, |
3998 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3999 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4000 | + * GNU General Public License for more details. |
4001 | + * |
4002 | + * You should have received a copy of the GNU General Public License |
4003 | + * along with this program; if not, write to the Free Software |
4004 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4005 | + */ |
4006 | + |
4007 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H |
4008 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H |
4009 | + |
4010 | +#include <drizzled/error.h> |
4011 | +#include "info_schema_cursor.h" |
4012 | +#include "table_name_iterator.h" |
4013 | + |
4014 | +#include <string> |
4015 | + |
4016 | +class InfoSchemaEngine : public drizzled::plugin::StorageEngine |
4017 | +{ |
4018 | +public: |
4019 | + |
4020 | + InfoSchemaEngine(const std::string &in_name) |
4021 | + : |
4022 | + drizzled::plugin::StorageEngine(in_name, |
4023 | + HTON_CREATE_NOT_SUPPORTED) |
4024 | + {} |
4025 | + |
4026 | + ~InfoSchemaEngine() {} |
4027 | + |
4028 | + virtual Cursor *create(TableShare *table, |
4029 | + MEM_ROOT *mem_root) |
4030 | + { |
4031 | + return new(mem_root) InfoSchemaCursor(this, table); |
4032 | + } |
4033 | + |
4034 | + const char **bas_ext() const |
4035 | + { |
4036 | + return NULL; |
4037 | + } |
4038 | + |
4039 | + int createTableImplementation(Session *, |
4040 | + const char *, |
4041 | + Table *, |
4042 | + HA_CREATE_INFO *, |
4043 | + drizzled::message::Table *) |
4044 | + { |
4045 | + my_error(ER_ILLEGAL_HA_CREATE_OPTION, |
4046 | + MYF(0), |
4047 | + drizzled::plugin::StorageEngine::resolveName(this).c_str(), |
4048 | + "CREATE TABLE"); |
4049 | + return -1; |
4050 | + } |
4051 | + |
4052 | + int deleteTableImplementation(Session *, |
4053 | + const std::string &table_path) |
4054 | + { |
4055 | + std::string i_s_prefix("./information_schema/"); |
4056 | + if (table_path.compare(0, i_s_prefix.length(), i_s_prefix) == 0) |
4057 | + { |
4058 | + my_error(ER_DBACCESS_DENIED_ERROR, |
4059 | + MYF(0), |
4060 | + "", |
4061 | + "", |
4062 | + INFORMATION_SCHEMA_NAME.c_str()); |
4063 | + return ER_DBACCESS_DENIED_ERROR; |
4064 | + } |
4065 | + return ENOENT; |
4066 | + } |
4067 | + |
4068 | + int getTableProtoImplementation(const char *path, |
4069 | + drizzled::message::Table *table_proto); |
4070 | + |
4071 | + drizzled::plugin::TableNameIteratorImplementation *tableNameIterator(const std::string &database) |
4072 | + { |
4073 | + return new InfoSchemaTableNameIterator(database); |
4074 | + } |
4075 | + |
4076 | + |
4077 | +}; |
4078 | + |
4079 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_H */ |
4080 | |
4081 | === added file 'plugin/info_schema_engine/open_tables.cc' |
4082 | --- plugin/info_schema_engine/open_tables.cc 1970-01-01 00:00:00 +0000 |
4083 | +++ plugin/info_schema_engine/open_tables.cc 2009-10-29 23:56:14 +0000 |
4084 | @@ -0,0 +1,72 @@ |
4085 | +/* |
4086 | + * Copyright (C) 2009 Sun Microsystems |
4087 | + * |
4088 | + * This program is free software; you can redistribute it and/or modify |
4089 | + * it under the terms of the GNU General Public License as published by |
4090 | + * the Free Software Foundation; either version 2 of the License, or |
4091 | + * (at your option) any later version. |
4092 | + * |
4093 | + * This program is distributed in the hope that it will be useful, |
4094 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4095 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4096 | + * GNU General Public License for more details. |
4097 | + * |
4098 | + * You should have received a copy of the GNU General Public License |
4099 | + * along with this program; if not, write to the Free Software |
4100 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4101 | + */ |
4102 | + |
4103 | +#include <drizzled/server_includes.h> |
4104 | +#include "info_schema_cursor.h" |
4105 | +#include "open_tables.h" |
4106 | + |
4107 | +#include <string> |
4108 | +#include <map> |
4109 | + |
4110 | +using namespace std; |
4111 | +using namespace drizzled; |
4112 | + |
4113 | +InfoSchemaShare *OpenTables::getShare(const string &name) |
4114 | +{ |
4115 | + map<const string, InfoSchemaShare *>::iterator it; |
4116 | + pthread_mutex_lock(&mutex); |
4117 | + |
4118 | + it= open_tables.find(name); |
4119 | + if (it != open_tables.end()) |
4120 | + { |
4121 | + share= (*it).second; |
4122 | + } |
4123 | + else |
4124 | + { |
4125 | + share= NULL; |
4126 | + } |
4127 | + |
4128 | + if (! share) |
4129 | + { |
4130 | + share= new(std::nothrow) InfoSchemaShare(); |
4131 | + if (! share) |
4132 | + { |
4133 | + pthread_mutex_unlock(&mutex); |
4134 | + return NULL; |
4135 | + } |
4136 | + /* get the I_S table */ |
4137 | + share->setInfoSchemaTable(name); |
4138 | + open_tables[name]= share; |
4139 | + share->initThreadLock(); |
4140 | + } |
4141 | + share->incUseCount(); |
4142 | + pthread_mutex_unlock(&mutex); |
4143 | + |
4144 | + return share; |
4145 | +} |
4146 | + |
4147 | +void OpenTables::freeShare() |
4148 | +{ |
4149 | + pthread_mutex_lock(&mutex); |
4150 | + share->decUseCount(); |
4151 | + if (share->getUseCount() == 0) |
4152 | + { |
4153 | + open_tables.erase(share->getName()); |
4154 | + } |
4155 | + pthread_mutex_unlock(&mutex); |
4156 | +} |
4157 | |
4158 | === added file 'plugin/info_schema_engine/open_tables.h' |
4159 | --- plugin/info_schema_engine/open_tables.h 1970-01-01 00:00:00 +0000 |
4160 | +++ plugin/info_schema_engine/open_tables.h 2009-10-29 23:56:14 +0000 |
4161 | @@ -0,0 +1,77 @@ |
4162 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
4163 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
4164 | + * |
4165 | + * Copyright (C) 2009 Sun Microsystems |
4166 | + * |
4167 | + * This program is free software; you can redistribute it and/or modify |
4168 | + * it under the terms of the GNU General Public License as published by |
4169 | + * the Free Software Foundation; version 2 of the License. |
4170 | + * |
4171 | + * This program is distributed in the hope that it will be useful, |
4172 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4173 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4174 | + * GNU General Public License for more details. |
4175 | + * |
4176 | + * You should have received a copy of the GNU General Public License |
4177 | + * along with this program; if not, write to the Free Software |
4178 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4179 | + */ |
4180 | + |
4181 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H |
4182 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H |
4183 | + |
4184 | +#include "info_schema_cursor.h" |
4185 | + |
4186 | +#include <string> |
4187 | +#include <vector> |
4188 | +#include <map> |
4189 | + |
4190 | +/** |
4191 | + * @class OpenTables |
4192 | + * |
4193 | + * Class which tracks all the open tables for the I_S storage engine. |
4194 | + * Encapsulating this functionality in a class will make it easier for us to |
4195 | + * change things such as whether a std::map or HASH is used to lookup the |
4196 | + * open tables. |
4197 | + */ |
4198 | +class OpenTables |
4199 | +{ |
4200 | +public: |
4201 | + |
4202 | + static OpenTables &singleton() |
4203 | + { |
4204 | + static OpenTables open_tabs; |
4205 | + return open_tabs; |
4206 | + } |
4207 | + |
4208 | + InfoSchemaShare *getShare(const std::string &name); |
4209 | + |
4210 | + void freeShare(); |
4211 | + |
4212 | +private: |
4213 | + |
4214 | + pthread_mutex_t mutex; |
4215 | + |
4216 | + std::map<const std::string, InfoSchemaShare *> |
4217 | + open_tables; |
4218 | + |
4219 | + InfoSchemaShare *share; |
4220 | + |
4221 | + OpenTables() |
4222 | + : |
4223 | + mutex(), |
4224 | + open_tables(), |
4225 | + share(NULL) |
4226 | + { |
4227 | + pthread_mutex_init(&mutex, MY_MUTEX_INIT_FAST); |
4228 | + } |
4229 | + |
4230 | + ~OpenTables() |
4231 | + { |
4232 | + pthread_mutex_destroy(&mutex); |
4233 | + } |
4234 | + |
4235 | + OpenTables(const OpenTables&); |
4236 | +}; |
4237 | + |
4238 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_OPEN_TABLES_H */ |
4239 | |
4240 | === added file 'plugin/info_schema_engine/plugin.ini' |
4241 | --- plugin/info_schema_engine/plugin.ini 1970-01-01 00:00:00 +0000 |
4242 | +++ plugin/info_schema_engine/plugin.ini 2009-10-29 23:56:17 +0000 |
4243 | @@ -0,0 +1,9 @@ |
4244 | +[plugin] |
4245 | +name=info_schema_engine |
4246 | +title=INFORMATION_SCHEMA Storage Engine |
4247 | +description=Engine for INFORMATION_SCHEMA tables |
4248 | +sources=info_schema_engine.cc info_schema_cursor.cc open_tables.cc |
4249 | + table_name_iterator.cc |
4250 | +headers=info_schema_engine.h info_schema_cursor.h open_tables.h |
4251 | + table_name_iterator.h |
4252 | +load_by_default= yes |
4253 | |
4254 | === added file 'plugin/info_schema_engine/table_name_iterator.cc' |
4255 | --- plugin/info_schema_engine/table_name_iterator.cc 1970-01-01 00:00:00 +0000 |
4256 | +++ plugin/info_schema_engine/table_name_iterator.cc 2009-10-29 23:56:17 +0000 |
4257 | @@ -0,0 +1,53 @@ |
4258 | +/* |
4259 | + * Copyright (C) 2009 Sun Microsystems |
4260 | + * |
4261 | + * This program is free software; you can redistribute it and/or modify |
4262 | + * it under the terms of the GNU General Public License as published by |
4263 | + * the Free Software Foundation; either version 2 of the License, or |
4264 | + * (at your option) any later version. |
4265 | + * |
4266 | + * This program is distributed in the hope that it will be useful, |
4267 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4268 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4269 | + * GNU General Public License for more details. |
4270 | + * |
4271 | + * You should have received a copy of the GNU General Public License |
4272 | + * along with this program; if not, write to the Free Software |
4273 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4274 | + */ |
4275 | + |
4276 | +#include <drizzled/server_includes.h> |
4277 | +#include <drizzled/plugin/info_schema_table.h> |
4278 | +#include <drizzled/plugin/storage_engine.h> |
4279 | +#include "table_name_iterator.h" |
4280 | + |
4281 | +#include <string> |
4282 | + |
4283 | +using namespace std; |
4284 | +using namespace drizzled; |
4285 | + |
4286 | +int InfoSchemaTableNameIterator::next(string *name) |
4287 | +{ |
4288 | +start: |
4289 | + if (iter == all_schema_tables.end()) |
4290 | + { |
4291 | + return -1; |
4292 | + } |
4293 | + |
4294 | + plugin::InfoSchemaTable *table= *iter; |
4295 | + |
4296 | + if (table->isHidden()) |
4297 | + { |
4298 | + ++iter; |
4299 | + goto start; |
4300 | + } |
4301 | + |
4302 | + if (name) |
4303 | + { |
4304 | + name->assign(table->getTableName()); |
4305 | + } |
4306 | + |
4307 | + ++iter; |
4308 | + |
4309 | + return 0; |
4310 | +} |
4311 | |
4312 | === added file 'plugin/info_schema_engine/table_name_iterator.h' |
4313 | --- plugin/info_schema_engine/table_name_iterator.h 1970-01-01 00:00:00 +0000 |
4314 | +++ plugin/info_schema_engine/table_name_iterator.h 2009-10-29 23:56:17 +0000 |
4315 | @@ -0,0 +1,61 @@ |
4316 | +/* |
4317 | + * Copyright (C) 2009 Sun Microsystems |
4318 | + * |
4319 | + * This program is free software; you can redistribute it and/or modify |
4320 | + * it under the terms of the GNU General Public License as published by |
4321 | + * the Free Software Foundation; either version 2 of the License, or |
4322 | + * (at your option) any later version. |
4323 | + * |
4324 | + * This program is distributed in the hope that it will be useful, |
4325 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4326 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4327 | + * GNU General Public License for more details. |
4328 | + * |
4329 | + * You should have received a copy of the GNU General Public License |
4330 | + * along with this program; if not, write to the Free Software |
4331 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4332 | + */ |
4333 | + |
4334 | +#ifndef DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H |
4335 | +#define DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H |
4336 | + |
4337 | +#include <drizzled/plugin/info_schema_table.h> |
4338 | +#include <drizzled/plugin/storage_engine.h> |
4339 | + |
4340 | +#include <vector> |
4341 | +#include <string> |
4342 | + |
4343 | +class InfoSchemaTableNameIterator : public drizzled::plugin::TableNameIteratorImplementation |
4344 | +{ |
4345 | +public: |
4346 | + |
4347 | + InfoSchemaTableNameIterator(const std::string &database) |
4348 | + : |
4349 | + drizzled::plugin::TableNameIteratorImplementation(database) |
4350 | + { |
4351 | + /* |
4352 | + * If the database passed to the constructor is not the I_S database |
4353 | + * then we set the iterator to the end of the vector of schema tables to |
4354 | + * ensure that the next() method will not return any tables. |
4355 | + */ |
4356 | + if (database.compare(INFORMATION_SCHEMA_NAME) == 0) |
4357 | + { |
4358 | + iter= drizzled::all_schema_tables.begin(); |
4359 | + } |
4360 | + else |
4361 | + { |
4362 | + iter= drizzled::all_schema_tables.end(); |
4363 | + } |
4364 | + } |
4365 | + |
4366 | + ~InfoSchemaTableNameIterator() {} |
4367 | + |
4368 | + int next(std::string *name); |
4369 | + |
4370 | +private: |
4371 | + |
4372 | + std::vector<drizzled::plugin::InfoSchemaTable *>::iterator iter; |
4373 | + |
4374 | +}; |
4375 | + |
4376 | +#endif /* DRIZZLE_PLUGIN_INFO_SCHEMA_ENGINE_TABLE_NAME_ITERATOR_H */ |
4377 | |
4378 | === modified file 'plugin/innobase/handler/ha_innodb.cc' |
4379 | --- plugin/innobase/handler/ha_innodb.cc 2009-10-16 10:27:33 +0000 |
4380 | +++ plugin/innobase/handler/ha_innodb.cc 2009-10-29 23:56:17 +0000 |
4381 | @@ -376,7 +376,7 @@ |
4382 | UNIV_INTERN int renameTableImplementation(Session* session, |
4383 | const char* from, |
4384 | const char* to); |
4385 | - UNIV_INTERN int deleteTableImplementation(Session* session, const string table_path); |
4386 | + UNIV_INTERN int deleteTableImplementation(Session* session, const string &table_path); |
4387 | }; |
4388 | |
4389 | /** @brief Initialize the default value of innodb_commit_concurrency. |
4390 | @@ -5959,7 +5959,7 @@ |
4391 | InnobaseEngine::deleteTableImplementation( |
4392 | /*======================*/ |
4393 | Session *session, |
4394 | - const string table_path) /* in: table name */ |
4395 | + const string &table_path) /* in: table name */ |
4396 | { |
4397 | int error; |
4398 | trx_t* parent_trx; |
4399 | |
4400 | === modified file 'plugin/innobase/handler/i_s.cc' |
4401 | --- plugin/innobase/handler/i_s.cc 2009-10-13 16:18:59 +0000 |
4402 | +++ plugin/innobase/handler/i_s.cc 2009-10-29 23:56:17 +0000 |
4403 | @@ -112,7 +112,6 @@ |
4404 | */ |
4405 | |
4406 | /* XXX these are defined in mysql_priv.h inside #ifdef DRIZZLE_SERVER */ |
4407 | -bool schema_table_store_record(Session *session, Table *table); |
4408 | void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from); |
4409 | |
4410 | /*******************************************************************//** |
4411 | @@ -205,8 +204,7 @@ |
4412 | DRIZZLE_TYPE_VARCHAR, |
4413 | 0, |
4414 | 0, |
4415 | - "", |
4416 | - SKIP_OPEN_TABLE), |
4417 | + ""), |
4418 | |
4419 | #define IDX_TRX_STATE 1 |
4420 | drizzled::plugin::ColumnInfo("trx_state", |
4421 | @@ -214,8 +212,7 @@ |
4422 | DRIZZLE_TYPE_VARCHAR, |
4423 | 0, |
4424 | 0, |
4425 | - "", |
4426 | - SKIP_OPEN_TABLE), |
4427 | + ""), |
4428 | |
4429 | #define IDX_TRX_STARTED 2 |
4430 | drizzled::plugin::ColumnInfo("trx_started", |
4431 | @@ -223,8 +220,7 @@ |
4432 | DRIZZLE_TYPE_DATETIME, |
4433 | 0, |
4434 | 0, |
4435 | - "", |
4436 | - SKIP_OPEN_TABLE), |
4437 | + ""), |
4438 | |
4439 | #define IDX_TRX_REQUESTED_LOCK_ID 3 |
4440 | drizzled::plugin::ColumnInfo("trx_requested_lock_id", |
4441 | @@ -232,8 +228,7 @@ |
4442 | DRIZZLE_TYPE_VARCHAR, |
4443 | 0, |
4444 | MY_I_S_MAYBE_NULL, |
4445 | - "", |
4446 | - SKIP_OPEN_TABLE), |
4447 | + ""), |
4448 | |
4449 | #define IDX_TRX_WAIT_STARTED 4 |
4450 | drizzled::plugin::ColumnInfo("trx_wait_started", |
4451 | @@ -241,8 +236,7 @@ |
4452 | DRIZZLE_TYPE_DATETIME, |
4453 | 0, |
4454 | MY_I_S_MAYBE_NULL, |
4455 | - "", |
4456 | - SKIP_OPEN_TABLE), |
4457 | + ""), |
4458 | |
4459 | #define IDX_TRX_WEIGHT 5 |
4460 | drizzled::plugin::ColumnInfo("trx_weight", |
4461 | @@ -250,8 +244,7 @@ |
4462 | DRIZZLE_TYPE_LONGLONG, |
4463 | 0, |
4464 | MY_I_S_UNSIGNED, |
4465 | - "", |
4466 | - SKIP_OPEN_TABLE), |
4467 | + ""), |
4468 | |
4469 | #define IDX_TRX_DRIZZLE_THREAD_ID 6 |
4470 | drizzled::plugin::ColumnInfo("trx_mysql_thread_id", |
4471 | @@ -259,8 +252,7 @@ |
4472 | DRIZZLE_TYPE_LONGLONG, |
4473 | 0, |
4474 | MY_I_S_UNSIGNED, |
4475 | - "", |
4476 | - SKIP_OPEN_TABLE), |
4477 | + ""), |
4478 | |
4479 | #define IDX_TRX_QUERY 7 |
4480 | drizzled::plugin::ColumnInfo("trx_query", |
4481 | @@ -268,8 +260,7 @@ |
4482 | DRIZZLE_TYPE_VARCHAR, |
4483 | 0, |
4484 | MY_I_S_MAYBE_NULL, |
4485 | - "", |
4486 | - SKIP_OPEN_TABLE), |
4487 | + ""), |
4488 | |
4489 | drizzled::plugin::ColumnInfo() |
4490 | }; |
4491 | @@ -283,8 +274,6 @@ |
4492 | fill_innodb_trx_from_cache( |
4493 | /*=======================*/ |
4494 | trx_i_s_cache_t* cache, /*!< in: cache to read from */ |
4495 | - Session* session,/*!< in: used to call |
4496 | - schema_table_store_record() */ |
4497 | Table* table) /*!< in/out: fill this table */ |
4498 | { |
4499 | Field** fields; |
4500 | @@ -351,7 +340,9 @@ |
4501 | OK(field_store_string(fields[IDX_TRX_QUERY], |
4502 | row->trx_query)); |
4503 | |
4504 | - OK(schema_table_store_record(session, table)); |
4505 | + TableList *tmp_list= table->pos_in_table_list; |
4506 | + tmp_list->schema_table->addRow(table->record[0], |
4507 | + table->s->reclength); |
4508 | } |
4509 | |
4510 | return(0); |
4511 | @@ -383,8 +374,7 @@ |
4512 | DRIZZLE_TYPE_VARCHAR, |
4513 | 0, |
4514 | 0, |
4515 | - "", |
4516 | - SKIP_OPEN_TABLE), |
4517 | + ""), |
4518 | |
4519 | #define IDX_LOCK_TRX_ID 1 |
4520 | drizzled::plugin::ColumnInfo("lock_trx_id", |
4521 | @@ -392,8 +382,7 @@ |
4522 | DRIZZLE_TYPE_VARCHAR, |
4523 | 0, |
4524 | 0, |
4525 | - "", |
4526 | - SKIP_OPEN_TABLE), |
4527 | + ""), |
4528 | |
4529 | #define IDX_LOCK_MODE 2 |
4530 | drizzled::plugin::ColumnInfo("lock_mode", |
4531 | @@ -402,8 +391,7 @@ |
4532 | DRIZZLE_TYPE_VARCHAR, |
4533 | 0, |
4534 | 0, |
4535 | - "", |
4536 | - SKIP_OPEN_TABLE), |
4537 | + ""), |
4538 | |
4539 | #define IDX_LOCK_TYPE 3 |
4540 | drizzled::plugin::ColumnInfo("lock_type", |
4541 | @@ -411,8 +399,7 @@ |
4542 | DRIZZLE_TYPE_VARCHAR, |
4543 | 0, |
4544 | 0, |
4545 | - "", |
4546 | - SKIP_OPEN_TABLE), |
4547 | + ""), |
4548 | |
4549 | #define IDX_LOCK_TABLE 4 |
4550 | drizzled::plugin::ColumnInfo("lock_table", |
4551 | @@ -420,8 +407,7 @@ |
4552 | DRIZZLE_TYPE_VARCHAR, |
4553 | 0, |
4554 | 0, |
4555 | - "", |
4556 | - SKIP_OPEN_TABLE), |
4557 | + ""), |
4558 | |
4559 | #define IDX_LOCK_INDEX 5 |
4560 | drizzled::plugin::ColumnInfo("lock_index", |
4561 | @@ -429,8 +415,7 @@ |
4562 | DRIZZLE_TYPE_VARCHAR, |
4563 | 0, |
4564 | MY_I_S_MAYBE_NULL, |
4565 | - "", |
4566 | - SKIP_OPEN_TABLE), |
4567 | + ""), |
4568 | |
4569 | #define IDX_LOCK_SPACE 6 |
4570 | drizzled::plugin::ColumnInfo("lock_space", |
4571 | @@ -438,8 +423,7 @@ |
4572 | DRIZZLE_TYPE_LONGLONG, |
4573 | 0, |
4574 | MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, |
4575 | - "", |
4576 | - SKIP_OPEN_TABLE), |
4577 | + ""), |
4578 | |
4579 | #define IDX_LOCK_PAGE 7 |
4580 | drizzled::plugin::ColumnInfo("lock_page", |
4581 | @@ -447,8 +431,7 @@ |
4582 | DRIZZLE_TYPE_LONGLONG, |
4583 | 0, |
4584 | MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, |
4585 | - "", |
4586 | - SKIP_OPEN_TABLE), |
4587 | + ""), |
4588 | |
4589 | #define IDX_LOCK_REC 8 |
4590 | drizzled::plugin::ColumnInfo("lock_rec", |
4591 | @@ -456,8 +439,7 @@ |
4592 | DRIZZLE_TYPE_LONGLONG, |
4593 | 0, |
4594 | MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, |
4595 | - "", |
4596 | - SKIP_OPEN_TABLE), |
4597 | + ""), |
4598 | |
4599 | #define IDX_LOCK_DATA 9 |
4600 | drizzled::plugin::ColumnInfo("lock_data", |
4601 | @@ -465,8 +447,7 @@ |
4602 | DRIZZLE_TYPE_VARCHAR, |
4603 | 0, |
4604 | MY_I_S_MAYBE_NULL, |
4605 | - "", |
4606 | - SKIP_OPEN_TABLE), |
4607 | + ""), |
4608 | |
4609 | drizzled::plugin::ColumnInfo() |
4610 | }; |
4611 | @@ -571,7 +552,9 @@ |
4612 | OK(field_store_string(fields[IDX_LOCK_DATA], |
4613 | row->lock_data)); |
4614 | |
4615 | - OK(schema_table_store_record(session, table)); |
4616 | + TableList *tmp_list= table->pos_in_table_list; |
4617 | + tmp_list->schema_table->addRow(table->record[0], |
4618 | + table->s->reclength); |
4619 | } |
4620 | |
4621 | return(0); |
4622 | @@ -603,8 +586,7 @@ |
4623 | DRIZZLE_TYPE_VARCHAR, |
4624 | 0, |
4625 | 0, |
4626 | - "", |
4627 | - SKIP_OPEN_TABLE), |
4628 | + ""), |
4629 | |
4630 | #define IDX_REQUESTED_LOCK_ID 1 |
4631 | drizzled::plugin::ColumnInfo("requested_lock_id", |
4632 | @@ -612,8 +594,7 @@ |
4633 | DRIZZLE_TYPE_VARCHAR, |
4634 | 0, |
4635 | 0, |
4636 | - "", |
4637 | - SKIP_OPEN_TABLE), |
4638 | + ""), |
4639 | |
4640 | #define IDX_BLOCKING_TRX_ID 2 |
4641 | drizzled::plugin::ColumnInfo("blocking_trx_id", |
4642 | @@ -621,8 +602,7 @@ |
4643 | DRIZZLE_TYPE_VARCHAR, |
4644 | 0, |
4645 | 0, |
4646 | - "", |
4647 | - SKIP_OPEN_TABLE), |
4648 | + ""), |
4649 | |
4650 | #define IDX_BLOCKING_LOCK_ID 3 |
4651 | drizzled::plugin::ColumnInfo("blocking_lock_id", |
4652 | @@ -630,8 +610,7 @@ |
4653 | DRIZZLE_TYPE_VARCHAR, |
4654 | 0, |
4655 | 0, |
4656 | - "", |
4657 | - SKIP_OPEN_TABLE), |
4658 | + ""), |
4659 | |
4660 | drizzled::plugin::ColumnInfo() |
4661 | }; |
4662 | @@ -645,8 +624,6 @@ |
4663 | fill_innodb_lock_waits_from_cache( |
4664 | /*==============================*/ |
4665 | trx_i_s_cache_t* cache, /*!< in: cache to read from */ |
4666 | - Session* session,/*!< in: used to call |
4667 | - schema_table_store_record() */ |
4668 | Table* table) /*!< in/out: fill this table */ |
4669 | { |
4670 | Field** fields; |
4671 | @@ -699,7 +676,9 @@ |
4672 | blocking_lock_id, |
4673 | sizeof(blocking_lock_id)))); |
4674 | |
4675 | - OK(schema_table_store_record(session, table)); |
4676 | + TableList *tmp_list= table->pos_in_table_list; |
4677 | + tmp_list->schema_table->addRow(table->record[0], |
4678 | + table->s->reclength); |
4679 | } |
4680 | |
4681 | return(0); |
4682 | @@ -734,8 +713,7 @@ |
4683 | TrxISMethods::fillTable( |
4684 | /*======================*/ |
4685 | Session* session,/*!< in: thread */ |
4686 | - TableList* tables, /*!< in/out: tables to fill */ |
4687 | - COND* ) /*!< in: condition (not used) */ |
4688 | + TableList* tables) /*!< in/out: tables to fill */ |
4689 | { |
4690 | const char* table_name; |
4691 | int ret; |
4692 | @@ -771,7 +749,7 @@ |
4693 | if (innobase_strcasecmp(table_name, "innodb_trx") == 0) { |
4694 | |
4695 | if (fill_innodb_trx_from_cache( |
4696 | - cache, session, tables->table) != 0) { |
4697 | + cache, tables->table) != 0) { |
4698 | |
4699 | ret = 1; |
4700 | } |
4701 | @@ -787,7 +765,7 @@ |
4702 | } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) { |
4703 | |
4704 | if (fill_innodb_lock_waits_from_cache( |
4705 | - cache, session, tables->table) != 0) { |
4706 | + cache, tables->table) != 0) { |
4707 | |
4708 | ret = 1; |
4709 | } |
4710 | @@ -826,48 +804,42 @@ |
4711 | DRIZZLE_TYPE_LONG, |
4712 | 0, |
4713 | 0, |
4714 | - "Compressed Page Size", |
4715 | - SKIP_OPEN_TABLE), |
4716 | + "Compressed Page Size"), |
4717 | |
4718 | drizzled::plugin::ColumnInfo("compress_ops", |
4719 | MY_INT32_NUM_DECIMAL_DIGITS, |
4720 | DRIZZLE_TYPE_LONG, |
4721 | 0, |
4722 | 0, |
4723 | - "Total Number of Compressions", |
4724 | - SKIP_OPEN_TABLE), |
4725 | + "Total Number of Compressions"), |
4726 | |
4727 | drizzled::plugin::ColumnInfo("compress_ops_ok", |
4728 | MY_INT32_NUM_DECIMAL_DIGITS, |
4729 | DRIZZLE_TYPE_LONG, |
4730 | 0, |
4731 | 0, |
4732 | - "Total Number of Successful Compressions", |
4733 | - SKIP_OPEN_TABLE), |
4734 | + "Total Number of Successful Compressions"), |
4735 | |
4736 | drizzled::plugin::ColumnInfo("compress_time", |
4737 | MY_INT32_NUM_DECIMAL_DIGITS, |
4738 | DRIZZLE_TYPE_LONG, |
4739 | 0, |
4740 | 0, |
4741 | - "Total Duration of Compressions in Seconds", |
4742 | - SKIP_OPEN_TABLE), |
4743 | + "Total Duration of Compressions in Seconds"), |
4744 | |
4745 | drizzled::plugin::ColumnInfo("uncompress_ops", |
4746 | MY_INT32_NUM_DECIMAL_DIGITS, |
4747 | DRIZZLE_TYPE_LONG, |
4748 | 0, |
4749 | 0, |
4750 | - "Total Number of Decompressions", |
4751 | - SKIP_OPEN_TABLE), |
4752 | + "Total Number of Decompressions"), |
4753 | |
4754 | drizzled::plugin::ColumnInfo("uncompress_time", |
4755 | MY_INT32_NUM_DECIMAL_DIGITS, |
4756 | DRIZZLE_TYPE_LONG, |
4757 | 0, |
4758 | 0, |
4759 | - "Total Duration of Decompressions in Seconds", |
4760 | - SKIP_OPEN_TABLE), |
4761 | + "Total Duration of Decompressions in Seconds"), |
4762 | |
4763 | drizzled::plugin::ColumnInfo() |
4764 | }; |
4765 | @@ -883,7 +855,6 @@ |
4766 | /*=============*/ |
4767 | Session* session,/*!< in: thread */ |
4768 | TableList* tables, /*!< in/out: tables to fill */ |
4769 | - COND* , /*!< in: condition (ignored) */ |
4770 | ibool reset) /*!< in: TRUE=reset cumulated counts */ |
4771 | { |
4772 | Table* table = (Table *) tables->table; |
4773 | @@ -915,10 +886,9 @@ |
4774 | memset(zip_stat, 0, sizeof *zip_stat); |
4775 | } |
4776 | |
4777 | - if (schema_table_store_record(session, table)) { |
4778 | - status = 1; |
4779 | - break; |
4780 | - } |
4781 | + TableList *tmp_list= table->pos_in_table_list; |
4782 | + tmp_list->schema_table->addRow(table->record[0], |
4783 | + table->s->reclength); |
4784 | } |
4785 | |
4786 | return(status); |
4787 | @@ -931,10 +901,9 @@ |
4788 | CmpISMethods::fillTable( |
4789 | /*=========*/ |
4790 | Session* session,/*!< in: thread */ |
4791 | - TableList* tables, /*!< in/out: tables to fill */ |
4792 | - COND* cond) /*!< in: condition (ignored) */ |
4793 | + TableList* tables) /*!< in/out: tables to fill */ |
4794 | { |
4795 | - return(i_s_cmp_fill_low(session, tables, cond, FALSE)); |
4796 | + return(i_s_cmp_fill_low(session, tables, FALSE)); |
4797 | } |
4798 | |
4799 | /*******************************************************************//** |
4800 | @@ -944,10 +913,9 @@ |
4801 | CmpResetISMethods::fillTable( |
4802 | /*===============*/ |
4803 | Session* session,/*!< in: thread */ |
4804 | - TableList* tables, /*!< in/out: tables to fill */ |
4805 | - COND* cond) /*!< in: condition (ignored) */ |
4806 | + TableList* tables) /*!< in/out: tables to fill */ |
4807 | { |
4808 | - return(i_s_cmp_fill_low(session, tables, cond, TRUE)); |
4809 | + return(i_s_cmp_fill_low(session, tables, TRUE)); |
4810 | } |
4811 | |
4812 | /*******************************************************************//** |
4813 | @@ -994,40 +962,35 @@ |
4814 | DRIZZLE_TYPE_LONG, |
4815 | 0, |
4816 | 0, |
4817 | - "Buddy Block Size", |
4818 | - SKIP_OPEN_TABLE), |
4819 | + "Buddy Block Size"), |
4820 | |
4821 | drizzled::plugin::ColumnInfo("pages_used", |
4822 | MY_INT32_NUM_DECIMAL_DIGITS, |
4823 | DRIZZLE_TYPE_LONG, |
4824 | 0, |
4825 | 0, |
4826 | - "Currently in Use", |
4827 | - SKIP_OPEN_TABLE), |
4828 | + "Currently in Use"), |
4829 | |
4830 | drizzled::plugin::ColumnInfo("pages_free", |
4831 | MY_INT32_NUM_DECIMAL_DIGITS, |
4832 | DRIZZLE_TYPE_LONG, |
4833 | 0, |
4834 | 0, |
4835 | - "Currently Available", |
4836 | - SKIP_OPEN_TABLE), |
4837 | + "Currently Available"), |
4838 | |
4839 | drizzled::plugin::ColumnInfo("relocation_ops", |
4840 | MY_INT64_NUM_DECIMAL_DIGITS, |
4841 | DRIZZLE_TYPE_LONGLONG, |
4842 | 0, |
4843 | 0, |
4844 | - "Total Number of Relocations", |
4845 | - SKIP_OPEN_TABLE), |
4846 | + "Total Number of Relocations"), |
4847 | |
4848 | drizzled::plugin::ColumnInfo("relocation_time", |
4849 | MY_INT32_NUM_DECIMAL_DIGITS, |
4850 | DRIZZLE_TYPE_LONG, |
4851 | 0, |
4852 | 0, |
4853 | - "Total Duration of Relocations, in Seconds", |
4854 | - SKIP_OPEN_TABLE), |
4855 | + "Total Duration of Relocations, in Seconds"), |
4856 | |
4857 | drizzled::plugin::ColumnInfo() |
4858 | }; |
4859 | @@ -1042,7 +1005,6 @@ |
4860 | /*================*/ |
4861 | Session* session,/*!< in: thread */ |
4862 | TableList* tables, /*!< in/out: tables to fill */ |
4863 | - COND* , /*!< in: condition (ignored) */ |
4864 | ibool reset) /*!< in: TRUE=reset cumulated counts */ |
4865 | { |
4866 | Table* table = (Table *) tables->table; |
4867 | @@ -1070,10 +1032,9 @@ |
4868 | buddy_stat->relocated_usec = 0; |
4869 | } |
4870 | |
4871 | - if (schema_table_store_record(session, table)) { |
4872 | - status = 1; |
4873 | - break; |
4874 | - } |
4875 | + TableList *tmp_list= table->pos_in_table_list; |
4876 | + tmp_list->schema_table->addRow(table->record[0], |
4877 | + table->s->reclength); |
4878 | } |
4879 | |
4880 | buf_pool_mutex_exit(); |
4881 | @@ -1087,10 +1048,9 @@ |
4882 | CmpmemISMethods::fillTable( |
4883 | /*============*/ |
4884 | Session* session,/*!< in: thread */ |
4885 | - TableList* tables, /*!< in/out: tables to fill */ |
4886 | - COND* cond) /*!< in: condition (ignored) */ |
4887 | + TableList* tables) /*!< in/out: tables to fill */ |
4888 | { |
4889 | - return(i_s_cmpmem_fill_low(session, tables, cond, FALSE)); |
4890 | + return(i_s_cmpmem_fill_low(session, tables, FALSE)); |
4891 | } |
4892 | |
4893 | /*******************************************************************//** |
4894 | @@ -1100,10 +1060,9 @@ |
4895 | CmpmemResetISMethods::fillTable( |
4896 | /*==================*/ |
4897 | Session* session,/*!< in: thread */ |
4898 | - TableList* tables, /*!< in/out: tables to fill */ |
4899 | - COND* cond) /*!< in: condition (ignored) */ |
4900 | + TableList* tables) /*!< in/out: tables to fill */ |
4901 | { |
4902 | - return(i_s_cmpmem_fill_low(session, tables, cond, TRUE)); |
4903 | + return(i_s_cmpmem_fill_low(session, tables, TRUE)); |
4904 | } |
4905 | |
4906 | /*******************************************************************//** |
4907 | |
4908 | === modified file 'plugin/innobase/handler/i_s.h' |
4909 | --- plugin/innobase/handler/i_s.h 2009-10-13 06:36:19 +0000 |
4910 | +++ plugin/innobase/handler/i_s.h 2009-10-29 23:56:17 +0000 |
4911 | @@ -30,48 +30,42 @@ |
4912 | { |
4913 | public: |
4914 | virtual int fillTable(Session *session, |
4915 | - TableList *tables, |
4916 | - COND *cond); |
4917 | + TableList *tables); |
4918 | }; |
4919 | |
4920 | class LocksISMethods : public drizzled::plugin::InfoSchemaMethods |
4921 | { |
4922 | public: |
4923 | virtual int fillTable(Session *session, |
4924 | - TableList *tables, |
4925 | - COND *cond); |
4926 | + TableList *tables); |
4927 | }; |
4928 | |
4929 | class CmpISMethods : public drizzled::plugin::InfoSchemaMethods |
4930 | { |
4931 | public: |
4932 | virtual int fillTable(Session *session, |
4933 | - TableList *tables, |
4934 | - COND *cond); |
4935 | + TableList *tables); |
4936 | }; |
4937 | |
4938 | class CmpResetISMethods : public drizzled::plugin::InfoSchemaMethods |
4939 | { |
4940 | public: |
4941 | virtual int fillTable(Session *session, |
4942 | - TableList *tables, |
4943 | - COND *cond); |
4944 | + TableList *tables); |
4945 | }; |
4946 | |
4947 | class CmpmemISMethods : public drizzled::plugin::InfoSchemaMethods |
4948 | { |
4949 | public: |
4950 | virtual int fillTable(Session *session, |
4951 | - TableList *tables, |
4952 | - COND *cond); |
4953 | + TableList *tables); |
4954 | }; |
4955 | |
4956 | class CmpmemResetISMethods : public drizzled::plugin::InfoSchemaMethods |
4957 | { |
4958 | public: |
4959 | virtual int fillTable(Session *session, |
4960 | - TableList *tables, |
4961 | - COND *cond); |
4962 | + TableList *tables); |
4963 | }; |
4964 | |
4965 | int i_s_common_deinit(drizzled::plugin::Registry ®istry); |
4966 | |
4967 | === modified file 'plugin/memcached_stats/analysis_table.cc' |
4968 | --- plugin/memcached_stats/analysis_table.cc 2009-10-03 17:20:06 +0000 |
4969 | +++ plugin/memcached_stats/analysis_table.cc 2009-10-29 23:56:17 +0000 |
4970 | @@ -42,9 +42,8 @@ |
4971 | using namespace std; |
4972 | using namespace drizzled; |
4973 | |
4974 | -int MemcachedAnalysisISMethods::fillTable(Session *session, |
4975 | - TableList *tables, |
4976 | - COND *) |
4977 | +int MemcachedAnalysisISMethods::fillTable(Session *, |
4978 | + TableList *tables) |
4979 | { |
4980 | const CHARSET_INFO * const scs= system_charset_info; |
4981 | Table *table= tables->table; |
4982 | @@ -88,10 +87,8 @@ |
4983 | table->field[8]->store(report->pool_hit_ratio); |
4984 | |
4985 | /* store the actual record now */ |
4986 | - if (schema_table_store_record(session, table)) |
4987 | - { |
4988 | - return 1; |
4989 | - } |
4990 | + TableList *tmp_list= table->pos_in_table_list; |
4991 | + tmp_list->schema_table->addRow(table->record[0], table->s->reclength); |
4992 | free(report); |
4993 | } |
4994 | |
4995 | @@ -110,8 +107,7 @@ |
4996 | DRIZZLE_TYPE_LONGLONG, |
4997 | 0, |
4998 | 0, |
4999 | - "Num of Servers Analyzed", |
5000 | - SKIP_OPEN_TABLE); |
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