~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/set_option.cc

  • Committer: Lee Bieber
  • Date: 2011-03-29 22:31:41 UTC
  • mfrom: (2257.1.3 build)
  • Revision ID: kalebral@gmail.com-20110329223141-yxc22h3l2he58sk0
Merge Andrew - 743842: Build failure using GCC 4.6
Merge Stewart - 738022: CachedDirectory silently fails to add entries if stat() fails
Merge Olaf - Common fwd: add copyright, add more declaration

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
25
 
 
26
 
namespace drizzled
27
 
{
 
25
#include <drizzled/sql_lex.h>
 
26
 
 
27
namespace drizzled {
 
28
namespace statement {
 
29
 
 
30
SetOption::SetOption(Session *in_session) :
 
31
  Statement(in_session),
 
32
  one_shot_set(false)
 
33
  {
 
34
    set_command(SQLCOM_SET_OPTION);
 
35
    init_select(&lex());
 
36
    lex().option_type= OPT_SESSION;
 
37
    lex().var_list.empty();
 
38
  }
 
39
} // namespace statement
28
40
 
29
41
bool statement::SetOption::execute()
30
42
{
31
 
  TableList *all_tables= session->lex->query_tables;
32
 
  List<set_var_base> *lex_var_list= &session->lex->var_list;
 
43
  TableList *all_tables= lex().query_tables;
33
44
 
34
 
  if (session->openTablesLock(all_tables))
 
45
  if (session().openTablesLock(all_tables))
35
46
  {
36
47
    return true;
37
48
  }
38
 
  bool res= sql_set_variables(session, lex_var_list);
 
49
  bool res= sql_set_variables(&session(), lex().var_list);
39
50
  if (res)
40
51
  {
41
52
    /*
43
54
     * Send something semi-generic here since we don't know which
44
55
     * assignment in the list caused the error.
45
56
     */
46
 
    if (! session->is_error())
 
57
    if (! session().is_error())
47
58
    {
48
59
      my_error(ER_WRONG_ARGUMENTS, MYF(0), "SET");
49
60
    }
50
61
  }
51
62
  else
52
63
  {
53
 
    session->my_ok();
 
64
    session().my_ok();
54
65
  }
55
66
 
56
67
  return res;