~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/plugins.cc

Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                                            DRIZZLE_TYPE_VARCHAR,
72
72
                                            0,
73
73
                                            0,
74
 
                                            "Name",
75
 
                                            SKIP_OPEN_TABLE));
 
74
                                            "Name"));
76
75
 
77
76
  columns->push_back(new plugin::ColumnInfo("PLUGIN_TYPE",
78
77
                                            NAME_CHAR_LEN,
79
78
                                            DRIZZLE_TYPE_VARCHAR,
80
79
                                            0,
81
80
                                            0,
82
 
                                            "",
83
 
                                            SKIP_OPEN_TABLE));
 
81
                                            ""));
84
82
 
85
83
  columns->push_back(new plugin::ColumnInfo("IS_ACTIVE",
86
84
                                            3,
87
85
                                            DRIZZLE_TYPE_VARCHAR,
88
86
                                            0,
89
87
                                            0,
90
 
                                            "",
91
 
                                            SKIP_OPEN_TABLE));
 
88
                                            ""));
92
89
 
93
90
  columns->push_back(new plugin::ColumnInfo("MODULE_NAME",
94
91
                                            NAME_CHAR_LEN,
95
92
                                            DRIZZLE_TYPE_VARCHAR,
96
93
                                            0,
97
94
                                            0,
98
 
                                            "Name",
99
 
                                            SKIP_OPEN_TABLE));
 
95
                                            "Name"));
100
96
  return columns;
101
97
}
102
98
 
141
137
{
142
138
  Session *session;
143
139
  Table *table;
 
140
  plugin::InfoSchemaTable *schema_table;
144
141
public:
145
 
  ShowPlugins(Session *session_arg, Table *table_arg)
146
 
    : session(session_arg), table(table_arg) {}
 
142
  ShowPlugins(Session *session_arg, Table *table_arg, plugin::InfoSchemaTable *sch_tab_arg)
 
143
    : session(session_arg), table(table_arg), schema_table(sch_tab_arg) {}
147
144
 
148
145
  result_type operator() (argument_type plugin)
149
146
  {
151
148
 
152
149
    table->restoreRecordAsDefault();
153
150
 
 
151
    /* mark fields that will be written to in the write bitset */
 
152
    table->setWriteSet(0);
 
153
    table->setWriteSet(1);
 
154
    table->setWriteSet(2);
 
155
    table->setWriteSet(3);
 
156
    table->setWriteSet(4);
 
157
    table->setWriteSet(5);
 
158
 
154
159
    table->field[0]->store(plugin.first.c_str(),
155
160
                           plugin.first.size(), cs);
156
161
 
169
174
    table->field[3]->store(plugin.second->getModuleName().c_str(),
170
175
                           plugin.second->getModuleName().size(), cs);
171
176
 
172
 
    return schema_table_store_record(session, table);
 
177
    schema_table->addRow(table->record[0], table->s->reclength);
 
178
    return false;
173
179
  }
174
180
};
175
181
 
176
 
int PluginsISMethods::fillTable(Session *session, TableList *tables)
 
182
int PluginsISMethods::fillTable(Session *session, 
 
183
                                Table *table,
 
184
                                plugin::InfoSchemaTable *schema_table)
177
185
{
178
 
  Table *table= tables->table;
179
 
 
180
186
  drizzled::plugin::Registry &registry= drizzled::plugin::Registry::singleton();
181
187
  const map<string, const drizzled::plugin::Plugin *> &plugin_map=
182
188
    registry.getPluginsMap();
183
189
  map<string, const drizzled::plugin::Plugin *>::const_iterator iter=
184
 
    find_if(plugin_map.begin(), plugin_map.end(), ShowPlugins(session, table));
 
190
    find_if(plugin_map.begin(), plugin_map.end(), ShowPlugins(session, table, schema_table));
185
191
  if (iter != plugin_map.end())
186
192
  {
187
193
    return 1;
188
194
  }
189
 
  return (0);
 
195
  return 0;
190
196
}