~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/eval0eval.h

  • 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:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/eval0eval.h
21
 
SQL evaluator: evaluates simple data structures, like expressions, in
22
 
a query graph
23
 
 
24
 
Created 12/29/1997 Heikki Tuuri
25
 
*******************************************************/
26
 
 
27
 
#ifndef eval0eval_h
28
 
#define eval0eval_h
29
 
 
30
 
#include "univ.i"
31
 
#include "que0types.h"
32
 
#include "pars0sym.h"
33
 
#include "pars0pars.h"
34
 
 
35
 
/*****************************************************************//**
36
 
Free the buffer from global dynamic memory for a value of a que_node,
37
 
if it has been allocated in the above function. The freeing for pushed
38
 
column values is done in sel_col_prefetch_buf_free. */
39
 
UNIV_INTERN
40
 
void
41
 
eval_node_free_val_buf(
42
 
/*===================*/
43
 
        que_node_t*     node);  /*!< in: query graph node */
44
 
/*****************************************************************//**
45
 
Evaluates a symbol table symbol. */
46
 
UNIV_INLINE
47
 
void
48
 
eval_sym(
49
 
/*=====*/
50
 
        sym_node_t*     sym_node);      /*!< in: symbol table node */
51
 
/*****************************************************************//**
52
 
Evaluates an expression. */
53
 
UNIV_INLINE
54
 
void
55
 
eval_exp(
56
 
/*=====*/
57
 
        que_node_t*     exp_node);      /*!< in: expression */
58
 
/*****************************************************************//**
59
 
Sets an integer value as the value of an expression node. */
60
 
UNIV_INLINE
61
 
void
62
 
eval_node_set_int_val(
63
 
/*==================*/
64
 
        que_node_t*     node,   /*!< in: expression node */
65
 
        lint            val);   /*!< in: value to set */
66
 
/*****************************************************************//**
67
 
Gets an integer value from an expression node.
68
 
@return integer value */
69
 
UNIV_INLINE
70
 
lint
71
 
eval_node_get_int_val(
72
 
/*==================*/
73
 
        que_node_t*     node);  /*!< in: expression node */
74
 
/*****************************************************************//**
75
 
Copies a binary string value as the value of a query graph node. Allocates a
76
 
new buffer if necessary. */
77
 
UNIV_INLINE
78
 
void
79
 
eval_node_copy_and_alloc_val(
80
 
/*=========================*/
81
 
        que_node_t*     node,   /*!< in: query graph node */
82
 
        const byte*     str,    /*!< in: binary string */
83
 
        ulint           len);   /*!< in: string length or UNIV_SQL_NULL */
84
 
/*****************************************************************//**
85
 
Copies a query node value to another node. */
86
 
UNIV_INLINE
87
 
void
88
 
eval_node_copy_val(
89
 
/*===============*/
90
 
        que_node_t*     node1,  /*!< in: node to copy to */
91
 
        que_node_t*     node2); /*!< in: node to copy from */
92
 
/*****************************************************************//**
93
 
Gets a iboolean value from a query node.
94
 
@return iboolean value */
95
 
UNIV_INLINE
96
 
ibool
97
 
eval_node_get_ibool_val(
98
 
/*====================*/
99
 
        que_node_t*     node);  /*!< in: query graph node */
100
 
/*****************************************************************//**
101
 
Evaluates a comparison node.
102
 
@return the result of the comparison */
103
 
UNIV_INTERN
104
 
ibool
105
 
eval_cmp(
106
 
/*=====*/
107
 
        func_node_t*    cmp_node);      /*!< in: comparison node */
108
 
 
109
 
 
110
 
#ifndef UNIV_NONINL
111
 
#include "eval0eval.ic"
112
 
#endif
113
 
 
114
 
#endif