List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:July 16 2007 11:38am
Subject:Re: Best way to determine table name in INFORMATION_SCHEMA's fill_table()?
View as plain text  
Hi!

On Jul 13, Vasil Dimov wrote:
> Hi,
> 
> Some background:
> The init() function of an INFORMATION_SCHEMA plugin sets the
> ::fill_table member which is a function that takes
> THD*, TABLE_LIST*, COND* arguments.
> 
> My question is:
> 
> What is the best way to determine the name of the table from this
> function?
> 
> (I intend to use one function for several plugins, in the case of one
> plugin this question does not make sense because the table being filled
> is known in advance).
> 
> I can see that (assuming the TABLE_LIST* argument name "table") the
> name of the table being filled is set in these fields:
> table->alias
> table->schema_table_name
> table->schema_table->table_name
> 
> Does it matter which one am I going to use? Is it possible that in
> some circumstances some of these is not set or is set to something
> else than the plain table name?

<disclaimer>I didn't look in the debugger, below is an educated
guess</disclaimer>

I'd use table->schema_table_name. table->schema_table->table_name seems
to be the same though. table->alias looks problematic, try for example

  SELECT * FROM INFORMATION_SCHEMA.ENGINES as t1;

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Radlkoferstr. 2, D-81373 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
Best way to determine table name in INFORMATION_SCHEMA'sfill_table()?Vasil Dimov13 Jul
  • Re: Best way to determine table name in INFORMATION_SCHEMA's fill_table()?Sergei Golubchik16 Jul
    • Re: Best way to determine table name in INFORMATION_SCHEMA'sfill_table()?Vasil Dimov16 Jul