~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.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:
789
789
  case of failure.
790
790
*/
791
791
 
792
 
table::Placeholder *Session::table_cache_insert_placeholder(const drizzled::identifier::Table &arg)
 
792
table::Placeholder& Session::table_cache_insert_placeholder(const drizzled::identifier::Table &arg)
793
793
{
794
794
  safe_mutex_assert_owner(table::Cache::mutex().native_handle());
795
795
 
797
797
    Create a table entry with the right key and with an old refresh version
798
798
  */
799
799
  identifier::Table identifier(arg.getSchemaName(), arg.getTableName(), message::Table::INTERNAL);
800
 
  table::Placeholder *table= new table::Placeholder(this, identifier);
 
800
  table::Placeholder* table= new table::Placeholder(this, identifier);
801
801
  table::Cache::insert(table);
802
 
  return table; // return ref
 
802
  return *table;
803
803
}
804
804
 
805
805
 
836
836
    return false;
837
837
  }
838
838
 
839
 
  if (not (*table= table_cache_insert_placeholder(identifier)))
840
 
  {
841
 
    return true;
842
 
  }
 
839
  *table= &table_cache_insert_placeholder(identifier);
843
840
  (*table)->open_placeholder= true;
844
841
  (*table)->setNext(open_tables.open_tables_);
845
842
  open_tables.open_tables_= *table;
846
843
 
847
 
  return false;
 
844
  return false; //return void
848
845
}
849
846
 
850
847
/*
1090
1087
      else
1091
1088
      {
1092
1089
        /* Insert a new Table instance into the open cache */
1093
 
        int error;
1094
1090
        /* Free cache if too big */
1095
1091
        table::getUnused().cull();
1096
1092
 
1103
1099
            /*
1104
1100
              Table to be created, so we need to create placeholder in table-cache.
1105
1101
            */
1106
 
            if (!(table= table_cache_insert_placeholder(lock_table_identifier)))
1107
 
            {
1108
 
              return NULL;
1109
 
            }
 
1102
            table= &table_cache_insert_placeholder(lock_table_identifier);
1110
1103
            /*
1111
1104
              Link placeholder to the open tables list so it will be automatically
1112
1105
              removed once tables are closed. Also mark it so it won't be ignored
1125
1118
        {
1126
1119
          table::Concurrent *new_table= new table::Concurrent;
1127
1120
          table= new_table;
1128
 
          error= new_table->open_unireg_entry(this, alias, identifier);
1129
 
          if (error != 0)
 
1121
          if (new_table->open_unireg_entry(this, alias, identifier))
1130
1122
          {
1131
1123
            delete new_table;
1132
1124
            return NULL;