~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/explain_plan.cc

  • Committer: Monty Taylor
  • Date: 2010-04-15 19:14:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1476.
  • Revision ID: mordred@inaugust.com-20100415191453-ril2x8qdo78fny9w
Replaced test_authz with a plugin implementing a hard-coded simple
multi-tennancy policy. The policy describes:
- A root user exists which can do anything
- A user may only see a schema that is named the same has his user name
- A user may see data_dictionary and information_schema (data_dictionary
  required for show databases to work)

This way, we can more clearly test the results of the authorization
interface while providing an optional plugin that is actually useful to some
human.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "drizzled/session.h"
22
22
#include "drizzled/item/uint.h"
23
23
#include "drizzled/item/float.h"
24
 
#include "drizzled/item/string.h"
25
24
#include "drizzled/optimizer/explain_plan.h"
26
25
#include "drizzled/optimizer/position.h"
27
26
#include "drizzled/optimizer/quick_ror_intersect_select.h"
30
29
#include "drizzled/join.h"
31
30
#include "drizzled/internal/m_string.h"
32
31
 
33
 
#include <cstdio>
34
32
#include <string>
35
33
#include <sstream>
36
 
#include <bitset>
37
34
 
38
35
using namespace std;
39
36
 
236
233
      /* Build "possible_keys" value and add it to item_list */
237
234
      if (tab->keys.any())
238
235
      {
239
 
        for (uint32_t j= 0; j < table->getShare()->sizeKeys(); j++)
 
236
        for (uint32_t j= 0; j < table->s->keys; j++)
240
237
        {
241
238
          if (tab->keys.test(j))
242
239
          {
256
253
      /* Build "key", "key_len", and "ref" values and add them to item_list */
257
254
      if (tab->ref.key_parts)
258
255
      {
259
 
        KeyInfo *key_info= table->key_info+ tab->ref.key;
 
256
        KEY *key_info= table->key_info+ tab->ref.key;
260
257
        item_list.push_back(new Item_string(key_info->name,
261
258
                                            strlen(key_info->name),
262
259
                                            system_charset_info));
277
274
      }
278
275
      else if (tab->type == AM_NEXT)
279
276
      {
280
 
        KeyInfo *key_info=table->key_info+ tab->index;
 
277
        KEY *key_info=table->key_info+ tab->index;
281
278
        item_list.push_back(new Item_string(key_info->name,
282
279
              strlen(key_info->name),cs));
283
280
        uint32_t length= internal::int64_t2str(key_info->key_length, keylen_str_buf, 10) -
487
484
       sl= sl->next_select())
488
485
  {
489
486
    // drop UNCACHEABLE_EXPLAIN, because it is for internal usage only
490
 
    sl->uncacheable.reset(UNCACHEABLE_EXPLAIN);
 
487
    uint8_t uncacheable= (sl->uncacheable & ~UNCACHEABLE_EXPLAIN);
491
488
    if (&session->lex->select_lex == sl)
492
489
    {
493
490
      if (sl->first_inner_unit() || sl->next_select())
509
506
        }
510
507
        else
511
508
        {
512
 
          if (sl->uncacheable.test(UNCACHEABLE_DEPENDENT))
 
509
          if (uncacheable & UNCACHEABLE_DEPENDENT)
513
510
          {
514
511
            sl->type= optimizer::ST_DEPENDENT_SUBQUERY;
515
512
          }
516
513
          else
517
514
          {
518
 
            if (sl->uncacheable.any())
 
515
            if (uncacheable)
519
516
            {
520
517
              sl->type= optimizer::ST_UNCACHEABLE_SUBQUERY;
521
518
            }
528
525
      }
529
526
      else
530
527
      {
531
 
        if (sl->uncacheable.test(UNCACHEABLE_DEPENDENT))
 
528
        if (uncacheable & UNCACHEABLE_DEPENDENT)
532
529
        {
533
530
          sl->type= optimizer::ST_DEPENDENT_UNION;
534
531
        }
535
532
        else
536
533
        {
537
 
          if (sl->uncacheable.any())
 
534
          if (uncacheable)
538
535
          {
539
536
            sl->type= optimizer::ST_UNCACHEABLE_UNION;
540
537
          }
570
567
                      first->item_list,
571
568
                      first->where,
572
569
                      first->order_list.elements + first->group_list.elements,
573
 
                      (Order*) first->order_list.first,
574
 
                      (Order*) first->group_list.first,
 
570
                      (order_st*) first->order_list.first,
 
571
                      (order_st*) first->group_list.first,
575
572
                      first->having,
576
573
                      first->options | session->options | SELECT_DESCRIBE,
577
574
                      result,