~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/slave/sql_executor.cc

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
  : _in_error_state(false)
39
39
{
40
40
  /* setup a Session object */
41
 
  _session= Session::make_shared(plugin::Listen::getNullClient(),
42
 
                                 catalog::local());
 
41
  _session= Session::make_shared(plugin::Listen::getNullClient(), catalog::local());
43
42
  identifier::user::mptr user_id= identifier::User::make_shared();
44
43
  user_id->setUser(user);
45
44
  _session->setUser(user_id);
46
 
  _session->set_db(schema);
 
45
  _session->set_schema(schema);
47
46
}
48
47
 
49
48
 
50
49
bool SQLExecutor::executeSQL(vector<string> &sql)
51
50
{
52
 
  string combined_sql;
53
 
 
54
51
  if (not _in_error_state)
55
52
    _error_message.clear();
56
53
 
57
54
  Execute execute(*(_session.get()), true);
58
55
 
59
 
  vector<string>::iterator iter= sql.begin();
60
 
 
61
 
  while (iter != sql.end())
 
56
  string combined_sql;
 
57
  BOOST_FOREACH(string& it, sql)
62
58
  {
63
 
    combined_sql.append(*iter);
 
59
    combined_sql.append(it);
64
60
    combined_sql.append("; ");
65
 
    ++iter;
66
61
  }
67
62
 
68
63
  sql::ResultSet result_set(1);
93
88
      bad_sql.append("\n");
94
89
    }
95
90
 
96
 
    errmsg_printf(error::ERROR, _("%s\n%s\n"),
97
 
                  _error_message.c_str(), bad_sql.c_str());
 
91
    errmsg_printf(error::ERROR, _("%s\n%s\n"), _error_message.c_str(), bad_sql.c_str());
98
92
    return false;
99
93
  }
100
94