~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_union.cc

  • Committer: lbieber at stabletransit
  • Date: 2010-10-19 14:03:27 UTC
  • mfrom: (1861.1.2 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101019140327-2jvt5j2wi4pzhm1z
Merge Brian - Small collection of cleanups/refactor'ing around locks
Merge Monty - fix a few things in the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
  tmp_table_param.field_count= column_types->elements;
126
126
 
127
127
  if (! (table= create_tmp_table(session_arg, &tmp_table_param, *column_types,
128
 
                                 (Order*) NULL, is_union_distinct, 1,
 
128
                                 (order_st*) NULL, is_union_distinct, 1,
129
129
                                 options, HA_POS_ERROR, (char*) table_alias)))
130
130
  {
131
131
    return true;
176
176
    fake_select_lex->context.first_name_resolution_table=
177
177
    fake_select_lex->get_table_list();
178
178
 
179
 
  for (Order *order= (Order *) global_parameters->order_list.first;
 
179
  for (order_st *order= (order_st *) global_parameters->order_list.first;
180
180
       order;
181
181
       order= order->next)
182
182
    order->item= &order->item_ptr;
183
183
 
184
 
  for (Order *order= (Order *)global_parameters->order_list.first;
 
184
  for (order_st *order= (order_st *)global_parameters->order_list.first;
185
185
       order;
186
186
       order=order->next)
187
187
  {
278
278
                                sl->order_list.elements) +
279
279
                               sl->group_list.elements,
280
280
                               can_skip_order_by ?
281
 
                               (Order*) NULL : (Order *)sl->order_list.first,
282
 
                               (Order*) sl->group_list.first,
 
281
                               (order_st*) NULL : (order_st *)sl->order_list.first,
 
282
                               (order_st*) sl->group_list.first,
283
283
                               sl->having,
284
284
                               sl, this);
285
285
    /* There are no * in the statement anymore (for PS) */
361
361
                                          create_options, ""))
362
362
      goto err;
363
363
    memset(&result_table_list, 0, sizeof(result_table_list));
364
 
    result_table_list.setSchemaName((char*) "");
 
364
    result_table_list.db= (char*) "";
365
365
    result_table_list.alias= "union";
366
 
    result_table_list.setTableName((char *) "union");
 
366
    result_table_list.table_name= (char *) "union";
367
367
    result_table_list.table= table= union_result->table;
368
368
 
369
369
    session_arg->lex->current_select= lex_select_save;
518
518
      {
519
519
        /*
520
520
          allocate JOIN for fake select only once (prevent
521
 
          select_query automatic allocation)
522
 
          TODO: The above is nonsense. select_query() will not allocate the
 
521
          mysql_select automatic allocation)
 
522
          TODO: The above is nonsense. mysql_select() will not allocate the
523
523
          join if one already exists. There must be some other reason why we
524
524
          don't let it allocate the join. Perhaps this is because we need
525
525
          some special parameter values passed to join constructor?
537
537
          allocation.
538
538
        */
539
539
        fake_select_lex->item_list= item_list;
540
 
        saved_error= select_query(session, &fake_select_lex->ref_pointer_array,
 
540
        saved_error= mysql_select(session, &fake_select_lex->ref_pointer_array,
541
541
                              &result_table_list,
542
542
                              0, item_list, NULL,
543
543
                              global_parameters->order_list.elements,
544
 
                              (Order*)global_parameters->order_list.first,
545
 
                              (Order*) NULL, NULL,
 
544
                              (order_st*)global_parameters->order_list.first,
 
545
                              (order_st*) NULL, NULL,
546
546
                              fake_select_lex->options | SELECT_NO_UNLOCK,
547
547
                              result, this, fake_select_lex);
548
548
      }
560
560
            to reset them back, we re-do all of the actions (yes it is ugly):
561
561
          */
562
562
                join->reset(session, item_list, fake_select_lex->options, result);
563
 
          saved_error= select_query(session, &fake_select_lex->ref_pointer_array,
 
563
          saved_error= mysql_select(session, &fake_select_lex->ref_pointer_array,
564
564
                                &result_table_list,
565
565
                                0, item_list, NULL,
566
566
                                global_parameters->order_list.elements,
567
 
                                (Order*)global_parameters->order_list.first,
568
 
                                (Order*) NULL, NULL,
 
567
                                (order_st*)global_parameters->order_list.first,
 
568
                                (order_st*) NULL, NULL,
569
569
                                fake_select_lex->options | SELECT_NO_UNLOCK,
570
570
                                result, this, fake_select_lex);
571
571
        }
625
625
    error|= fake_select_lex->cleanup();
626
626
    if (fake_select_lex->order_list.elements)
627
627
    {
628
 
      Order *ord;
629
 
      for (ord= (Order*)fake_select_lex->order_list.first; ord; ord= ord->next)
 
628
      order_st *ord;
 
629
      for (ord= (order_st*)fake_select_lex->order_list.first; ord; ord= ord->next)
630
630
        (*ord->item)->cleanup();
631
631
    }
632
632
  }