Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
18366c93
Commit
18366c93
authored
Aug 29, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NOT elimination moved in parsing (suggested by Monty)
parent
34dc3a86
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
49 deletions
+11
-49
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+0
-33
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+0
-13
sql/sql_yacc.yy
sql/sql_yacc.yy
+10
-2
No files found.
sql/item_cmpfunc.cc
View file @
18366c93
...
...
@@ -2030,15 +2030,6 @@ void Item_cond::neg_arguments(THD *thd)
{
if
(
!
(
new_item
=
new
Item_func_not
(
item
)))
return
;
// Fatal OEM error
/*
We can use 0 as tables list because Item_func_not do not use it
on fix_fields and its arguments are already fixed.
We do not check results of fix_fields, because there are not way
to return error in this functions interface, thd->net.report_error
will be checked on upper level call.
*/
new_item
->
fix_fields
(
thd
,
0
,
&
new_item
);
}
VOID
(
li
.
replace
(
new_item
));
}
...
...
@@ -2734,18 +2725,6 @@ Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */
Item
*
Item_bool_rowready_func2
::
neg_transformer
(
THD
*
thd
)
{
Item
*
item
=
negated_item
();
if
(
item
)
{
/*
We can use 0 as tables list because Item_func* family do not use it
on fix_fields and its arguments are already fixed.
We do not check results of fix_fields, because there are not way
to return error in this functions interface, thd->net.report_error
will be checked on upper level call.
*/
item
->
fix_fields
(
thd
,
0
,
&
item
);
}
return
item
;
}
...
...
@@ -2754,9 +2733,6 @@ Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
Item
*
Item_func_isnull
::
neg_transformer
(
THD
*
thd
)
{
Item
*
item
=
new
Item_func_isnotnull
(
args
[
0
]);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if
(
item
)
item
->
fix_fields
(
thd
,
0
,
&
item
);
return
item
;
}
...
...
@@ -2765,9 +2741,6 @@ Item *Item_func_isnull::neg_transformer(THD *thd)
Item
*
Item_func_isnotnull
::
neg_transformer
(
THD
*
thd
)
{
Item
*
item
=
new
Item_func_isnull
(
args
[
0
]);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if
(
item
)
item
->
fix_fields
(
thd
,
0
,
&
item
);
return
item
;
}
...
...
@@ -2777,9 +2750,6 @@ Item *Item_cond_and::neg_transformer(THD *thd) /* NOT(a AND b AND ...) -> */
{
neg_arguments
(
thd
);
Item
*
item
=
new
Item_cond_or
(
list
);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if
(
item
)
item
->
fix_fields
(
thd
,
0
,
&
item
);
return
item
;
}
...
...
@@ -2789,9 +2759,6 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
{
neg_arguments
(
thd
);
Item
*
item
=
new
Item_cond_and
(
list
);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if
(
item
)
item
->
fix_fields
(
thd
,
0
,
&
item
);
return
item
;
}
...
...
sql/item_cmpfunc.h
View file @
18366c93
...
...
@@ -274,7 +274,7 @@ class Item_func_equal :public Item_bool_rowready_func2
enum
Functype
rev_functype
()
const
{
return
EQUAL_FUNC
;
}
cond_result
eq_cmp_result
()
const
{
return
COND_TRUE
;
}
const
char
*
func_name
()
const
{
return
"<=>"
;
}
Item
*
neg_transformer
(
THD
*
thd
)
{
return
0
;
}
Item
*
neg_transformer
(
THD
*
thd
)
{
return
0
;
}
};
...
...
sql/sql_select.cc
View file @
18366c93
...
...
@@ -4401,19 +4401,6 @@ optimize_cond(THD *thd, COND *conds, Item::cond_result *cond_value)
if
(
conds
)
{
DBUG_EXECUTE
(
"where"
,
print_where
(
conds
,
"original"
););
/* Eliminate NOT operators; in case of PS/SP do it once */
if
(
thd
->
current_arena
->
is_first_stmt_execute
())
{
Item_arena
*
arena
=
thd
->
current_arena
,
backup
;
thd
->
set_n_backup_item_arena
(
arena
,
&
backup
);
conds
=
eliminate_not_funcs
(
thd
,
conds
);
select
->
prep_where
=
conds
->
copy_andor_structure
(
thd
);
thd
->
restore_backup_item_arena
(
arena
,
&
backup
);
}
else
conds
=
eliminate_not_funcs
(
thd
,
conds
);
DBUG_EXECUTE
(
"where"
,
print_where
(
conds
,
"after negation elimination"
););
/* change field = field to field = const for each found field = const */
propagate_cond_constants
((
I_List
<
COND_CMP
>
*
)
0
,
conds
,
conds
);
/*
...
...
sql/sql_yacc.yy
View file @
18366c93
...
...
@@ -2755,8 +2755,16 @@ simple_expr:
| '+' expr %prec NEG { $$= $2; }
| '-' expr %prec NEG { $$= new Item_func_neg($2); }
| '~' expr %prec NEG { $$= new Item_func_bit_neg($2); }
| NOT expr %prec NEG { $$= new Item_func_not($2); }
| '!' expr %prec NEG { $$= new Item_func_not($2); }
| NOT expr %prec NEG
{
if (($$= $2->neg_transformer(YYTHD)) == 0)
$$= new Item_func_not($2);
}
| '!' expr %prec NEG
{
if (($$= $2->neg_transformer(YYTHD)) == 0)
$$= new Item_func_not($2);
}
| '(' expr ')' { $$= $2; }
| '(' expr ',' expr_list ')'
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment