~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_union.cc

  • Committer: Monty Taylor
  • Date: 2010-04-22 02:46:23 UTC
  • mto: (1497.3.4 enable-dtrace)
  • mto: This revision was merged to the branch mainline in revision 1527.
  • Revision ID: mordred@inaugust.com-20100422024623-4urw8fi8eraci08p
Don't overwrite the pandora_vc_revinfo file if we don't have new
authoratative information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/*
17
17
  UNION  of select's
59
59
    unit->offset_limit_cnt--;
60
60
    return 0;
61
61
  }
62
 
  fill_record(session, table->getFields(), values, true);
 
62
  fill_record(session, table->field, values, true);
63
63
  if (session->is_error())
64
64
    return 1;
65
65
 
66
 
  if ((error= table->cursor->insertRecord(table->getInsertRecord())))
 
66
  if ((error= table->cursor->insertRecord(table->record[0])))
67
67
  {
68
68
    /* create_myisam_from_heap will generate error if needed */
69
69
    if (table->cursor->is_fatal_error(error, HA_CHECK_DUP))
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
 
  {
131
130
    return true;
132
 
  }
133
 
 
134
131
  table->cursor->extra(HA_EXTRA_WRITE_CACHE);
135
132
  table->cursor->extra(HA_EXTRA_IGNORE_DUP_KEY);
136
 
 
137
133
  return false;
138
134
}
139
135
 
176
172
    fake_select_lex->context.first_name_resolution_table=
177
173
    fake_select_lex->get_table_list();
178
174
 
179
 
  for (Order *order= (Order *) global_parameters->order_list.first;
 
175
  for (order_st *order= (order_st *) global_parameters->order_list.first;
180
176
       order;
181
177
       order= order->next)
182
178
    order->item= &order->item_ptr;
183
179
 
184
 
  for (Order *order= (Order *)global_parameters->order_list.first;
 
180
  for (order_st *order= (order_st *)global_parameters->order_list.first;
185
181
       order;
186
182
       order=order->next)
187
183
  {
253
249
  {
254
250
    bool can_skip_order_by;
255
251
    sl->options|=  SELECT_NO_UNLOCK;
256
 
    Join *join= new Join(session_arg, sl->item_list,
 
252
    JOIN *join= new JOIN(session_arg, sl->item_list,
257
253
                         sl->options | session_arg->options | additional_options,
258
254
                         tmp_result);
259
255
    /*
278
274
                                sl->order_list.elements) +
279
275
                               sl->group_list.elements,
280
276
                               can_skip_order_by ?
281
 
                               (Order*) NULL : (Order *)sl->order_list.first,
282
 
                               (Order*) sl->group_list.first,
 
277
                               (order_st*) NULL : (order_st *)sl->order_list.first,
 
278
                               (order_st*) sl->group_list.first,
283
279
                               sl->having,
284
280
                               sl, this);
285
281
    /* There are no * in the statement anymore (for PS) */
361
357
                                          create_options, ""))
362
358
      goto err;
363
359
    memset(&result_table_list, 0, sizeof(result_table_list));
364
 
    result_table_list.setSchemaName((char*) "");
 
360
    result_table_list.db= (char*) "";
365
361
    result_table_list.alias= "union";
366
 
    result_table_list.setTableName((char *) "union");
 
362
    result_table_list.table_name= (char *) "union";
367
363
    result_table_list.table= table= union_result->table;
368
364
 
369
365
    session_arg->lex->current_select= lex_select_save;
400
396
  uint64_t add_rows=0;
401
397
  ha_rows examined_rows= 0;
402
398
 
403
 
  if (executed && uncacheable.none() && ! describe)
404
 
    return false;
 
399
  if (executed && !uncacheable && !describe)
 
400
    return(false);
405
401
  executed= 1;
406
402
 
407
 
  if (uncacheable.any() || ! item || ! item->assigned() || describe)
 
403
  if (uncacheable || !item || !item->assigned() || describe)
408
404
  {
409
405
    if (item)
410
406
      item->reset_value_registration();
513
509
    {
514
510
      set_limit(global_parameters);
515
511
      init_prepare_fake_select_lex(session);
516
 
      Join *join= fake_select_lex->join;
 
512
      JOIN *join= fake_select_lex->join;
517
513
      if (!join)
518
514
      {
519
515
        /*
524
520
          don't let it allocate the join. Perhaps this is because we need
525
521
          some special parameter values passed to join constructor?
526
522
        */
527
 
        if (!(fake_select_lex->join= new Join(session, item_list,
 
523
        if (!(fake_select_lex->join= new JOIN(session, item_list,
528
524
                                              fake_select_lex->options, result)))
529
525
        {
530
526
          fake_select_lex->table_list.empty();
541
537
                              &result_table_list,
542
538
                              0, item_list, NULL,
543
539
                              global_parameters->order_list.elements,
544
 
                              (Order*)global_parameters->order_list.first,
545
 
                              (Order*) NULL, NULL,
 
540
                              (order_st*)global_parameters->order_list.first,
 
541
                              (order_st*) NULL, NULL,
546
542
                              fake_select_lex->options | SELECT_NO_UNLOCK,
547
543
                              result, this, fake_select_lex);
548
544
      }
564
560
                                &result_table_list,
565
561
                                0, item_list, NULL,
566
562
                                global_parameters->order_list.elements,
567
 
                                (Order*)global_parameters->order_list.first,
568
 
                                (Order*) NULL, NULL,
 
563
                                (order_st*)global_parameters->order_list.first,
 
564
                                (order_st*) NULL, NULL,
569
565
                                fake_select_lex->options | SELECT_NO_UNLOCK,
570
566
                                result, this, fake_select_lex);
571
567
        }
608
604
  {
609
605
    delete union_result;
610
606
    union_result=0; // Safety
 
607
    if (table)
 
608
      table->free_tmp_table(session);
611
609
    table= 0; // Safety
612
610
  }
613
611
 
616
614
 
617
615
  if (fake_select_lex)
618
616
  {
619
 
    Join *join;
 
617
    JOIN *join;
620
618
    if ((join= fake_select_lex->join))
621
619
    {
622
620
      join->tables_list= 0;
625
623
    error|= fake_select_lex->cleanup();
626
624
    if (fake_select_lex->order_list.elements)
627
625
    {
628
 
      Order *ord;
629
 
      for (ord= (Order*)fake_select_lex->order_list.first; ord; ord= ord->next)
 
626
      order_st *ord;
 
627
      for (ord= (order_st*)fake_select_lex->order_list.first; ord; ord= ord->next)
630
628
        (*ord->item)->cleanup();
631
629
    }
632
630
  }