~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_derived.cc

  • Committer: Monty Taylor
  • Date: 2009-12-14 22:00:27 UTC
  • mto: (1241.9.10 out-of-tree)
  • mto: This revision was merged to the branch mainline in revision 1250.
  • Revision ID: mordred@inaugust.com-20091214220027-kpmfbl452nctzc0g
pandora-build v0.85 - Fixed C++ standard setting.

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
  Derived tables
18
18
  These were introduced by Sinisa <sinisa@mysql.com>
19
19
*/
20
 
#include "config.h"
 
20
#include "drizzled/server_includes.h"
21
21
#include "drizzled/sql_select.h"
22
22
 
23
 
namespace drizzled
24
 
{
25
 
 
26
23
/*
27
24
  Call given derived table processor (preparing or filling tables)
28
25
 
54
51
          Force join->join_tmp creation, because we will use this JOIN
55
52
          twice for EXPLAIN and we have to have unchanged join for EXPLAINing
56
53
        */
57
 
        sl->uncacheable.set(UNCACHEABLE_EXPLAIN);
58
 
        sl->master_unit()->uncacheable.set(UNCACHEABLE_EXPLAIN);
 
54
        sl->uncacheable|= UNCACHEABLE_EXPLAIN;
 
55
        sl->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN;
59
56
      }
60
57
    }
61
58
  }
123
120
    */
124
121
    if ((res= derived_result->create_result_table(session, &unit->types, false,
125
122
                                                  create_options,
126
 
                                                  orig_table_list->alias)))
 
123
                                                  orig_table_list->alias,
 
124
                                                  false)))
127
125
      goto exit;
128
126
 
129
127
    table= derived_result->table;
137
135
    if (res)
138
136
    {
139
137
      if (table)
140
 
      {
141
 
        table= 0;
142
 
      }
 
138
        table->free_tmp_table(session);
143
139
      delete derived_result;
144
140
    }
145
141
    else
146
142
    {
 
143
      if (! session->fill_derived_tables())
 
144
      {
 
145
        delete derived_result;
 
146
        derived_result= NULL;
 
147
      }
147
148
      orig_table_list->derived_result= derived_result;
148
149
      orig_table_list->table= table;
149
 
      orig_table_list->setTableName(const_cast<char *>(table->getShare()->getTableName()));
150
 
      orig_table_list->table_name_length= table->getShare()->getTableNameSize();
 
150
      orig_table_list->table_name=        table->s->table_name.str;
 
151
      orig_table_list->table_name_length= table->s->table_name.length;
151
152
      table->derived_select_number= first_select->select_number;
152
 
      orig_table_list->setSchemaName((char *)"");
 
153
      table->s->tmp_table= TEMP_TABLE;
 
154
      orig_table_list->db= (char *)"";
153
155
      orig_table_list->db_length= 0;
154
156
      /* Force read of table stats in the optimizer */
155
157
      table->cursor->info(HA_STATUS_VARIABLE);
156
158
      /* Add new temporary table to list of open derived tables */
157
 
      table->setNext(session->getDerivedTables());
158
 
      session->setDerivedTables(table);
 
159
      table->next= session->derived_tables;
 
160
      session->derived_tables= table;
159
161
    }
160
162
  }
161
163
 
214
216
                        first_select->item_list, first_select->where,
215
217
                        (first_select->order_list.elements+
216
218
                        first_select->group_list.elements),
217
 
                        (Order *) first_select->order_list.first,
218
 
                        (Order *) first_select->group_list.first,
 
219
                        (order_st *) first_select->order_list.first,
 
220
                        (order_st *) first_select->group_list.first,
219
221
                        first_select->having,
220
222
                        (first_select->options | session->options | SELECT_NO_UNLOCK),
221
223
                        derived_result, unit, first_select);
239
241
  }
240
242
  return res;
241
243
}
242
 
 
243
 
} /* namespace drizzled */