~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-21 15:50:47 UTC
  • mto: This revision was merged to the branch mainline in revision 2346.
  • Revision ID: olafvdspek@gmail.com-20110621155047-76divazxyb5hzwmw
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1225
1225
      if (!group_list && ! exec_tmp_table1->distinct && order && simple_order)
1226
1226
      {
1227
1227
        session->set_proc_info("Sorting for order");
1228
 
        if (create_sort_index(session, this, order,
1229
 
                              HA_POS_ERROR, HA_POS_ERROR, true))
 
1228
        if (create_sort_index(session, this, order, HA_POS_ERROR, HA_POS_ERROR, true))
1230
1229
        {
1231
1230
          return 1;
1232
1231
        }
1266
1265
      If this join belongs to an uncacheable subquery save
1267
1266
      the original join
1268
1267
    */
1269
 
    if (select_lex->uncacheable.any() && 
1270
 
        ! is_top_level_join() &&
1271
 
        init_save_join_tab())
1272
 
    {
1273
 
      return -1;
1274
 
    }
 
1268
    if (select_lex->uncacheable.any() && not is_top_level_join())
 
1269
      init_save_join_tab();
1275
1270
  }
1276
1271
 
1277
1272
  error= 0;
1347
1342
   @retval 0      success.
1348
1343
   @retval 1      error occurred.
1349
1344
*/
1350
 
bool Join::init_save_join_tab()
 
1345
void Join::init_save_join_tab()
1351
1346
{
1352
1347
  tmp_join= (Join*)session->mem.allocate(sizeof(Join));
1353
1348
 
1354
1349
  error= 0;              // Ensure that tmp_join.error= 0
1355
1350
  restore_tmp();
1356
 
 
1357
 
  return 0; // return void
1358
1351
}
1359
1352
 
1360
 
bool Join::save_join_tab()
 
1353
void Join::save_join_tab()
1361
1354
{
1362
1355
  if (! join_tab_save && select_lex->master_unit()->uncacheable.any())
1363
1356
  {
1364
1357
    join_tab_save= (JoinTable*)session->mem.memdup(join_tab, sizeof(JoinTable) * tables);
1365
1358
  }
1366
 
  return 0; // return void
1367
1359
}
1368
1360
 
1369
1361
/**
1617
1609
      if (curr_join->group_list)
1618
1610
      {
1619
1611
        session->set_proc_info("Creating sort index");
1620
 
        if (curr_join->join_tab == join_tab && save_join_tab())
1621
 
        {
1622
 
          return;
1623
 
        }
1624
 
        if (create_sort_index(session, curr_join, curr_join->group_list,
1625
 
                  HA_POS_ERROR, HA_POS_ERROR, false) ||
 
1612
        if (curr_join->join_tab == join_tab)
 
1613
          save_join_tab();
 
1614
        if (create_sort_index(session, curr_join, curr_join->group_list, HA_POS_ERROR, HA_POS_ERROR, false) ||
1626
1615
            make_group_fields(this, curr_join))
1627
1616
        {
1628
1617
          return;
1805
1794
          }
1806
1795
        }
1807
1796
      }
1808
 
      if (curr_join->join_tab == join_tab && save_join_tab())
1809
 
        return;
 
1797
      if (curr_join->join_tab == join_tab)
 
1798
        save_join_tab();
1810
1799
      /*
1811
1800
        Here we sort rows for order_st BY/GROUP BY clause, if the optimiser
1812
1801
        chose FILESORT to be faster than INDEX SCAN or there is no