~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: Brian Aker
  • Date: 2011-01-06 05:17:09 UTC
  • Revision ID: brian@tangent.org-20110106051709-oa0se8ur02uc6i9o
Added native functions into the function table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
27
#include "drizzled/plugin/logging.h"
29
 
#include "drizzled/plugin/storage_engine.h"
30
28
 
31
29
namespace drizzled
32
30
{
45
43
     *
46
44
     * Presumably, RESET and binlog writing doesn't require synchronization
47
45
     */
48
 
    write_bin_log(getSession(), *getSession()->getQueryString());
49
 
    getSession()->my_ok();
 
46
    write_bin_log(session, *session->getQueryString());
 
47
    session->my_ok();
50
48
  }
51
49
 
52
50
  return false;
55
53
bool statement::Flush::reloadCache()
56
54
{
57
55
  bool result= false;
58
 
  TableList *tables= (TableList *) getSession()->lex->select_lex.table_list.first;
 
56
  TableList *tables= (TableList *) session->lex->select_lex.table_list.first;
59
57
 
60
58
  if (flush_log)
61
59
  {
70
68
  */
71
69
  if (flush_tables || flush_tables_with_read_lock)
72
70
  {
73
 
    if (getSession() && flush_tables_with_read_lock)
 
71
    if (session && flush_tables_with_read_lock)
74
72
    {
75
 
      if (getSession()->lockGlobalReadLock())
 
73
      if (session->lockGlobalReadLock())
76
74
      {
77
75
        return true; /* Killed */
78
76
      }
79
 
      result= getSession()->close_cached_tables(tables, true, true);
 
77
      result= session->close_cached_tables(tables, true, true);
80
78
 
81
 
      if (getSession()->makeGlobalReadLockBlockCommit()) /* Killed */
 
79
      if (session->makeGlobalReadLockBlockCommit()) /* Killed */
82
80
      {
83
81
        /* Don't leave things in a half-locked state */
84
 
        getSession()->unlockGlobalReadLock();
 
82
        session->unlockGlobalReadLock();
85
83
        return true;
86
84
      }
87
85
    }
88
86
    else
89
87
    {
90
 
      result= getSession()->close_cached_tables(tables, true, false);
 
88
      result= session->close_cached_tables(tables, true, false);
91
89
    }
92
90
  }
93
91
 
94
 
  if (getSession() && flush_status)
 
92
  if (session && flush_status)
95
93
  {
96
 
    getSession()->refresh_status();
 
94
    session->refresh_status();
97
95
  }
98
96
 
99
 
  if (getSession() && flush_global_status)
 
97
  if (session && flush_global_status)
100
98
  {
101
99
    memset(&current_global_counters, 0, sizeof(current_global_counters));
102
 
    plugin::Logging::resetStats(getSession());
103
 
    getSession()->refresh_status();
 
100
    plugin::Logging::resetStats(session);
 
101
    session->refresh_status();
104
102
  }
105
103
 
106
104
  return result;