~drizzle-trunk/drizzle/development

1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
22
2239.1.10 by Olaf van der Spek
Refactor includes
23
#include <drizzled/sql_lex.h>
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
24
#include <drizzled/statement.h>
25
2239.1.10 by Olaf van der Spek
Refactor includes
26
namespace drizzled {
27
namespace statement {
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
28
29
class Flush : public Statement
30
{
31
public:
2104.3.9 by Brian Aker
Merge in the last of the sql_command/push it into the statement object
32
  Flush(Session *in_session) :
1315.2.17 by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others.
33
    Statement(in_session),
34
    flush_log(false),
35
    flush_tables(false),
36
    flush_tables_with_read_lock(false),
1900.3.1 by Andrew Hutchings
Add FLUSH GLOBAL STATUS; command
37
    flush_status(false),
38
    flush_global_status(false)
2104.3.9 by Brian Aker
Merge in the last of the sql_command/push it into the statement object
39
  {
2224.2.6 by Olaf van der Spek
Statement::set_command
40
    set_command(SQLCOM_FLUSH);
2224.2.8 by Olaf van der Spek
Statement::lex()
41
    lex().type= 0;
2104.3.9 by Brian Aker
Merge in the last of the sql_command/push it into the statement object
42
  }
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
43
44
  bool execute();
45
46
private:
1315.2.17 by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others.
47
  bool flush_log;
48
  bool flush_tables;
49
  bool flush_tables_with_read_lock;
50
  bool flush_status;
1900.3.1 by Andrew Hutchings
Add FLUSH GLOBAL STATUS; command
51
  bool flush_global_status;
1315.2.17 by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others.
52
53
public:
54
  void setFlushLog(bool f) { flush_log= f; }
55
  void setFlushTables(bool f) { flush_tables= f; }
56
  void setFlushTablesWithReadLock(bool f) {
57
    flush_tables= flush_tables_with_read_lock= f;
58
  }
59
  void setFlushStatus(bool f) { flush_status= f; }
1900.3.1 by Andrew Hutchings
Add FLUSH GLOBAL STATUS; command
60
  void setFlushGlobalStatus(bool f) { flush_global_status= f; }
1315.2.17 by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others.
61
62
private:
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
63
64
  /**
65
   * Reload/resets privileges and the different caches.
66
   *
67
   * @note Depending on 'options', it may be very bad to write the
68
   * query to the binlog (e.g. FLUSH SLAVE); this is a
69
   * pointer where reloadCache() will put 0 if
70
   * it thinks we really should not write to the binlog.
71
   * Otherwise it will put 1.
72
   * 
73
   * @return Error status code
74
   * @retval 0 Ok
75
   * @retval !=0  Error; session->killed is set or session->is_error() is true
76
   */
77
  bool reloadCache();
78
};
79
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
80
} /* namespace statement */
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
81
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
82
} /* namespace drizzled */
1100.3.48 by Padraig O'Sullivan
Extracted the FLUSH command into its own class and implementation files.
83