~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
  uint32_t usable_index= MAX_KEY;
50
50
  SELECT_LEX   *select_lex= &session->lex->select_lex;
51
51
  Session::killed_state killed_status= Session::NOT_KILLED;
52
 
  
 
52
 
53
53
 
54
54
  if (open_and_lock_tables(session, table_list))
55
55
    return(true);
194
194
    uint32_t         length= 0;
195
195
    SORT_FIELD  *sortorder;
196
196
    ha_rows examined_rows;
197
 
    
 
197
 
198
198
    if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
199
199
      usable_index= get_index_for_order(table, (order_st*)(order->first), limit);
200
200
 
202
202
    {
203
203
      table->sort.io_cache= (IO_CACHE *) malloc(sizeof(IO_CACHE));
204
204
      memset(table->sort.io_cache, 0, sizeof(IO_CACHE));
205
 
                                         
206
 
    
 
205
 
 
206
 
207
207
      if (!(sortorder= make_unireg_sortorder((order_st*) order->first,
208
208
                                             &length, NULL)) ||
209
209
          (table->sort.found_records = filesort(session, table, sortorder, length,
313
313
 
314
314
  if (!transactional_table && deleted > 0)
315
315
    session->transaction.stmt.modified_non_trans_table= true;
316
 
  
 
316
 
317
317
  /* See similar binlogging code in sql_update.cc, for comments */
318
318
  if ((error < 0) || session->transaction.stmt.modified_non_trans_table)
319
319
  {
372
372
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds)
373
373
{
374
374
  SELECT_LEX *select_lex= &session->lex->select_lex;
375
 
  
 
375
 
376
376
  List<Item> all_fields;
377
377
 
378
378
  session->lex->allow_sum_func= 0;
379
379
  if (setup_tables_and_check_access(session, &session->lex->select_lex.context,
380
380
                                    &session->lex->select_lex.top_join_list,
381
 
                                    table_list, 
 
381
                                    table_list,
382
382
                                    &select_lex->leaf_tables, false) ||
383
383
      setup_conds(session, table_list, select_lex->leaf_tables, conds))
384
384
    return(true);
400
400
 
401
401
 
402
402
/***************************************************************************
403
 
  Delete multiple tables from join 
 
403
  Delete multiple tables from join
404
404
***************************************************************************/
405
405
 
406
406
#define MEM_STRIP_BUF_SIZE current_session->variables.sortbuff_size
428
428
  LEX *lex= session->lex;
429
429
  TableList *aux_tables= (TableList *)lex->auxiliary_table_list.first;
430
430
  TableList *target_tbl;
431
 
  
 
431
 
432
432
 
433
433
  /*
434
434
    setup_tables() need for VIEWs. JOIN::prepare() will not do it second
493
493
int
494
494
multi_delete::prepare(List<Item> &, SELECT_LEX_UNIT *u)
495
495
{
496
 
  
 
496
 
497
497
  unit= u;
498
498
  do_delete= 1;
499
499
  session->set_proc_info("deleting from main table");
506
506
{
507
507
  TableList *walk;
508
508
  Unique **tempfiles_ptr;
509
 
  
 
509
 
510
510
 
511
511
  if ((session->options & OPTION_SAFE_UPDATES) && error_if_full_join(join))
512
512
    return(1);
638
638
 
639
639
void multi_delete::send_error(uint32_t errcode,const char *err)
640
640
{
641
 
  
 
641
 
642
642
 
643
643
  /* First send error what ever it is ... */
644
644
  my_message(errcode, err, MYF(0));
649
649
 
650
650
void multi_delete::abort()
651
651
{
652
 
  
 
652
 
653
653
 
654
654
  /* the error was handled or nothing deleted and no side effects return */
655
655
  if (error_handled ||
675
675
    assert(error_handled);
676
676
    return;
677
677
  }
678
 
  
 
678
 
679
679
  if (session->transaction.stmt.modified_non_trans_table)
680
680
  {
681
 
    /* 
 
681
    /*
682
682
       there is only side effects; to binlog with the error
683
683
    */
684
684
    if (drizzle_bin_log.is_open())
705
705
{
706
706
  int local_error= 0, counter= 0, tmp_error;
707
707
  bool will_batch;
708
 
  
 
708
 
709
709
  assert(do_delete);
710
710
 
711
711
  do_delete= 0;                                 // Mark called
714
714
 
715
715
  table_being_deleted= (delete_while_scanning ? delete_tables->next_local :
716
716
                        delete_tables);
717
 
 
 
717
 
718
718
  for (; table_being_deleted;
719
719
       table_being_deleted= table_being_deleted->next_local, counter++)
720
 
  { 
 
720
  {
721
721
    ha_rows last_deleted= deleted;
722
722
    Table *table = table_being_deleted->table;
723
723
    if (tempfiles[counter]->get(table))
836
836
  Table *table;
837
837
  bool error;
838
838
  uint32_t path_length;
839
 
  
 
839
 
840
840
 
841
841
  memset(&create_info, 0, sizeof(create_info));
842
842
  /* If it is a temporary table, close and regenerate it */
849
849
      goto trunc_by_del;
850
850
 
851
851
    table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
852
 
    
 
852
 
853
853
    close_temporary_table(session, table, 0, 0);    // Don't free share
854
854
    ha_create_table(session, share->normalized_path.str,
855
855
                    share->db.str, share->table_name.str, &create_info, 1);