~ubuntu-branches/ubuntu/trusty/drizzle/trusty-proposed

« back to all changes in this revision

Viewing changes to drizzled/statement/set_option.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-03-15 10:41:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110315104118-7uebxox1vo838xkz
Tags: 2011.03.13-1
* New upstream release.
* Added slave plugin.
* Removed archive, blackhole and blitzdb plugins.
* Moved location of libdrizzle headers.
* Removed drizzleadmin manpage patch.
* Add drizzle_safe_write_string to symbols.

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
    set_command(SQLCOM_SET_OPTION);
 
36
    init_select(&lex());
 
37
    lex().option_type= OPT_SESSION;
 
38
    lex().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= lex().query_tables;
33
45
 
34
 
  if (session->openTablesLock(all_tables))
 
46
  if (session().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(&session(), 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 (! session().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
    session().my_ok();
54
66
  }
55
67
 
56
68
  return res;