~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/table_cache_dictionary/table_cache.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
table_cache_dictionary::TableCache::TableCache() :
31
31
  plugin::TableFunction("DATA_DICTIONARY", "TABLE_CACHE")
32
32
{
33
 
  add_field("SESSION_ID", plugin::TableFunction::NUMBER);
 
33
  add_field("SESSION_ID", plugin::TableFunction::NUMBER, 0, false);
34
34
  add_field("TABLE_SCHEMA");
35
35
  add_field("TABLE_NAME");
36
 
  add_field("VERSION", plugin::TableFunction::NUMBER);
37
 
  add_field("IS_NAME_LOCKED", plugin::TableFunction::BOOLEAN);
38
 
  add_field("ROWS", plugin::TableFunction::NUMBER);
39
 
  add_field("AVG_ROW_LENGTH", plugin::TableFunction::NUMBER);
40
 
  add_field("TABLE_SIZE", plugin::TableFunction::NUMBER);
41
 
  add_field("AUTO_INCREMENT", plugin::TableFunction::NUMBER);
 
36
  add_field("VERSION", plugin::TableFunction::NUMBER, 0, false);
 
37
  add_field("IS_NAME_LOCKED", plugin::TableFunction::BOOLEAN, 0, false);
 
38
  add_field("ROWS", plugin::TableFunction::NUMBER, 0, false);
 
39
  add_field("AVG_ROW_LENGTH", plugin::TableFunction::NUMBER, 0, false);
 
40
  add_field("TABLE_SIZE", plugin::TableFunction::NUMBER, 0, false);
 
41
  add_field("AUTO_INCREMENT", plugin::TableFunction::NUMBER, 0, false);
42
42
}
43
43
 
44
44
table_cache_dictionary::TableCache::Generator::Generator(drizzled::Field **arg) :
45
45
  drizzled::plugin::TableFunction::Generator(arg),
46
46
  is_primed(false)
47
47
{
48
 
  pthread_mutex_lock(&LOCK_open); /* Optionally lock for remove tables from open_cahe if not in use */
49
 
 
50
 
  drizzled::HASH *open_cache=
51
 
    get_open_cache();
52
 
 
53
 
  for (uint32_t idx= 0; idx < open_cache->records; idx++ )
54
 
  {
55
 
    table= (Table*) hash_element(open_cache, idx);
56
 
    table_list.push_back(table);
 
48
  LOCK_open.lock(); /* Optionally lock for remove tables from open_cahe if not in use */
 
49
 
 
50
  for (TableOpenCache::const_iterator iter= get_open_cache().begin();
 
51
       iter != get_open_cache().end();
 
52
       iter++)
 
53
   {
 
54
    table_list.push_back((*iter).second);
57
55
  }
58
56
  std::sort(table_list.begin(), table_list.end(), Table::compare);
59
57
}
60
58
 
61
59
table_cache_dictionary::TableCache::Generator::~Generator()
62
60
{
63
 
  pthread_mutex_unlock(&LOCK_open); /* Optionally lock for remove tables from open_cahe if not in use */
 
61
  LOCK_open.unlock(); /* Optionally lock for remove tables from open_cahe if not in use */
64
62
}
65
63
 
66
64
bool table_cache_dictionary::TableCache::Generator::nextCore()
127
125
  push(table->getShare()->getTableName(arg));
128
126
 
129
127
  /* VERSION 4 */
130
 
  push(static_cast<int64_t>(table->getShare()->version));
 
128
  push(static_cast<int64_t>(table->getShare()->getVersion()));
131
129
 
132
130
  /* IS_NAME_LOCKED 5 */
133
131
  push(table->getShare()->isNameLock());