~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

  • Committer: Tim Penhey
  • Date: 2010-01-20 02:39:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1275.
  • Revision ID: tim.penhey@canonical.com-20100120023901-8teeunid6gwlthzx
Add in a rot 13 function.

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"
33
32
 
34
 
namespace drizzled
35
 
{
 
33
using namespace drizzled;
36
34
 
37
35
/**
38
36
  Implement DELETE SQL word.
196
194
 
197
195
    if (usable_index == MAX_KEY)
198
196
    {
199
 
      table->sort.io_cache= new internal::IO_CACHE;
200
 
      memset(table->sort.io_cache, 0, sizeof(internal::IO_CACHE));
 
197
      table->sort.io_cache= new IO_CACHE;
 
198
      memset(table->sort.io_cache, 0, sizeof(IO_CACHE));
201
199
 
202
200
 
203
201
      if (!(sortorder= make_unireg_sortorder((order_st*) order->first,
299
297
  transactional_table= table->cursor->has_transactions();
300
298
 
301
299
  if (!transactional_table && deleted > 0)
302
 
    session->transaction.stmt.markModifiedNonTransData();
 
300
    session->transaction.stmt.modified_non_trans_table= true;
303
301
 
304
302
  /* See similar binlogging code in sql_update.cc, for comments */
305
 
  if ((error < 0) || session->transaction.stmt.hasModifiedNonTransData())
 
303
  if ((error < 0) || session->transaction.stmt.modified_non_trans_table)
306
304
  {
307
 
    if (session->transaction.stmt.hasModifiedNonTransData())
308
 
      session->transaction.all.markModifiedNonTransData();
 
305
    if (session->transaction.stmt.modified_non_trans_table)
 
306
      session->transaction.all.modified_non_trans_table= true;
309
307
  }
310
 
  assert(transactional_table || !deleted || session->transaction.stmt.hasModifiedNonTransData());
 
308
  assert(transactional_table || !deleted || session->transaction.stmt.modified_non_trans_table);
311
309
  free_underlaid_joins(session, select_lex);
312
310
 
313
311
  DRIZZLE_DELETE_DONE((error >= 0 || session->is_error()), deleted);
384
382
bool mysql_truncate(Session& session, TableList *table_list)
385
383
{
386
384
  bool error;
387
 
  TransactionServices &transaction_services= TransactionServices::singleton();
388
385
 
389
386
  uint64_t save_options= session.options;
390
387
  table_list->lock_type= TL_WRITE;
391
388
  session.options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
 
389
  ha_enable_transaction(&session, false);
392
390
  mysql_init_select(session.lex);
393
391
  error= mysql_delete(&session, table_list, (COND*) 0, (SQL_LIST*) 0,
394
392
                      HA_POS_ERROR, 0L, true);
 
393
  ha_enable_transaction(&session, true);
395
394
  /*
396
395
    Safety, in case the engine ignored ha_enable_transaction(false)
397
396
    above. Also clears session->transaction.*.
398
397
  */
399
 
  error= transaction_services.ha_autocommit_or_rollback(&session, error);
 
398
  error= ha_autocommit_or_rollback(&session, error);
 
399
  ha_commit(&session);
400
400
  session.options= save_options;
401
401
 
402
402
  return error;
403
403
}
404
 
 
405
 
} /* namespace drizzled */