~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/flush.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • mto: (1711.1.21 build) (1725.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: prafulla_t@users.sourceforge.net-20100806112112-7w5u0s3nx9u67nzt
Fix for Bug 586051

1. test_if_ref method which checks whether predicate is already evaluated
   due to ref/eq_ref access or not was incorrectly removing a predicate 
   that was not implicitly evaluated due to ref access (due to presence of filesort ?)
   It was field=NULL predicate.
   Such predicate should be kept and execution engine will filter out rows
   correctly. Removal of such predicate led to returning of rows which had
   NULL for join/predicate columns.
2. field COMP_OP NULL will always false for all fields except when COMP_OP
   is NULL-safe equality operator. Modified range optimizer to return zero
   row count in such cases.
   Query now does not even run. It returns zero result. As such Fix(1) is not
   required but we might hit that case in some other query (I have not tried it
   yet)
3. Fixed Field::val_str to print "NULL" for literal NULL instead of "0". It
   added lot of confusion while debugging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/statement/flush.h>
26
26
#include "drizzled/sql_table.h"
27
 
#include "drizzled/plugin/logging.h"
28
27
 
29
28
namespace drizzled
30
29
{
35
34
   * reloadCache() will tell us if we are allowed to write to the
36
35
   * binlog or not.
37
36
   */
38
 
  if (not reloadCache())
 
37
  if (! reloadCache())
39
38
  {
40
39
    /*
41
40
     * We WANT to write and we CAN write.
43
42
     *
44
43
     * Presumably, RESET and binlog writing doesn't require synchronization
45
44
     */
46
 
    write_bin_log(session, *session->getQueryString());
 
45
    write_bin_log(session, session->query.c_str());
47
46
    session->my_ok();
48
47
  }
49
48
 
70
69
  {
71
70
    if (session && flush_tables_with_read_lock)
72
71
    {
73
 
      if (session->lockGlobalReadLock())
 
72
      if (lock_global_read_lock(session))
74
73
      {
75
74
        return true; /* Killed */
76
75
      }
77
76
      result= session->close_cached_tables(tables, true, true);
78
77
 
79
 
      if (session->makeGlobalReadLockBlockCommit()) /* Killed */
 
78
      if (make_global_read_lock_block_commit(session)) /* Killed */
80
79
      {
81
80
        /* Don't leave things in a half-locked state */
82
 
        session->unlockGlobalReadLock();
 
81
        unlock_global_read_lock(session);
83
82
        return true;
84
83
      }
85
84
    }
94
93
    session->refresh_status();
95
94
  }
96
95
 
97
 
  if (session && flush_global_status)
98
 
  {
99
 
    memset(&current_global_counters, 0, sizeof(current_global_counters));
100
 
    plugin::Logging::resetStats(session);
101
 
    session->refresh_status();
102
 
  }
103
 
 
104
 
  return result;
 
96
 return result;
105
97
}
106
98
 
107
99
}