~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client/concurrent.h

  • Committer: Mark Atwood
  • Date: 2011-06-14 19:30:31 UTC
  • mfrom: (2318.2.41 refactor5)
  • Revision ID: me@mark.atwood.name-20110614193031-lwbrlwfgf6id4r8b
merge lp:~olafvdspek/drizzle/refactor6
 with resolved conflict in drizzled/plugin/client.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
  virtual int getFileDescriptor(void) { return -1; }
56
56
  virtual bool isConnected(void) { return true; }
57
 
  virtual bool isReading(void) { return false; }
58
 
  virtual bool isWriting(void) { return false; }
59
57
  virtual bool flush(void) { return false; }
60
58
  virtual void close(void) {}
61
59
  virtual bool authenticate(void) { return true; }
65
63
    while(not to_execute.empty())
66
64
    {
67
65
      Queue::value_type next= to_execute.front();
68
 
      packet_buffer.assign(next.c_str(), next.size());
 
66
      packet_buffer= next;
69
67
 
70
 
      *packet= packet_buffer.c_str();
 
68
      *packet= packet_buffer.data();
71
69
      packet_length= next.size();
72
70
 
73
71
      to_execute.pop();
79
77
    {
80
78
      packet_buffer.clear();
81
79
      packet_length= 1;
82
 
      *packet= packet_buffer.c_str();
 
80
      *packet= packet_buffer.data();
83
81
      is_dead= true;
84
82
 
85
83
      return true;
110
108
  void pushSQL(const std::string &arg)
111
109
  {
112
110
    ::drizzled::error_t err_msg;
113
 
    ::drizzled::execute::Context *context= new ::drizzled::execute::Context(arg.c_str(), arg.length(), err_msg);
 
111
    ::drizzled::execute::Context *context= new ::drizzled::execute::Context(arg.data(), arg.size(), err_msg);
114
112
    std::vector<std::string> parsed_tokens= context->start();
115
113
 
116
114
    {
117
115
      drizzled::util::String byte;
118
 
      byte.assign(1, char(COM_QUERY)); // Insert our COM_QUERY
 
116
      byte.assign(1, COM_QUERY); // Insert our COM_QUERY
119
117
      byte.append(drizzle_literal_parameter("START TRANSACTION")); // +1 for the COM_QUERY, provided by null count from sizeof()
120
118
      to_execute.push(byte);
121
119
    }
122
120
    
123
 
    for (vector<string>::iterator iter= parsed_tokens.begin(); iter != parsed_tokens.end(); ++iter)
 
121
    BOOST_FOREACH(const string& iter, parsed_tokens)
124
122
    {
125
123
      drizzled::util::String byte;
126
 
      byte.assign(1, char(COM_QUERY)); // Insert our COM_QUERY
127
 
      byte.append(iter->c_str(), iter->size());
 
124
      byte.assign(1, COM_QUERY); // Insert our COM_QUERY
 
125
      byte.append(iter.data(), iter.size());
128
126
      to_execute.push(byte);
129
127
    }
130
128
 
131
129
    {
132
130
      drizzled::util::String byte;
133
 
      byte.assign(1, char(COM_QUERY)); // Insert our COM_QUERY
 
131
      byte.assign(1, COM_QUERY); // Insert our COM_QUERY
134
132
      byte.append(drizzle_literal_parameter("COMMIT")); // +1 for the COM_QUERY, provided by null count from sizeof()
135
133
      to_execute.push(byte);
136
134
    }