~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to plugin/show_dictionary/show_table_status.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-04-17 01:38:47 UTC
  • mfrom: (1237.9.238 bad-staging)
  • Revision ID: osullivan.padraig@gmail.com-20100417013847-ibjioqsfbmf5yg4g
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "config.h"
22
22
 
23
 
#include "plugin/schema_dictionary/dictionary.h"
 
23
#include "plugin/show_dictionary/dictionary.h"
24
24
#include "drizzled/pthread_globals.h"
25
25
#include "drizzled/my_hash.h"
26
26
 
46
46
  drizzled::plugin::TableFunction::Generator(arg),
47
47
  is_primed(false)
48
48
{
49
 
  Session *session= current_session;
50
 
  statement::Select *select= static_cast<statement::Select *>(session->lex->statement);
 
49
  statement::Select *select= static_cast<statement::Select *>(getSession().lex->statement);
51
50
 
52
51
  schema_predicate.append(select->getShowSchema());
53
52
 
54
 
  pthread_mutex_lock(&LOCK_open); /* Optionally lock for remove tables from open_cahe if not in use */
55
 
 
56
 
  drizzled::HASH *open_cache=
57
 
    get_open_cache();
58
 
 
59
 
  for (uint32_t idx= 0; idx < open_cache->records; idx++ )
 
53
  if (schema_predicate.empty())
60
54
  {
61
 
    table= (Table*) hash_element(open_cache, idx);
62
 
    table_list.push_back(table);
 
55
    schema_predicate.append(getSession().db);
63
56
  }
64
57
 
65
 
  for (table= session->temporary_tables; table; table= table->next)
 
58
  if (not schema_predicate.empty())
66
59
  {
67
 
    if (table->getShare())
 
60
    pthread_mutex_lock(&LOCK_open); /* Optionally lock for remove tables from open_cahe if not in use */
 
61
 
 
62
    drizzled::HASH *open_cache=
 
63
      get_open_cache();
 
64
 
 
65
    for (uint32_t idx= 0; idx < open_cache->records; idx++ )
68
66
    {
 
67
      table= (Table*) hash_element(open_cache, idx);
69
68
      table_list.push_back(table);
70
69
    }
 
70
 
 
71
    for (table= getSession().temporary_tables; table; table= table->next)
 
72
    {
 
73
      if (table->getShare())
 
74
      {
 
75
        table_list.push_back(table);
 
76
      }
 
77
    }
 
78
    std::sort(table_list.begin(), table_list.end(), Table::compare);
71
79
  }
72
 
  std::sort(table_list.begin(), table_list.end(), Table::compare);
73
80
}
74
81
 
75
82
ShowTableStatus::Generator::~Generator()