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
980aa3e7
Commit
980aa3e7
authored
Aug 03, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16888 Add virtual Type_handler::cond_notnull_field_isnull_to_field_eq_zero()
parent
8ecc7537
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+2
-3
sql/sql_select.cc
sql/sql_select.cc
+2
-3
sql/sql_type.h
sql/sql_type.h
+19
-0
No files found.
sql/item_cmpfunc.h
View file @
980aa3e7
...
@@ -2518,9 +2518,8 @@ class Item_func_isnull :public Item_func_null_predicate
...
@@ -2518,9 +2518,8 @@ class Item_func_isnull :public Item_func_null_predicate
{
{
Field
*
field
=
((
Item_field
*
)
args
[
0
]
->
real_item
())
->
field
;
Field
*
field
=
((
Item_field
*
)
args
[
0
]
->
real_item
())
->
field
;
if
(((
field
->
type
()
==
MYSQL_TYPE_DATE
)
||
if
((
field
->
flags
&
NOT_NULL_FLAG
)
&&
(
field
->
type
()
==
MYSQL_TYPE_DATETIME
))
&&
field
->
type_handler
()
->
cond_notnull_field_isnull_to_field_eq_zero
())
(
field
->
flags
&
NOT_NULL_FLAG
))
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
sql/sql_select.cc
View file @
980aa3e7
...
@@ -16360,9 +16360,8 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
...
@@ -16360,9 +16360,8 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
{
{
Field *field= ((Item_field*) real_item)->field;
Field *field= ((Item_field*) real_item)->field;
if
(((
field
->
type
()
==
MYSQL_TYPE_DATE
)
||
if ((field->flags & NOT_NULL_FLAG) &&
(
field
->
type
()
==
MYSQL_TYPE_DATETIME
))
&&
field->type_handler()->cond_notnull_field_isnull_to_field_eq_zero())
(
field
->
flags
&
NOT_NULL_FLAG
))
{
{
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
/*
/*
...
...
sql/sql_type.h
View file @
980aa3e7
...
@@ -1399,6 +1399,17 @@ class Type_handler
...
@@ -1399,6 +1399,17 @@ class Type_handler
{
{
return
false
;
return
false
;
}
}
/*
Returns true if this data type supports a hack that
WHERE notnull_column IS NULL
finds zero values, e.g.:
WHERE date_notnull_column IS NULL ->
WHERE date_notnull_column = '0000-00-00'
*/
virtual
bool
cond_notnull_field_isnull_to_field_eq_zero
()
const
{
return
false
;
}
/**
/**
Check whether a field type can be partially indexed by a key.
Check whether a field type can be partially indexed by a key.
@param type field type
@param type field type
...
@@ -3344,6 +3355,10 @@ class Type_handler_date_common: public Type_handler_temporal_with_date
...
@@ -3344,6 +3355,10 @@ class Type_handler_date_common: public Type_handler_temporal_with_date
{
{
return
MYSQL_TIMESTAMP_DATE
;
return
MYSQL_TIMESTAMP_DATE
;
}
}
bool
cond_notnull_field_isnull_to_field_eq_zero
()
const
{
return
true
;
}
Item_literal
*
create_literal_item
(
THD
*
thd
,
const
char
*
str
,
size_t
length
,
Item_literal
*
create_literal_item
(
THD
*
thd
,
const
char
*
str
,
size_t
length
,
CHARSET_INFO
*
cs
,
bool
send_error
)
const
;
CHARSET_INFO
*
cs
,
bool
send_error
)
const
;
Item
*
create_typecast_item
(
THD
*
thd
,
Item
*
item
,
Item
*
create_typecast_item
(
THD
*
thd
,
Item
*
item
,
...
@@ -3425,6 +3440,10 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date
...
@@ -3425,6 +3440,10 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date
{
{
return
MYSQL_TIMESTAMP_DATETIME
;
return
MYSQL_TIMESTAMP_DATETIME
;
}
}
bool
cond_notnull_field_isnull_to_field_eq_zero
()
const
{
return
true
;
}
Item
*
create_typecast_item
(
THD
*
thd
,
Item
*
item
,
Item
*
create_typecast_item
(
THD
*
thd
,
Item
*
item
,
const
Type_cast_attributes
&
attr
)
const
;
const
Type_cast_attributes
&
attr
)
const
;
void
Column_definition_implicit_upgrade
(
Column_definition
*
c
)
const
;
void
Column_definition_implicit_upgrade
(
Column_definition
*
c
)
const
;
...
...
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