~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

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