~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/locking/global.cc

  • Committer: Lee Bieber
  • Date: 2011-04-14 19:29:43 UTC
  • mfrom: (2278.1.2 build)
  • Revision ID: kalebral@gmail.com-20110414192943-q1nxcdqupal0anjb
Merge Olaf - Refactor Table Cache
Merge Olaf - Delete unused functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
622
622
int Session::lock_table_name(TableList *table_list)
623
623
{
624
624
  identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName());
625
 
  const identifier::Table::Key &key(identifier.getKey());
626
 
 
627
625
  {
628
626
    /* Only insert the table if we haven't insert it already */
629
 
    table::CacheRange ppp;
630
 
 
631
 
    ppp= table::getCache().equal_range(key);
632
 
 
633
 
    for (table::CacheMap::const_iterator iter= ppp.first;
634
 
         iter != ppp.second; ++iter)
 
627
    table::CacheRange ppp= table::getCache().equal_range(identifier.getKey());
 
628
    for (table::CacheMap::const_iterator iter= ppp.first; iter != ppp.second; ++iter)
635
629
    {
636
630
      Table *table= iter->second;
637
631
      if (table->reginfo.lock_type < TL_WRITE)
638
 
      {
639
632
        continue;
640
 
      }
641
 
 
642
633
      if (table->in_use == this)
643
634
      {
644
635
        table->getMutableShare()->resetVersion();                  // Ensure no one can use this
648
639
    }
649
640
  }
650
641
 
651
 
  table::Placeholder *table= NULL;
652
 
  if (!(table= table_cache_insert_placeholder(identifier)))
653
 
  {
654
 
    return -1;
655
 
  }
656
 
 
657
 
  table_list->table= reinterpret_cast<Table *>(table);
 
642
  table::Placeholder *table= &table_cache_insert_placeholder(identifier);
 
643
  table_list->table= reinterpret_cast<Table*>(table);
658
644
 
659
645
  /* Return 1 if table is in use */
660
 
  return(test(table::Cache::removeTable(*this, identifier, RTFC_NO_FLAG)));
 
646
  return (test(table::Cache::removeTable(*this, identifier, RTFC_NO_FLAG)));
661
647
}
662
648
 
663
649