~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: Stewart Smith
  • Date: 2009-12-02 06:01:21 UTC
  • mto: (1237.1.2 push)
  • mto: This revision was merged to the branch mainline in revision 1238.
  • Revision ID: stewart@flamingspork.com-20091202060121-68gyfqifqcjcmi2v
my_end() no longer requires an argument (we removed them all)

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 <drizzled/server_includes.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/statement/flush.h>
26
 
#include "drizzled/sql_table.h"
27
26
 
28
27
namespace drizzled
29
28
{
42
41
     *
43
42
     * Presumably, RESET and binlog writing doesn't require synchronization
44
43
     */
45
 
    write_bin_log(session, session->query.c_str());
 
44
    write_bin_log(session, session->query, session->query_length);
46
45
    session->my_ok();
47
46
  }
48
47
 
52
51
bool statement::Flush::reloadCache()
53
52
{
54
53
  bool result= false;
 
54
  ulong options= session->lex->type;
55
55
  TableList *tables= (TableList *) session->lex->select_lex.table_list.first;
56
56
 
57
 
  if (flush_log)
 
57
  if (options & REFRESH_LOG)
58
58
  {
59
59
    if (plugin::StorageEngine::flushLogs(NULL))
60
60
    {
65
65
    Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
66
66
    (see sql_yacc.yy)
67
67
  */
68
 
  if (flush_tables || flush_tables_with_read_lock)
 
68
  if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
69
69
  {
70
 
    if (session && flush_tables_with_read_lock)
 
70
    if ((options & REFRESH_READ_LOCK) && session)
71
71
    {
72
72
      if (lock_global_read_lock(session))
73
73
      {
74
74
        return true; /* Killed */
75
75
      }
76
 
      result= session->close_cached_tables(tables, true, true);
77
 
 
 
76
      result= session->close_cached_tables(tables, 
 
77
                                           (options & REFRESH_FAST) ?  false : true, 
 
78
                                           true);
78
79
      if (make_global_read_lock_block_commit(session)) /* Killed */
79
80
      {
80
81
        /* Don't leave things in a half-locked state */
84
85
    }
85
86
    else
86
87
    {
87
 
      result= session->close_cached_tables(tables, true, false);
 
88
      result= session->close_cached_tables(tables, 
 
89
                                           (options & REFRESH_FAST) ?  false : true, 
 
90
                                           false);
88
91
    }
89
92
  }
90
93
 
91
 
  if (session && flush_status)
 
94
  if (session && (options & REFRESH_STATUS))
92
95
  {
93
96
    session->refresh_status();
94
97
  }