~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.cc

  • Committer: Brian Aker
  • Date: 2010-07-28 00:15:41 UTC
  • Revision ID: brian@gaz-20100728001541-p6rs038hko6xqakn
This patch turns the table_cache into boost::unordered_multimap.
This also removes a number of cases where we were using strcmp() on table
name/schema name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
370
370
  if (sql_lock->lock_count)
371
371
    thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
372
372
  if (sql_lock->table_count)
373
 
    unlock_external(session,sql_lock->table,sql_lock->table_count);
 
373
    unlock_external(session, sql_lock->table, sql_lock->table_count);
374
374
  free((unsigned char*) sql_lock);
375
375
  return;
376
376
}
680
680
 
681
681
static int lock_table_name(Session *session, TableList *table_list, bool check_in_use)
682
682
{
683
 
  Table *table;
684
683
  bool  found_locked_table= false;
685
 
  HASH_SEARCH_STATE state;
686
684
  TableIdentifier identifier(table_list->db, table_list->table_name);
687
685
  const TableIdentifier::Key &key(identifier.getKey());
688
686
 
689
687
  if (check_in_use)
690
688
  {
691
689
    /* Only insert the table if we haven't insert it already */
692
 
    for (table=(Table*) hash_first(&get_open_cache(), (unsigned char*)&key[0],
693
 
                                   key.size(), &state);
694
 
         table ;
695
 
         table = (Table*) hash_next(&get_open_cache(),(unsigned char*)&key[0],
696
 
                                    key.size(), &state))
 
690
    TableOpenCacheRange ppp;
 
691
 
 
692
    ppp= get_open_cache().equal_range(key);
 
693
 
 
694
    for (TableOpenCache::const_iterator iter= ppp.first;
 
695
         iter != ppp.second; ++iter)
697
696
    {
 
697
      Table *table= (*iter).second;
698
698
      if (table->reginfo.lock_type < TL_WRITE)
699
699
      {
700
700
        if (table->in_use == session)
711
711
    }
712
712
  }
713
713
 
714
 
  if (!(table= session->table_cache_insert_placeholder(table_list->db, table_list->table_name, &key[0], key.size())))
 
714
  Table *table;
 
715
  if (!(table= session->table_cache_insert_placeholder(table_list->db, table_list->table_name)))
715
716
  {
716
717
    return -1;
717
718
  }
728
729
{
729
730
  if (table_list->table)
730
731
  {
731
 
    hash_delete(&get_open_cache(), (unsigned char*) table_list->table);
 
732
    remove_table(table_list->table);
732
733
    broadcast_refresh();
733
734
  }
734
735
}