~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
19
19
 */
20
20
 
21
21
#include "config.h"
22
 
 
23
22
#include <drizzled/show.h>
24
23
#include <drizzled/session.h>
25
24
#include <drizzled/lock.h>
26
25
#include <drizzled/statement/flush.h>
27
26
#include "drizzled/sql_table.h"
28
 
#include "drizzled/plugin/logging.h"
29
 
#include "drizzled/plugin/storage_engine.h"
30
27
 
31
28
namespace drizzled
32
29
{
37
34
   * reloadCache() will tell us if we are allowed to write to the
38
35
   * binlog or not.
39
36
   */
40
 
  if (not reloadCache())
 
37
  if (! reloadCache())
41
38
  {
42
39
    /*
43
40
     * We WANT to write and we CAN write.
45
42
     *
46
43
     * Presumably, RESET and binlog writing doesn't require synchronization
47
44
     */
48
 
    write_bin_log(getSession(), *getSession()->getQueryString());
49
 
    getSession()->my_ok();
 
45
    write_bin_log(session, session->query.c_str());
 
46
    session->my_ok();
50
47
  }
51
48
 
52
49
  return false;
55
52
bool statement::Flush::reloadCache()
56
53
{
57
54
  bool result= false;
58
 
  TableList *tables= (TableList *) getSession()->lex->select_lex.table_list.first;
 
55
  TableList *tables= (TableList *) session->lex->select_lex.table_list.first;
59
56
 
60
57
  if (flush_log)
61
58
  {
70
67
  */
71
68
  if (flush_tables || flush_tables_with_read_lock)
72
69
  {
73
 
    if (getSession() && flush_tables_with_read_lock)
 
70
    if (session && flush_tables_with_read_lock)
74
71
    {
75
 
      if (getSession()->lockGlobalReadLock())
 
72
      if (lock_global_read_lock(session))
76
73
      {
77
74
        return true; /* Killed */
78
75
      }
79
 
      result= getSession()->close_cached_tables(tables, true, true);
 
76
      result= session->close_cached_tables(tables, true, true);
80
77
 
81
 
      if (getSession()->makeGlobalReadLockBlockCommit()) /* Killed */
 
78
      if (make_global_read_lock_block_commit(session)) /* Killed */
82
79
      {
83
80
        /* Don't leave things in a half-locked state */
84
 
        getSession()->unlockGlobalReadLock();
 
81
        unlock_global_read_lock(session);
85
82
        return true;
86
83
      }
87
84
    }
88
85
    else
89
86
    {
90
 
      result= getSession()->close_cached_tables(tables, true, false);
 
87
      result= session->close_cached_tables(tables, true, false);
91
88
    }
92
89
  }
93
90
 
94
 
  if (getSession() && flush_status)
95
 
  {
96
 
    getSession()->refresh_status();
97
 
  }
98
 
 
99
 
  if (getSession() && flush_global_status)
100
 
  {
101
 
    memset(&current_global_counters, 0, sizeof(current_global_counters));
102
 
    plugin::Logging::resetStats(getSession());
103
 
    getSession()->refresh_status();
104
 
  }
105
 
 
106
 
  return result;
 
91
  if (session && flush_status)
 
92
  {
 
93
    session->refresh_status();
 
94
  }
 
95
 
 
96
 return result;
107
97
}
108
98
 
109
99
}