~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Monty Taylor
  • Date: 2009-04-09 05:25:57 UTC
  • mto: (992.1.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 986.
  • Revision ID: mordred@inaugust.com-20090409052557-e0q784y7ydiaeuti
Removed last non-replicator (hi Jay) non show plugins plugin_foreach.
Next stop - ripping in to sql_plugin.cc!

Show diffs side-by-side

added added

removed removed

Lines of Context:
3657
3657
}
3658
3658
 
3659
3659
 
3660
 
struct schema_table_ref
 
3660
class FindSchemaTableByName : public unary_function<ST_SCHEMA_TABLE *, bool>
3661
3661
{
3662
3662
  const char *table_name;
3663
 
  ST_SCHEMA_TABLE *schema_table;
 
3663
public:
 
3664
  FindSchemaTableByName(const char *table_name_arg)
 
3665
    : table_name(table_name_arg) {}
 
3666
  result_type operator() (argument_type schema_table)
 
3667
  {
 
3668
    return !my_strcasecmp(system_charset_info,
 
3669
                          schema_table->table_name,
 
3670
                          table_name);
 
3671
  }
3664
3672
};
3665
3673
 
3666
3674
 
3668
3676
  Find schema_tables elment by name
3669
3677
 
3670
3678
  SYNOPSIS
3671
 
    find_schema_table_in_plugin()
3672
 
    session                 thread handler
3673
 
    plugin              plugin
3674
 
    table_name          table name
3675
 
 
3676
 
  RETURN
3677
 
    0   table not found
3678
 
    1   found the schema table
3679
 
*/
3680
 
static bool find_schema_table_in_plugin(Session *, st_plugin_int *plugin,
3681
 
                                        void* p_table)
3682
 
{
3683
 
  schema_table_ref *p_schema_table= (schema_table_ref *)p_table;
3684
 
  const char* table_name= p_schema_table->table_name;
3685
 
  ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
3686
 
 
3687
 
  if (!my_strcasecmp(system_charset_info,
3688
 
                     schema_table->table_name,
3689
 
                     table_name)) {
3690
 
    p_schema_table->schema_table= schema_table;
3691
 
    return(1);
3692
 
  }
3693
 
 
3694
 
  return(0);
3695
 
}
3696
 
 
3697
 
 
3698
 
/*
3699
 
  Find schema_tables elment by name
3700
 
 
3701
 
  SYNOPSIS
3702
3679
    find_schema_table()
3703
3680
    session                 thread handler
3704
3681
    table_name          table name
3708
3685
    #   pointer to 'schema_tables' element
3709
3686
*/
3710
3687
 
3711
 
ST_SCHEMA_TABLE *find_schema_table(Session *session, const char* table_name)
 
3688
ST_SCHEMA_TABLE *find_schema_table(Session *, const char* table_name)
3712
3689
{
3713
 
  schema_table_ref schema_table_a;
3714
3690
  ST_SCHEMA_TABLE *schema_table= schema_tables;
3715
3691
 
3716
3692
  for (; schema_table->table_name; schema_table++)
3721
3697
      return(schema_table);
3722
3698
  }
3723
3699
 
3724
 
  schema_table_a.table_name= table_name;
3725
 
  if (plugin_foreach(session, find_schema_table_in_plugin,
3726
 
                     DRIZZLE_INFORMATION_SCHEMA_PLUGIN, &schema_table_a))
3727
 
    return(schema_table_a.schema_table);
3728
 
 
 
3700
  vector<ST_SCHEMA_TABLE *>::iterator iter= 
 
3701
    find_if(all_schema_tables.begin(), all_schema_tables.end(),
 
3702
            FindSchemaTableByName(table_name));
 
3703
  if (iter != all_schema_tables.end())
 
3704
    return *iter;
3729
3705
  return(NULL);
3730
3706
}
3731
3707