~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema_methods.cc

  • Committer: Brian Aker
  • Date: 2009-07-27 01:28:26 UTC
  • mto: This revision was merged to the branch mainline in revision 1100.
  • Revision ID: brian@gaz-20090727012826-4gegcw5ujgt4g3qc
Small optimization to make table listing simpler

Show diffs side-by-side

added added

removed removed

Lines of Context:
303
303
  return (res);
304
304
}
305
305
 
 
306
inline bool open_list_store(Table *table, open_table_list_st& open_list);
 
307
inline bool open_list_store(Table *table, open_table_list_st& open_list)
 
308
{
 
309
  table->restoreRecordAsDefault();
 
310
  table->field[0]->store(open_list.db.c_str(), open_list.db.length(), system_charset_info);
 
311
  table->field[1]->store(open_list.table.c_str(), open_list.table.length(), system_charset_info);
 
312
  table->field[2]->store((int64_t) open_list.in_use, true);
 
313
  table->field[3]->store((int64_t) open_list.locked, true);
 
314
  if (schema_table_store_record(table->in_use, table))
 
315
    return true;
 
316
 
 
317
  return false;
 
318
}
 
319
 
306
320
int OpenTablesISMethods::fillTable(Session *session, TableList *tables, COND *)
307
321
{
308
322
  const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
309
 
  Table *table= tables->table;
310
 
  const CHARSET_INFO * const cs= system_charset_info;
311
 
  OPEN_TableList *open_list;
312
 
  if (! (open_list= list_open_tables(session->lex->select_lex.db, wild)) &&
313
 
      session->is_fatal_error)
314
 
  {
315
 
    return (1);
316
 
  }
317
 
 
318
 
  for (; open_list ; open_list=open_list->next)
319
 
  {
320
 
    table->restoreRecordAsDefault();
321
 
    table->field[0]->store(open_list->db, strlen(open_list->db), cs);
322
 
    table->field[1]->store(open_list->table, strlen(open_list->table), cs);
323
 
    table->field[2]->store((int64_t) open_list->in_use, true);
324
 
    table->field[3]->store((int64_t) open_list->locked, true);
325
 
    if (schema_table_store_record(session, table))
326
 
    {
327
 
      return (1);
328
 
    }
329
 
  }
330
 
  return (0);
 
323
 
 
324
  if ((list_open_tables(session->lex->select_lex.db, wild, open_list_store, tables->table) == true) && session->is_fatal_error)
 
325
    return 1;
 
326
 
 
327
  return 0;
331
328
}
332
329
 
333
330
class ShowPlugins : public unary_function<st_plugin_int *, bool>