~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_table.h

  • Committer: Prafulla Tekawade
  • Date: 2010-07-13 16:07:35 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100713160735-2fsdtrm3azayuyu1
This bug is simillar to mysql bug 36133
http://bugs.mysql.com/bug.php?id=36133

Taking changes from that fix.

  - The problem was that the range optimizer evaluated constant expressions, 
    and among them it would try to evaluate IN-subquery predicates slated for
    handling with materialization strategy. However, these predicates require
    that parent_join->setup_subquery_materialization() is invoked before one
    attempts to evaluate them.
  
  - Fixed by making the range optimizer not to evaluate expressions that have
    item->is_expensive() == TRUE (these are materialization subqueries and 
    stored function calls). This should also resolve the problem that EXPLAIN 
    may be too long. 
    This change cuts off some opportunities for range optimizer, but this is 
    the price we're willing to pay for separation of query optimization and
    execution. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
#ifndef DRIZZLED_STATEMENT_CREATE_TABLE_H
22
22
#define DRIZZLED_STATEMENT_CREATE_TABLE_H
23
23
 
24
 
#include <drizzled/statement.h>
25
 
#include <drizzled/foreign_key.h>
 
24
#include "drizzled/statement.h"
 
25
#include "drizzled/foreign_key.h"
26
26
 
27
27
namespace drizzled
28
28
{
33
33
 
34
34
class CreateTable : public Statement
35
35
{
36
 
  virtual bool check(const identifier::Table&);
37
 
 
38
36
public:
39
 
  CreateTable(Session *in_session, Table_ident *ident, bool is_temporary);
40
 
  CreateTable(Session *in_session);
41
 
 
42
 
  virtual bool is_alter() const
 
37
  CreateTable(Session *in_session)
 
38
    :
 
39
      Statement(in_session),
 
40
      is_create_table_like(false),
 
41
      is_if_not_exists(false),
 
42
      is_engine_set(false)
43
43
  {
44
 
    return false;
 
44
    memset(&create_info, 0, sizeof(create_info));
 
45
 
 
46
    create_table_message.set_creation_timestamp(time(NULL));
 
47
    create_table_message.set_update_timestamp(time(NULL));
45
48
  }
46
49
 
47
50
  bool execute();
48
 
 
49
 
  virtual bool executeInner(identifier::Table::const_reference);
50
 
 
51
 
public:
 
51
  message::Table create_table_message;
52
52
  message::Table &createTableMessage()
53
53
  {
54
 
    return *getSession()->getLex()->table();
 
54
    return create_table_message;
55
55
  };
56
 
 
57
 
private:
58
 
  HA_CREATE_INFO _create_info;
59
 
 
60
 
public:
61
 
 
62
 
  HA_CREATE_INFO &create_info()
63
 
  {
64
 
    if (createTableMessage().options().auto_increment_value())
65
 
    {
66
 
      _create_info.auto_increment_value= createTableMessage().options().auto_increment_value();
67
 
      _create_info.used_fields|= HA_CREATE_USED_AUTO;
68
 
    }
69
 
 
70
 
    return _create_info;
71
 
  }
72
 
 
 
56
  message::Table::Field *current_proto_field;
 
57
  HA_CREATE_INFO create_info;
73
58
  AlterInfo alter_info;
74
59
  KEY_CREATE_INFO key_create_info;
75
 
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption fk_match_option;
76
 
  message::Table::ForeignKeyConstraint::ForeignKeyOption fk_update_opt;
77
 
  message::Table::ForeignKeyConstraint::ForeignKeyOption fk_delete_opt;
 
60
  enum Foreign_key::fk_match_opt fk_match_option;
 
61
  enum Foreign_key::fk_option fk_update_opt;
 
62
  enum Foreign_key::fk_option fk_delete_opt;
78
63
 
79
64
  /* The text in a CHANGE COLUMN clause in ALTER TABLE */
80
65
  char *change;
90
75
  /* Poly-use */
91
76
  LEX_STRING comment;
92
77
 
 
78
  bool is_create_table_like;
 
79
  bool is_if_not_exists;
93
80
  bool is_engine_set;
94
 
  bool is_create_table_like;
95
 
  bool lex_identified_temp_table;
96
 
  bool link_to_local;
97
 
  TableList *create_table_list;
98
81
 
99
82
  bool validateCreateTableOption();
100
83
};