~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

  • Committer: Monty Taylor
  • Date: 2010-02-05 08:11:15 UTC
  • mfrom: (1283 build)
  • mto: (1273.13.43 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: mordred@inaugust.com-20100205081115-dr82nvrwv4lvw7sd
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "drizzled/optimizer/range.h"
30
30
#include "drizzled/records.h"
31
31
#include "drizzled/internal/iocache.h"
 
32
#include "drizzled/transaction_services.h"
32
33
 
33
 
using namespace drizzled;
 
34
namespace drizzled
 
35
{
34
36
 
35
37
/**
36
38
  Implement DELETE SQL word.
194
196
 
195
197
    if (usable_index == MAX_KEY)
196
198
    {
197
 
      table->sort.io_cache= new IO_CACHE;
198
 
      memset(table->sort.io_cache, 0, sizeof(IO_CACHE));
 
199
      table->sort.io_cache= new internal::IO_CACHE;
 
200
      memset(table->sort.io_cache, 0, sizeof(internal::IO_CACHE));
199
201
 
200
202
 
201
203
      if (!(sortorder= make_unireg_sortorder((order_st*) order->first,
382
384
bool mysql_truncate(Session& session, TableList *table_list)
383
385
{
384
386
  bool error;
 
387
  TransactionServices &transaction_services= TransactionServices::singleton();
385
388
 
386
389
  uint64_t save_options= session.options;
387
390
  table_list->lock_type= TL_WRITE;
388
391
  session.options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
389
 
  ha_enable_transaction(&session, false);
390
392
  mysql_init_select(session.lex);
391
393
  error= mysql_delete(&session, table_list, (COND*) 0, (SQL_LIST*) 0,
392
394
                      HA_POS_ERROR, 0L, true);
393
 
  ha_enable_transaction(&session, true);
394
395
  /*
395
396
    Safety, in case the engine ignored ha_enable_transaction(false)
396
397
    above. Also clears session->transaction.*.
397
398
  */
398
 
  error= ha_autocommit_or_rollback(&session, error);
399
 
  ha_commit(&session);
 
399
  error= transaction_services.ha_autocommit_or_rollback(&session, error);
400
400
  session.options= save_options;
401
401
 
402
402
  return error;
403
403
}
 
404
 
 
405
} /* namespace drizzled */