~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/set_option.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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