~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Stewart Smith
  • Date: 2010-03-30 13:10:54 UTC
  • mfrom: (1283.28.32)
  • mto: (1283.38.1)
  • mto: This revision was merged to the branch mainline in revision 1536.
  • Revision ID: stewart@flamingspork.com-20100330131054-9l6wuqylf7eae9i0
Merged embedded-innodb-position-rnd-pos into embedded-innodb-autoincrement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
    memset(share, 0, sizeof(*share));
157
157
    share->set_table_cache_key(key_buff, old_share->table_cache_key.str,
158
158
                               old_share->table_cache_key.length);
159
 
    share->tmp_table= INTERNAL_TMP_TABLE;       // for intern_close_table()
 
159
    share->tmp_table= message::Table::INTERNAL;       // for intern_close_table()
160
160
  }
161
161
 
162
162
  table->cursor->close();
491
491
{
492
492
  for (; table; table= table->*link )
493
493
  {
494
 
    if ((table->table == 0 || table->table->s->tmp_table == STANDARD_TABLE) &&
 
494
    if ((table->table == 0 || table->table->s->tmp_table == message::Table::STANDARD) &&
495
495
        strcmp(table->db, db_name) == 0 &&
496
496
        strcmp(table->table_name, table_name) == 0)
497
497
      break;
555
555
  if (table->table)
556
556
  {
557
557
    /* temporary table is always unique */
558
 
    if (table->table && table->table->s->tmp_table != STANDARD_TABLE)
 
558
    if (table->table && table->table->s->tmp_table != message::Table::STANDARD)
559
559
      return 0;
560
560
    table= table->find_underlying_table(table->table);
561
561
    /*
586
586
}
587
587
 
588
588
 
589
 
void Session::doGetTableNames(CachedDirectory &,
590
 
                              const std::string& db_name,
 
589
void Session::doGetTableNames(const std::string& db_name,
591
590
                              std::set<std::string>& set_of_names)
592
591
{
593
592
  for (Table *table= temporary_tables ; table ; table= table->next)
599
598
  }
600
599
}
601
600
 
 
601
void Session::doGetTableNames(CachedDirectory &,
 
602
                              const std::string &db_name,
 
603
                              std::set<std::string> &set_of_names)
 
604
{
 
605
  doGetTableNames(db_name, set_of_names);
 
606
}
 
607
 
602
608
bool Session::doDoesTableExist(TableIdentifier &identifier)
603
609
{
604
610
  for (Table *table= temporary_tables ; table ; table= table->next)
605
611
  {
606
 
    if (table->s->tmp_table == TEMP_TABLE)
 
612
    if (table->s->tmp_table == message::Table::TEMPORARY)
607
613
    {
608
614
      if (not identifier.getSchemaName().compare(table->s->getSchemaName()))
609
615
      {
623
629
{
624
630
  for (Table *table= temporary_tables ; table ; table= table->next)
625
631
  {
626
 
    if (table->s->tmp_table == TEMP_TABLE)
 
632
    if (table->s->tmp_table == message::Table::TEMPORARY)
627
633
    {
628
634
      if (not identifier.getSchemaName().compare(table->s->getSchemaName()))
629
635
      {
999
1005
 
1000
1006
  table->s= share;
1001
1007
  share->set_table_cache_key(key_buff, key, key_length);
1002
 
  share->tmp_table= INTERNAL_TMP_TABLE;  // for intern_close_table
 
1008
  share->tmp_table= message::Table::INTERNAL;  // for intern_close_table
1003
1009
  table->in_use= this;
1004
1010
  table->locked_by_name=1;
1005
1011
 
1325
1331
 
1326
1332
    if (table_list->create)
1327
1333
    {
1328
 
      TableIdentifier  lock_table_identifier(table_list->db, table_list->table_name, STANDARD_TABLE);
 
1334
      TableIdentifier  lock_table_identifier(table_list->db, table_list->table_name, message::Table::STANDARD);
1329
1335
 
1330
1336
      if (not plugin::StorageEngine::doesTableExist(*this, lock_table_identifier))
1331
1337
      {
1379
1385
  table->reginfo.lock_type= TL_READ; /* Assume read */
1380
1386
 
1381
1387
reset:
1382
 
  assert(table->s->ref_count > 0 || table->s->tmp_table != STANDARD_TABLE);
 
1388
  assert(table->s->ref_count > 0 || table->s->tmp_table != message::Table::STANDARD);
1383
1389
 
1384
1390
  if (lex->need_correct_ident())
1385
1391
    table->alias_name_used= my_strcasecmp(table_alias_charset,
1520
1526
  the strings are used in a loop even after the share may be freed.
1521
1527
*/
1522
1528
 
 
1529
void Session::close_data_files_and_morph_locks(TableIdentifier &identifier)
 
1530
{
 
1531
  close_data_files_and_morph_locks(identifier.getSchemaName().c_str(), identifier.getTableName().c_str());
 
1532
}
 
1533
 
1523
1534
void Session::close_data_files_and_morph_locks(const char *new_db, const char *new_table_name)
1524
1535
{
1525
1536
  Table *table;
2124
2135
    {
2125
2136
      if (tables->lock_type == TL_WRITE_DEFAULT)
2126
2137
        tables->table->reginfo.lock_type= update_lock_default;
2127
 
      else if (tables->table->s->tmp_table == STANDARD_TABLE)
 
2138
      else if (tables->table->s->tmp_table == message::Table::STANDARD)
2128
2139
        tables->table->reginfo.lock_type= tables->lock_type;
2129
2140
    }
2130
2141
  }
2322
2333
  }
2323
2334
 
2324
2335
  new_tmp_table->reginfo.lock_type= TL_WRITE;    // Simulate locked
2325
 
  share->tmp_table= TEMP_TABLE;
 
2336
  share->tmp_table= message::Table::TEMPORARY;
2326
2337
 
2327
2338
  if (link_in_list)
2328
2339
  {