~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/execute.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-13 12:46:37 UTC
  • mto: (2277.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2278.
  • Revision ID: olafvdspek@gmail.com-20110413124637-t16b7vw9t71lwa9w
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <drizzled/catalog/local.h>
28
28
#include <drizzled/execute.h>
29
29
 
30
 
namespace drizzled
31
 
{
 
30
namespace drizzled {
32
31
 
33
32
Execute::Execute(Session &arg, bool wait_arg) :
34
33
  wait(wait_arg),
36
35
{
37
36
}
38
37
 
39
 
Execute::~Execute()
40
 
{
41
 
}
42
 
 
43
38
void Execute::run(const char *arg, size_t length)
44
39
{
45
 
  std::string execution_string(arg, length);
46
 
  run(execution_string);
 
40
  run(std::string(arg, length));
47
41
}
48
42
 
49
 
void Execute::run(std::string &execution_string, sql::ResultSet &result_set)
 
43
void Execute::run(const std::string &execution_string, sql::ResultSet &result_set)
50
44
{
 
45
  if (not _session.isConcurrentExecuteAllowed())
 
46
  {
 
47
    my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
 
48
    return;
 
49
  }
51
50
  thread_ptr thread;
52
 
  
53
 
  if (_session.isConcurrentExecuteAllowed())
54
51
  {
55
52
    plugin::client::Cached *client= new plugin::client::Cached(result_set);
56
53
    client->pushSQL(execution_string);
77
74
      thread= new_session->getThread();
78
75
    }
79
76
  }
80
 
  else
81
 
  {
82
 
    my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
83
 
    return;
84
 
  }
85
77
  
86
78
  if (wait && thread && thread->joinable())
87
79
  {
107
99
  }
108
100
}
109
101
 
110
 
void Execute::run(std::string &execution_string)
 
102
void Execute::run(const std::string &execution_string)
111
103
{
 
104
  if (not _session.isConcurrentExecuteAllowed())
 
105
  {
 
106
    my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
 
107
    return;
 
108
  }
112
109
  thread_ptr thread;
113
 
 
114
 
  if (_session.isConcurrentExecuteAllowed())
115
110
  {
116
111
    plugin::client::Concurrent *client= new plugin::client::Concurrent;
117
112
    client->pushSQL(execution_string);
138
133
      thread= new_session->getThread();
139
134
    }
140
135
  }
141
 
  else
142
 
  {
143
 
    my_error(ER_WRONG_ARGUMENTS, MYF(0), "A Concurrent Execution Session can not launch another session.");
144
 
    return;
145
 
  }
146
136
 
147
137
  if (wait && thread && thread->joinable())
148
138
  {