~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/execute.cc

  • Committer: Brian Aker
  • Date: 2010-11-11 04:16:59 UTC
  • mto: (1932.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1930.
  • Revision ID: brian@tangent.org-20101111041659-5xb7ymjrasq1520p
Adding in support for EXECUTE to have WITH NO RETURN.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "drizzled/statement/execute.h"
24
24
#include "drizzled/session.h"
25
25
#include "drizzled/user_var_entry.h"
 
26
#include "drizzled/plugin/listen.h"
 
27
#include "drizzled/plugin/client.h"
26
28
 
27
29
namespace drizzled
28
30
{
32
34
namespace statement
33
35
{
34
36
 
35
 
Execute::Execute(Session *in_session) :
 
37
Execute::Execute(Session *in_session, drizzled::execute_string_t to_execute_arg, bool is_quiet_arg) :
36
38
  Statement(in_session),
37
 
  is_var(false)
 
39
  is_quiet(is_quiet_arg),
 
40
  to_execute(to_execute_arg)
38
41
{
39
42
}
40
43
  
41
44
 
42
45
bool statement::Execute::parseVariable()
43
46
{
44
 
  if (is_var)
 
47
  if (to_execute.isVariable())
45
48
  {
46
49
    user_var_entry *var= getSession()->getVariable(to_execute, false);
47
50
 
65
68
    my_error(ER_WRONG_ARGUMENTS, MYF(0), "Invalid Variable");
66
69
    return false;
67
70
  }
68
 
  if (is_var)
 
71
  if (to_execute.isVariable())
69
72
  {
70
73
    if (not parseVariable())
71
74
    {
74
77
    }
75
78
  }
76
79
 
77
 
  mysql_parse(getSession(), to_execute.str, to_execute.length);
78
 
 
79
 
  // We have to restore ourselves at the top for delete[] to work.
 
80
  if (is_quiet)
 
81
  {
 
82
    plugin::Client *temp= getSession()->getClient();
 
83
    plugin::Client *null_client= plugin::Listen::getNullClient();
 
84
 
 
85
    getSession()->setClient(null_client);
 
86
 
 
87
    mysql_parse(getSession(), to_execute.str, to_execute.length);
 
88
 
 
89
    getSession()->setClient(temp);
 
90
    if (getSession()->is_error())
 
91
    {
 
92
      getSession()->clear_error(true);
 
93
      getSession()->my_ok();
 
94
    }
 
95
    null_client->close();
 
96
    delete null_client;
 
97
  }
 
98
  else
 
99
  {
 
100
    mysql_parse(getSession(), to_execute.str, to_execute.length);
 
101
  }
 
102
 
 
103
 
 
104
  // We have to restore ourselves at the top for delete() to work.
80
105
  getSession()->getLex()->statement= this;
81
106
 
82
107
  return true;