~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/schemata.cc

  • Committer: Brian Aker
  • Date: 2009-11-30 19:13:19 UTC
  • mfrom: (1225.1.39 figure)
  • Revision ID: brian@gaz-20091130191319-zyt51fidacic3brf
Merge Padraig

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
                                            DRIZZLE_TYPE_VARCHAR,
73
73
                                            0, 
74
74
                                            1, 
75
 
                                            "", 
76
 
                                            SKIP_OPEN_TABLE));
 
75
                                            ""));
77
76
 
78
77
  columns->push_back(new plugin::ColumnInfo("SCHEMA_NAME",
79
78
                                            NAME_CHAR_LEN,
80
79
                                            DRIZZLE_TYPE_VARCHAR,
81
80
                                            0, 
82
81
                                            0, 
83
 
                                            "Database", 
84
 
                                            SKIP_OPEN_TABLE));
 
82
                                            "Database"));
85
83
 
86
84
  columns->push_back(new plugin::ColumnInfo("DEFAULT_CHARACTER_SET_NAME",
87
85
                                            64, 
88
86
                                            DRIZZLE_TYPE_VARCHAR, 
89
87
                                            0, 
90
88
                                            0, 
91
 
                                            "",
92
 
                                            SKIP_OPEN_TABLE));
 
89
                                            ""));
93
90
 
94
91
  columns->push_back(new plugin::ColumnInfo("DEFAULT_COLLATION_NAME",
95
92
                                            64, 
96
93
                                            DRIZZLE_TYPE_VARCHAR, 
97
94
                                            0, 
98
95
                                            0, 
99
 
                                            "",
100
 
                                            SKIP_OPEN_TABLE));
 
96
                                            ""));
101
97
 
102
98
  columns->push_back(new plugin::ColumnInfo("SQL_PATH",
103
99
                                            FN_REFLEN,
104
100
                                            DRIZZLE_TYPE_VARCHAR,
105
101
                                            0, 
106
102
                                            1, 
107
 
                                            "", 
108
 
                                            SKIP_OPEN_TABLE));
 
103
                                            ""));
109
104
 
110
105
  return columns;
111
106
}
146
141
  delete columns;
147
142
}
148
143
 
149
 
static bool store_schema_schemata(Session* session, 
 
144
static bool store_schema_schemata(Session *, 
150
145
                                  Table *table, 
151
146
                                  LEX_STRING *db_name,
152
 
                                  const CHARSET_INFO * const cs)
 
147
                                  const CHARSET_INFO * const cs,
 
148
                                  plugin::InfoSchemaTable *schema_table)
153
149
{
154
150
  table->restoreRecordAsDefault();
 
151
  table->setWriteSet(1);
 
152
  table->setWriteSet(2);
 
153
  table->setWriteSet(3);
155
154
  table->field[1]->store(db_name->str, db_name->length, system_charset_info);
156
155
  table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);
157
156
  table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
158
 
  return schema_table_store_record(session, table);
 
157
  schema_table->addRow(table->record[0], table->s->reclength);
 
158
  return false;
159
159
}
160
160
 
161
 
int SchemataISMethods::fillTable(Session *session, TableList *tables)
 
161
int SchemataISMethods::fillTable(Session *session, 
 
162
                                 Table *table,
 
163
                                 plugin::InfoSchemaTable *schema_table)
162
164
{
163
165
  /*
164
166
    TODO: fill_schema_shemata() is called when new client is connected.
168
170
  LOOKUP_FIELD_VALUES lookup_field_vals;
169
171
  vector<LEX_STRING*> db_names;
170
172
  bool with_i_schema;
171
 
  Table *table= tables->table;
172
173
  /* the WHERE condition */
173
174
  COND *cond= table->reginfo.join_tab->select_cond;
174
175
 
175
 
  if (get_lookup_field_values(session, cond, tables, &lookup_field_vals))
 
176
  if (get_lookup_field_values(session, 
 
177
                              cond, 
 
178
                              table->pos_in_table_list, 
 
179
                              &lookup_field_vals,
 
180
                              schema_table))
176
181
  {
177
182
    return 0;
178
183
  }
217
222
  {
218
223
    if (with_i_schema)       // information schema name is always first in list
219
224
    {
220
 
      if (store_schema_schemata(session, table, *db_name, system_charset_info))
 
225
      if (store_schema_schemata(session, table, *db_name, system_charset_info, schema_table))
221
226
      {
222
227
        return 1;
223
228
      }
227
232
    {
228
233
      const CHARSET_INFO *cs= get_default_db_collation((*db_name)->str);
229
234
 
230
 
      if (store_schema_schemata(session, table, *db_name, cs))
 
235
      if (store_schema_schemata(session, table, *db_name, cs, schema_table))
231
236
      {
232
237
        return 1;
233
238
      }