~drizzle-trunk/drizzle/development

1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2009 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
1130.3.8 by Monty Taylor
Merged latest plugin-slot-reorg changes.
21
#ifndef DRIZZLED_PLUGIN_INFO_SCHEMA_TABLE_H
22
#define DRIZZLED_PLUGIN_INFO_SCHEMA_TABLE_H
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
23
1081.2.4 by Padraig O'Sullivan
Extracted TABLES into the I_S plugin.
24
#include <string>
1198 by Brian Aker
Merge Brian
25
#include <set>
1081.2.4 by Padraig O'Sullivan
Extracted TABLES into the I_S plugin.
26
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
27
namespace drizzled
28
{
29
namespace plugin
30
{
31
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
32
/**
33
 * @file
34
 *   info_schema.h
35
 * @brief 
36
 *   Header file which contains all classes related to I_S
37
 */
38
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
39
typedef class Item COND;
40
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
41
42
/**
1081.2.7 by Padraig O'Sullivan
Updating doxygen comments in I_S related classes to be of the correct format.
43
 * @class ColumnInfo
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
44
 * @brief
45
 *   Represents a field (column) in an I_S table.
46
 */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
47
class ColumnInfo 
48
{ 
49
public: 
50
  ColumnInfo(const std::string& in_name, 
51
             uint32_t in_length, 
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
52
             enum enum_field_types in_type,
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
53
             int32_t in_value,
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
54
             uint32_t in_flags,
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
55
             const std::string& in_old_name,
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
56
             uint32_t in_open_method)
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
57
    :
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
58
      name(in_name),
59
      length(in_length),
60
      type(in_type),
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
61
      value(in_value),
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
62
      flags(in_flags),
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
63
      old_name(in_old_name),
64
      open_method(in_open_method)
65
  {}
66
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
67
  ColumnInfo()
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
68
    :
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
69
      name(),
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
70
      length(0),
71
      type(DRIZZLE_TYPE_VARCHAR),
72
      flags(0),
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
73
      old_name(),
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
74
      open_method(SKIP_OPEN_TABLE)
75
  {}
76
77
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
78
   * @return the name of this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
79
   */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
80
  const std::string &getName() const
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
81
  {
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
82
    return name;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
83
  }
84
85
  /**
1067.2.10 by Padraig O'Sullivan
Adding some extra doxygen comments to the ColumnInfo class based on some
86
   * This method is only ever called from the
87
   * InfoSchemaMethods::oldFormat() methods. It is mostly
88
   * for old SHOW compatability. It is used when a list
89
   * of fields need to be generated for SHOW. The names
90
   * for those fields (or columns) are found by calling
91
   * this method on each column in the I_S table.
92
   *
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
93
   * @return the old name of this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
94
   */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
95
  const std::string &getOldName() const
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
96
  {
97
    return old_name;
98
  }
99
100
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
101
   * @return the open method for this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
102
   */
103
  uint32_t getOpenMethod() const
104
  {
105
    return open_method;
106
  }
107
108
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
109
   * @return the flags for this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
110
   */
111
  uint32_t getFlags() const
112
  {
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
113
    return flags;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
114
  }
115
116
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
117
   * @return the length of this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
118
   */
119
  uint32_t getLength() const
120
  {
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
121
    return length;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
122
  }
123
124
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
125
   * @return the value of this column.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
126
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
127
  int32_t getValue() const
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
128
  {
129
    return value;
130
  }
131
132
  /**
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
133
   * @return this column's type.
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
134
   */
135
  enum enum_field_types getType() const
136
  {
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
137
    return type;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
138
  }
139
140
private:
141
142
  /**
143
   * This is used as column name.
144
   */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
145
  const std::string name;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
146
147
  /**
148
   * For string-type columns, this is the maximum number of
149
   * characters. Otherwise, it is the 'display-length' for the column.
150
   */
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
151
  uint32_t length;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
152
153
  /**
154
   * This denotes data type for the column. For the most part, there seems to
155
   * be one entry in the enum for each SQL data type, although there seem to
156
   * be a number of additional entries in the enum.
157
   */
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
158
  enum enum_field_types type;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
159
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
160
  int32_t value;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
161
162
  /**
163
   * This is used to set column attributes. By default, columns are @c NOT
164
   * @c NULL and @c SIGNED, and you can deviate from the default
165
   * by setting the appopriate flags. You can use either one of the flags
166
   * @c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or
167
   * combine them using the bitwise or operator @c |. Both flags are
168
   * defined in table.h.
169
   */
1067.2.2 by Padraig O'Sullivan
Forgot to remove the definition of the process list table's methods from
170
  uint32_t flags;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
171
1067.2.10 by Padraig O'Sullivan
Adding some extra doxygen comments to the ColumnInfo class based on some
172
  /**
173
   * The name of this column which is used for old SHOW
174
   * compatability.
175
   */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
176
  const std::string old_name;
1063.4.9 by Padraig O'Sullivan
Converted the ST_FIELDS_INFO structure to a class named FieldInfo. Made all
177
178
  /**
179
   * This should be one of @c SKIP_OPEN_TABLE,
180
   * @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
181
   */
182
  uint32_t open_method;
183
184
};
185
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
186
/**
1081.2.7 by Padraig O'Sullivan
Updating doxygen comments in I_S related classes to be of the correct format.
187
 * @class InfoSchemaMethods
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
188
 * @brief
189
 *   The methods that an I_S table can support
190
 */
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
191
class InfoSchemaMethods
192
{
193
public:
194
  virtual ~InfoSchemaMethods() {}
195
196
  virtual Table *createSchemaTable(Session *session,
197
                                   TableList *table_list) const;
198
  virtual int fillTable(Session *session, 
199
                        TableList *tables,
200
                        COND *cond);
201
  virtual int processTable(Session *session, TableList *tables,
202
                           Table *table, bool res, LEX_STRING *db_name,
203
                           LEX_STRING *table_name) const;
204
  virtual int oldFormat(Session *session, 
1130.1.7 by Monty Taylor
Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay.
205
                        InfoSchemaTable *schema_table) const;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
206
};
207
208
/**
1130.1.7 by Monty Taylor
Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay.
209
 * @class InfoSchemaTable
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
210
 * @brief 
211
 *   Represents an I_S table.
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
212
 */
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
213
class InfoSchemaTable : public Plugin
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
214
{
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
215
  InfoSchemaTable();
216
  InfoSchemaTable(const InfoSchemaTable &);
217
  InfoSchemaTable& operator=(const InfoSchemaTable &);
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
218
public:
1067.2.9 by Padraig O'Sullivan
Removed the getSpecificColumn(), beginColumnInfo(), endColumnInfo() methods
219
220
  typedef std::vector<const ColumnInfo *> Columns;
221
  
1130.1.7 by Monty Taylor
Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay.
222
  InfoSchemaTable(const std::string& tab_name,
1067.2.9 by Padraig O'Sullivan
Removed the getSpecificColumn(), beginColumnInfo(), endColumnInfo() methods
223
                  Columns& in_column_info,
1067.2.6 by Padraig O'Sullivan
Modularized the info schema plugin. Have a separate file which contains
224
                  int idx_col1,
225
                  int idx_col2,
226
                  bool in_hidden,
227
                  bool in_opt_possible,
228
                  uint32_t req_object,
229
                  InfoSchemaMethods *in_methods)
230
    :
1192.2.5 by Monty Taylor
Replaced overridable virtual methods with passing name to constructor. Now individual plugins will not be allowed to set their own plugin type name. :)
231
      Plugin(tab_name, "InfoSchemaTable"),
1067.2.6 by Padraig O'Sullivan
Modularized the info schema plugin. Have a separate file which contains
232
      hidden(in_hidden),
233
      is_opt_possible(in_opt_possible),
234
      first_column_index(idx_col1),
235
      second_column_index(idx_col2),
236
      requested_object(req_object),
237
      column_info(in_column_info),
238
      i_s_methods(in_methods)
239
  {}
240
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
241
  explicit InfoSchemaTable(const std::string& tab_name)
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
242
    :
1192.2.5 by Monty Taylor
Replaced overridable virtual methods with passing name to constructor. Now individual plugins will not be allowed to set their own plugin type name. :)
243
      Plugin(tab_name, "InfoSchemaTable"),
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
244
      hidden(false),
245
      is_opt_possible(false),
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
246
      first_column_index(0),
247
      second_column_index(0),
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
248
      requested_object(0),
1067.2.6 by Padraig O'Sullivan
Modularized the info schema plugin. Have a separate file which contains
249
      column_info(),
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
250
      i_s_methods(NULL)
251
  {}
252
1130.2.10 by Monty Taylor
Added Virtual destructor (ooops.) Also removed some left over now-unused methods.
253
  virtual ~InfoSchemaTable()
254
  {}
255
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
256
  /**
257
   * Set the methods available on this I_S table.
258
   * @param[in] new_methods the methods to use
259
   */
260
  void setInfoSchemaMethods(InfoSchemaMethods *new_methods)
261
  {
262
    i_s_methods= new_methods;
263
  }
264
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
265
  /**
1063.4.8 by Padraig O'Sullivan
Removing a code block I had commented out for debugging. Also added more
266
   * Create the temporary I_S tables using schema_table data.
267
   *
268
   * @param[in] session a session handler
269
   * @param[in] table_list Used to pass I_S table information (fields,
270
   *                       tables, parameters, etc.) and table name
271
   * @retval \# pointer to created table
272
   * @retval NULL Can't create table
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
273
   */
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
274
  Table *createSchemaTable(Session *session, TableList *table_list) const
275
  {
276
    Table *retval= i_s_methods->createSchemaTable(session, table_list);
277
    return retval;
278
  }
279
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
280
  /**
1063.4.8 by Padraig O'Sullivan
Removing a code block I had commented out for debugging. Also added more
281
   * Fill I_S table.
282
   *
283
   * @param[in] session a session handler
284
   * @param[in] tables I_S table
285
   * @param[in] cond 'WHERE' condition
286
   * @return 0 on success; 1 on error
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
287
   */
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
288
  int fillTable(Session *session, TableList *tables, COND *cond)
289
  {
290
    int retval= i_s_methods->fillTable(session, tables, cond);
291
    return retval;
292
  }
293
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
294
  /**
1063.4.8 by Padraig O'Sullivan
Removing a code block I had commented out for debugging. Also added more
295
   * Fill and store records into an I_S table.
296
   *
297
   * @param[in] session a session handler
298
   * @param[in] tables table list (processed table)
299
   * @param[in] table I_S table
300
   * @param[in] res 1 means error during opening of the processed table
301
   *                0 means processed table opened without error
302
   * @param[in] db_name database name
303
   * @param[in] tab_name table name
304
   * @return 0 on success; 1 on error
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
305
   */
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
306
  int processTable(Session *session, TableList *tables, Table *table,
307
                   bool res, LEX_STRING *db_name, LEX_STRING *tab_name) const
308
  {
309
    int retval= i_s_methods->processTable(session, tables, table,
310
                                          res, db_name, tab_name);
311
    return retval;
312
  }
313
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
314
  /**
1063.4.8 by Padraig O'Sullivan
Removing a code block I had commented out for debugging. Also added more
315
   * For old SHOW compatibility. It is used when old SHOW doesn't
316
   * have generated column names. Generates the list of fields
317
   * for SHOW.
318
   *
319
   * @param[in] session a session handler
320
   * @param[in] schema_table pointer to element of the I_S tables list
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
321
   */
1130.1.7 by Monty Taylor
Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay.
322
  int oldFormat(Session *session, InfoSchemaTable *schema_table) const
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
323
  {
324
    int retval= i_s_methods->oldFormat(session, schema_table);
325
    return retval;
326
  }
327
328
  /**
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
329
   * @param[in] new_first_index value to set first column index to
330
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
331
  void setFirstColumnIndex(int32_t new_first_index)
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
332
  {
333
    first_column_index= new_first_index;
334
  }
335
336
  /**
337
   * @param[in] new_second_index value to set second column index to
338
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
339
  void setSecondColumnIndex(int32_t new_second_index)
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
340
  {
341
    second_column_index= new_second_index;
342
  }
343
344
  /**
345
   * @param[in] in_column_info the columns info to use for this I_S table
346
   */
347
  void setColumnInfo(ColumnInfo *in_column_info)
348
  {
1067.2.5 by Padraig O'Sullivan
Modified the InfoSchemaTable class to now hold information on columns in a
349
    ColumnInfo *tmp= in_column_info;
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
350
    for (; tmp->getName().length() != 0; tmp++)
1067.2.5 by Padraig O'Sullivan
Modified the InfoSchemaTable class to now hold information on columns in a
351
    {
352
      column_info.push_back(tmp);
353
    }
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
354
  }
355
356
  /**
357
   * @return the name of the I_S table.
358
   */
1076.2.2 by Padraig O'Sullivan
Converted the const char * members of InfoSchemaTable to be std::string
359
  const std::string &getTableName() const
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
360
  {
1130.2.9 by Monty Taylor
Fixed test problem. (Thanks Padraig!)
361
    return getName();
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
362
  }
363
364
  /**
1183.1.15 by Brian Aker
I_S now provides its own tables via the SE interface
365
   * @return the names of the I_S tables.
366
   */
1198 by Brian Aker
Merge Brian
367
  static void getTableNames(std::set<std::string>& tables_names);
1183.1.15 by Brian Aker
I_S now provides its own tables via the SE interface
368
369
  /**
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
370
   * @return true if this I_S table is hidden; false otherwise.
371
   */
372
  bool isHidden() const
373
  {
374
    return hidden;
375
  }
376
377
  /**
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
378
   * @return true if I_S optimizations can be performed on this
379
   *         I_S table when running the fillTable method; false
380
   *         otherwise.
381
   */
382
  bool isOptimizationPossible() const
383
  {
384
    return is_opt_possible;
385
  }
386
387
  /**
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
388
   * @return the index for the first field.
389
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
390
  int32_t getFirstColumnIndex() const
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
391
  {
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
392
    return first_column_index;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
393
  }
394
395
  /**
396
   * @return the index the second field.
397
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
398
  int32_t getSecondColumnIndex() const
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
399
  {
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
400
    return second_column_index;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
401
  }
402
403
  /**
404
   * @return the requested object.
405
   */
406
  uint32_t getRequestedObject() const
407
  {
408
    return requested_object;
409
  }
410
411
  /**
1067.2.9 by Padraig O'Sullivan
Removed the getSpecificColumn(), beginColumnInfo(), endColumnInfo() methods
412
   * @return the columns for this I_S table
413
   */
414
  const Columns &getColumns() const
415
  {
416
    return column_info;
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
417
  }
418
419
  /**
420
   * @param[in] index the index of this column
421
   * @return the name for the column at the given index
422
   */
1076.2.1 by Padraig O'Sullivan
Converted the const char * members of ColumnInfo to be std::string instead.
423
  const std::string &getColumnName(int index) const
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
424
  {
1067.2.5 by Padraig O'Sullivan
Modified the InfoSchemaTable class to now hold information on columns in a
425
    return column_info[index]->getName();
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
426
  }
427
428
  /**
429
   * @param[in] index the index of this column
430
   * @return the open method for the column at the given index
431
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
432
  uint32_t getColumnOpenMethod(int index) const
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
433
  {
1067.2.5 by Padraig O'Sullivan
Modified the InfoSchemaTable class to now hold information on columns in a
434
    return column_info[index]->getOpenMethod();
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
435
  }
436
437
private:
438
439
  /**
440
   * Boolean which indicates whether this I_S table
441
   * is hidden or not. If it is hidden, it will not show
442
   * up in the list of I_S tables.
443
   */
444
  bool hidden;
445
446
  /**
1063.4.7 by Padraig O'Sullivan
Added some doxygen comments. Added a new boolean variable to the
447
   * Boolean which indicates whether optimizations are
448
   * possible on this I_S table when performing the
449
   * fillTable method.
450
   */
451
  bool is_opt_possible;
452
453
  /**
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
454
   * The index of the first column.
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
455
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
456
  int32_t first_column_index;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
457
458
  /**
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
459
   * The index of the second column.
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
460
   */
1067.2.8 by Padraig O'Sullivan
Converting arguments and member variables for ColumnInfo and InfoSchemaTable
461
  int32_t second_column_index;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
462
463
  /**
464
   * The object to open (TABLE | VIEW).
465
   */
466
  uint32_t requested_object;
467
468
  /**
1063.4.10 by Padraig O'Sullivan
Changing name of FieldInfo class to ColumnInfo based on some feedback from
469
   * The columns for this I_S table.
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
470
   */
1067.2.9 by Padraig O'Sullivan
Removed the getSpecificColumn(), beginColumnInfo(), endColumnInfo() methods
471
  Columns column_info;
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
472
473
  /**
474
   * Contains the methods available on this I_S table.
475
   */
476
  InfoSchemaMethods *i_s_methods;
477
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
478
public:
1130.1.19 by Monty Taylor
Added error reporting to plugin registration.
479
  static bool addPlugin(plugin::InfoSchemaTable *schema_table);
1130.1.18 by Monty Taylor
Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
480
  static void removePlugin(plugin::InfoSchemaTable *table);
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
481
482
  static plugin::InfoSchemaTable *getTable(const char *table_name);
483
  static int addTableToList(Session *session, std::vector<LEX_STRING*> &files,
484
                            const char *wild);
1063.4.6 by Padraig O'Sullivan
Added a new header file which contains the InfoSchemaTable class and the
485
};
486
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
487
} /* namespace plugin */
488
} /* namespace drizzled */
1130.3.8 by Monty Taylor
Merged latest plugin-slot-reorg changes.
489
490
#endif /* DRIZZLED_PLUGIN_INFO_SCHEMA_TABLE_H */