~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

  • Committer: Brian Aker
  • Date: 2010-10-27 20:22:26 UTC
  • mto: This revision was merged to the branch mainline in revision 1886.
  • Revision ID: brian@tangent.org-20101027202226-72a4nwhfz5c6srgu
Update documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "drizzled/records.h"
31
31
#include "drizzled/internal/iocache.h"
32
32
#include "drizzled/transaction_services.h"
33
 
#include "drizzled/filesort.h"
34
33
 
35
34
namespace drizzled
36
35
{
57
56
  ha_rows       deleted= 0;
58
57
  uint32_t usable_index= MAX_KEY;
59
58
  Select_Lex   *select_lex= &session->lex->select_lex;
60
 
  Session::killed_state_t killed_status= Session::NOT_KILLED;
 
59
  Session::killed_state killed_status= Session::NOT_KILLED;
61
60
 
62
61
  if (session->openTablesLock(table_list))
63
62
  {
89
88
 
90
89
      if (select_lex->setup_ref_array(session, order->elements) ||
91
90
          setup_order(session, select_lex->ref_pointer_array, &tables,
92
 
                    fields, all_fields, (Order*) order->first))
 
91
                    fields, all_fields, (order_st*) order->first))
93
92
      {
94
93
        delete select;
95
94
        free_underlaid_joins(session, &session->lex->select_lex);
201
200
    ha_rows examined_rows;
202
201
 
203
202
    if ((!select || table->quick_keys.none()) && limit != HA_POS_ERROR)
204
 
      usable_index= optimizer::get_index_for_order(table, (Order*)(order->first), limit);
 
203
      usable_index= optimizer::get_index_for_order(table, (order_st*)(order->first), limit);
205
204
 
206
205
    if (usable_index == MAX_KEY)
207
206
    {
208
 
      FileSort filesort(*session);
209
207
      table->sort.io_cache= new internal::IO_CACHE;
210
208
 
211
209
 
212
 
      if (not (sortorder= make_unireg_sortorder((Order*) order->first, &length, NULL)) ||
213
 
          (table->sort.found_records = filesort.run(table, sortorder, length,
214
 
                                                    select, HA_POS_ERROR, 1,
215
 
                                                    examined_rows)) == HA_POS_ERROR)
 
210
      if (!(sortorder= make_unireg_sortorder((order_st*) order->first,
 
211
                                             &length, NULL)) ||
 
212
          (table->sort.found_records = filesort(session, table, sortorder, length,
 
213
                                                select, HA_POS_ERROR, 1,
 
214
                                                &examined_rows))
 
215
          == HA_POS_ERROR)
216
216
      {
217
217
        delete select;
218
218
        free_underlaid_joins(session, &session->lex->select_lex);
252
252
 
253
253
  table->mark_columns_needed_for_delete();
254
254
 
255
 
  while (!(error=info.read_record(&info)) && !session->getKilled() &&
 
255
  while (!(error=info.read_record(&info)) && !session->killed &&
256
256
         ! session->is_error())
257
257
  {
258
258
    // session->is_error() is tested to disallow delete row on error
285
285
    else
286
286
      table->cursor->unlock_row();  // Row failed selection, release lock on it
287
287
  }
288
 
  killed_status= session->getKilled();
 
288
  killed_status= session->killed;
289
289
  if (killed_status != Session::NOT_KILLED || session->is_error())
290
290
    error= 1;                                   // Aborted
291
291