~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/set_option.cc

  • Committer: Brian Aker
  • Date: 2011-02-21 17:37:00 UTC
  • mto: (2192.1.1 drizzle-staging)
  • mto: This revision was merged to the branch mainline in revision 2193.
  • Revision ID: brian@tangent.org-20110221173700-6wdfbxm60zq9q9se
Merge in change from REPLICATION to REPLICATE as keyword.

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
 
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
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
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/statement/set_option.h>
26
26
namespace drizzled
27
27
{
28
28
 
 
29
namespace statement
 
30
{
 
31
SetOption::SetOption(Session *in_session) :
 
32
  Statement(in_session),
 
33
  one_shot_set(false)
 
34
  {
 
35
    getSession()->getLex()->sql_command= SQLCOM_SET_OPTION;
 
36
    init_select(getSession()->getLex());
 
37
    getSession()->getLex()->option_type= OPT_SESSION;
 
38
    getSession()->getLex()->var_list.empty();
 
39
  }
 
40
} // namespace statement
 
41
 
29
42
bool statement::SetOption::execute()
30
43
{
31
 
  TableList *all_tables= session->lex->query_tables;
32
 
  List<set_var_base> *lex_var_list= &session->lex->var_list;
 
44
  TableList *all_tables= getSession()->lex->query_tables;
33
45
 
34
 
  if (session->openTablesLock(all_tables))
 
46
  if (getSession()->openTablesLock(all_tables))
35
47
  {
36
48
    return true;
37
49
  }
38
 
  bool res= sql_set_variables(session, lex_var_list);
 
50
  bool res= sql_set_variables(getSession(), getSession()->lex->var_list);
39
51
  if (res)
40
52
  {
41
53
    /*
43
55
     * Send something semi-generic here since we don't know which
44
56
     * assignment in the list caused the error.
45
57
     */
46
 
    if (! session->is_error())
 
58
    if (! getSession()->is_error())
47
59
    {
48
60
      my_error(ER_WRONG_ARGUMENTS, MYF(0), "SET");
49
61
    }
50
62
  }
51
63
  else
52
64
  {
53
 
    session->my_ok();
 
65
    getSession()->my_ok();
54
66
  }
55
67
 
56
68
  return res;