~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

  • Committer: Brian Aker
  • Date: 2008-08-19 15:11:04 UTC
  • mfrom: (327.2.6 drizzle-good)
  • Revision ID: brian@gir.tangent.org-20080819151104-uxk5lgoaj0fwgx9z
Merge of Brian's tree to main tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
  end of dispatch_command().
31
31
*/
32
32
 
33
 
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
 
33
bool mysql_delete(THD *thd, TableList *table_list, COND *conds,
34
34
                  SQL_LIST *order, ha_rows limit, uint64_t options,
35
35
                  bool reset_auto_increment)
36
36
{
65
65
  /* check ORDER BY even if it can be ignored */
66
66
  if (order && order->elements)
67
67
  {
68
 
    TABLE_LIST   tables;
 
68
    TableList   tables;
69
69
    List<Item>   fields;
70
70
    List<Item>   all_fields;
71
71
 
75
75
 
76
76
      if (select_lex->setup_ref_array(thd, order->elements) ||
77
77
          setup_order(thd, select_lex->ref_pointer_array, &tables,
78
 
                    fields, all_fields, (ORDER*) order->first))
 
78
                    fields, all_fields, (order_st*) order->first))
79
79
    {
80
80
      delete select;
81
81
      free_underlaid_joins(thd, &thd->lex->select_lex);
196
196
    ha_rows examined_rows;
197
197
    
198
198
    if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
199
 
      usable_index= get_index_for_order(table, (ORDER*)(order->first), limit);
 
199
      usable_index= get_index_for_order(table, (order_st*)(order->first), limit);
200
200
 
201
201
    if (usable_index == MAX_KEY)
202
202
    {
203
203
      table->sort.io_cache= (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
204
204
                                                   MYF(MY_FAE | MY_ZEROFILL));
205
205
    
206
 
      if (!(sortorder= make_unireg_sortorder((ORDER*) order->first,
 
206
      if (!(sortorder= make_unireg_sortorder((order_st*) order->first,
207
207
                                             &length, NULL)) ||
208
208
          (table->sort.found_records = filesort(thd, table, sortorder, length,
209
209
                                                select, HA_POS_ERROR, 1,
368
368
    false OK
369
369
    true  error
370
370
*/
371
 
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
 
371
int mysql_prepare_delete(THD *thd, TableList *table_list, Item **conds)
372
372
{
373
373
  SELECT_LEX *select_lex= &thd->lex->select_lex;
374
374
  
395
395
      setup_conds(thd, table_list, select_lex->leaf_tables, conds))
396
396
    return(true);
397
397
  {
398
 
    TABLE_LIST *duplicate;
 
398
    TableList *duplicate;
399
399
    if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
400
400
    {
401
401
      update_non_unique_table_error(table_list, "DELETE", duplicate);
438
438
int mysql_multi_delete_prepare(THD *thd)
439
439
{
440
440
  LEX *lex= thd->lex;
441
 
  TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first;
442
 
  TABLE_LIST *target_tbl;
 
441
  TableList *aux_tables= (TableList *)lex->auxiliary_table_list.first;
 
442
  TableList *target_tbl;
443
443
  
444
444
 
445
445
  /*
461
461
  */
462
462
  lex->select_lex.exclude_from_table_unique_test= true;
463
463
  /* Fix tables-to-be-deleted-from list to point at opened tables */
464
 
  for (target_tbl= (TABLE_LIST*) aux_tables;
 
464
  for (target_tbl= (TableList*) aux_tables;
465
465
       target_tbl;
466
466
       target_tbl= target_tbl->next_local)
467
467
  {
479
479
      inside subqueries/view.
480
480
    */
481
481
    {
482
 
      TABLE_LIST *duplicate;
 
482
      TableList *duplicate;
483
483
      if ((duplicate= unique_table(thd, target_tbl->correspondent_table,
484
484
                                   lex->query_tables, 0)))
485
485
      {
493
493
}
494
494
 
495
495
 
496
 
multi_delete::multi_delete(TABLE_LIST *dt, uint num_of_tables_arg)
 
496
multi_delete::multi_delete(TableList *dt, uint num_of_tables_arg)
497
497
  : delete_tables(dt), deleted(0), found(0),
498
498
    num_of_tables(num_of_tables_arg), error(0),
499
499
    do_delete(0), transactional_tables(0), normal_tables(0), error_handled(0)
517
517
bool
518
518
multi_delete::initialize_tables(JOIN *join)
519
519
{
520
 
  TABLE_LIST *walk;
 
520
  TableList *walk;
521
521
  Unique **tempfiles_ptr;
522
522
  
523
523
 
602
602
bool multi_delete::send_data(List<Item> &values __attribute__((unused)))
603
603
{
604
604
  int secure_counter= delete_while_scanning ? -1 : 0;
605
 
  TABLE_LIST *del_table;
 
605
  TableList *del_table;
606
606
  
607
607
 
608
608
  for (del_table= delete_tables;
842
842
  - If we want to have a name lock on the table on exit without errors.
843
843
*/
844
844
 
845
 
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
 
845
bool mysql_truncate(THD *thd, TableList *table_list, bool dont_send_ok)
846
846
{
847
847
  HA_CREATE_INFO create_info;
848
848
  char path[FN_REFLEN];