~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Mark Atwood
  • Date: 2011-06-24 11:45:17 UTC
  • mfrom: (2318.6.64 rf)
  • Revision ID: me@mark.atwood.name-20110624114517-1mq8no6jlp2nrg7m
mergeĀ lp:~olafvdspek/drizzle/refactor15

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
        {
198
198
          if (message) // If we have no definition, we don't know if the table should have been replicated
199
199
          {
200
 
            TransactionServices &transaction_services= TransactionServices::singleton();
201
 
            transaction_services.dropTable(*session, identifier, *message, if_exists);
 
200
            TransactionServices::dropTable(*session, identifier, *message, if_exists);
202
201
          }
203
202
        }
204
203
        else
896
895
 
897
896
  (*key_info_buffer)= key_info= (KeyInfo*) memory::sql_calloc(sizeof(KeyInfo) * (*key_count));
898
897
  key_part_info=(KeyPartInfo*) memory::sql_calloc(sizeof(KeyPartInfo)*key_parts);
899
 
  if (!*key_info_buffer || ! key_part_info)
900
 
    return true;                                // Out of memory
901
898
 
902
899
  key_iterator= alter_info->key_list.begin();
903
900
  key_number=0;
1370
1367
 
1371
1368
  if (table_proto.type() == message::Table::STANDARD && not internal_tmp_table)
1372
1369
  {
1373
 
    TransactionServices &transaction_services= TransactionServices::singleton();
1374
 
    transaction_services.createTable(*session, table_proto);
 
1370
    TransactionServices::createTable(*session, table_proto);
1375
1371
  }
1376
1372
 
1377
1373
  return false;
1706
1702
          (admin operation or network communication failed)
1707
1703
*/
1708
1704
static bool admin_table(Session* session, TableList* tables,
1709
 
                              HA_CHECK_OPT* check_opt,
1710
1705
                              const char *operator_name,
1711
1706
                              thr_lock_type lock_type,
1712
1707
                              bool open_for_modify,
1713
 
                              int (Cursor::*operator_func)(Session *,
1714
 
                                                            HA_CHECK_OPT *))
 
1708
                              int (Cursor::*operator_func)(Session*))
1715
1709
{
1716
1710
  TableList *table;
1717
1711
  Select_Lex *select= &session->lex().select_lex;
1718
1712
  List<Item> field_list;
1719
1713
  Item *item;
1720
1714
  int result_code= 0;
1721
 
  TransactionServices &transaction_services= TransactionServices::singleton();
1722
1715
  const charset_info_st * const cs= system_charset_info;
1723
1716
 
1724
1717
  if (! session->endActiveTransaction())
1793
1786
      length= snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
1794
1787
                       table_name.c_str());
1795
1788
      session->getClient()->store(buff, length);
1796
 
      transaction_services.autocommitOrRollback(*session, false);
 
1789
      TransactionServices::autocommitOrRollback(*session, false);
1797
1790
      session->endTransaction(COMMIT);
1798
1791
      session->close_thread_tables();
1799
1792
      session->lex().reset_query_tables_list(false);
1818
1811
      open_for_modify= 0;
1819
1812
    }
1820
1813
 
1821
 
    result_code = (table->table->cursor->*operator_func)(session, check_opt);
 
1814
    result_code = (table->table->cursor->*operator_func)(session);
1822
1815
 
1823
1816
send_result:
1824
1817
 
1917
1910
        }
1918
1911
      }
1919
1912
    }
1920
 
    transaction_services.autocommitOrRollback(*session, false);
 
1913
    TransactionServices::autocommitOrRollback(*session, false);
1921
1914
    session->endTransaction(COMMIT);
1922
1915
    session->close_thread_tables();
1923
1916
    table->table=0;                             // For query cache
1929
1922
  return false;
1930
1923
 
1931
1924
err:
1932
 
  transaction_services.autocommitOrRollback(*session, true);
 
1925
  TransactionServices::autocommitOrRollback(*session, true);
1933
1926
  session->endTransaction(ROLLBACK);
1934
1927
  session->close_thread_tables();                       // Shouldn't be needed
1935
1928
  if (table)
2020
2013
 
2021
2014
  if (success && not destination_identifier.isTmp())
2022
2015
  {
2023
 
    TransactionServices &transaction_services= TransactionServices::singleton();
2024
 
    transaction_services.createTable(session, new_table_message);
 
2016
    TransactionServices::createTable(session, new_table_message);
2025
2017
  }
2026
2018
 
2027
2019
  return success;
2146
2138
}
2147
2139
 
2148
2140
 
2149
 
bool analyze_table(Session* session, TableList* tables, HA_CHECK_OPT* check_opt)
 
2141
bool analyze_table(Session* session, TableList* tables)
2150
2142
{
2151
2143
  thr_lock_type lock_type = TL_READ_NO_INSERT;
2152
2144
 
2153
 
  return(admin_table(session, tables, check_opt,
2154
 
                                "analyze", lock_type, true,
2155
 
                                &Cursor::ha_analyze));
 
2145
  return(admin_table(session, tables, "analyze", lock_type, true, &Cursor::ha_analyze));
2156
2146
}
2157
2147
 
2158
2148
 
2159
 
bool check_table(Session* session, TableList* tables,HA_CHECK_OPT* check_opt)
 
2149
bool check_table(Session* session, TableList* tables)
2160
2150
{
2161
2151
  thr_lock_type lock_type = TL_READ_NO_INSERT;
2162
 
 
2163
 
  return(admin_table(session, tables, check_opt,
2164
 
                                "check", lock_type,
2165
 
                                false,
2166
 
                                &Cursor::ha_check));
 
2152
  return admin_table(session, tables, "check", lock_type, false, &Cursor::ha_check);
2167
2153
}
2168
2154
 
2169
2155
} /* namespace drizzled */