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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fea4af6d
Commit
fea4af6d
authored
May 08, 2007
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item_cmpfunc.cc, type_datetime.result, type_datetime.test, item_cmpfunc.h:
After merge fix.
parent
df081a3a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
138 deletions
+110
-138
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+2
-2
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+1
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+104
-104
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+3
-31
No files found.
mysql-test/r/type_datetime.result
View file @
fea4af6d
...
...
@@ -328,8 +328,8 @@ least(cast('01-01-01' as datetime), '01-01-02') + 0
select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
cast(least(cast('01-01-01' as datetime), '01-01-02') as signed)
20010101000000
select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal);
cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal)
select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal
(16,2)
);
cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal
(16,2)
)
20010101000000.00
DROP PROCEDURE IF EXISTS test27759 ;
CREATE PROCEDURE test27759()
...
...
mysql-test/t/type_datetime.test
View file @
fea4af6d
...
...
@@ -207,7 +207,7 @@ select least(cast('01-01-01' as date), '01-01-02') + 0;
select
greatest
(
cast
(
'01-01-01'
as
date
),
'01-01-02'
)
+
0
;
select
least
(
cast
(
'01-01-01'
as
datetime
),
'01-01-02'
)
+
0
;
select
cast
(
least
(
cast
(
'01-01-01'
as
datetime
),
'01-01-02'
)
as
signed
);
select
cast
(
least
(
cast
(
'01-01-01'
as
datetime
),
'01-01-02'
)
as
decimal
);
select
cast
(
least
(
cast
(
'01-01-01'
as
datetime
),
'01-01-02'
)
as
decimal
(
16
,
2
)
);
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
test27759
;
--
enable_warnings
...
...
sql/item_cmpfunc.cc
View file @
fea4af6d
...
...
@@ -3238,6 +3238,12 @@ void Item_func_in::fix_length_and_dec()
/* TRUE <=> arguments values will be compared as DATETIMEs. */
bool
compare_as_datetime
=
FALSE
;
Item
*
date_arg
=
0
;
uint
found_types
=
0
;
uint
type_cnt
=
0
,
i
;
Item_result
cmp_type
=
STRING_RESULT
;
left_result_type
=
args
[
0
]
->
result_type
();
if
(
!
(
found_types
=
collect_cmp_types
(
args
,
arg_count
)))
return
;
for
(
arg
=
args
+
1
,
arg_end
=
args
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
...
...
@@ -3247,6 +3253,24 @@ void Item_func_in::fix_length_and_dec()
break
;
}
}
for
(
i
=
0
;
i
<=
(
uint
)
DECIMAL_RESULT
;
i
++
)
{
if
(
found_types
&
1
<<
i
)
{
(
type_cnt
)
++
;
cmp_type
=
(
Item_result
)
i
;
}
}
if
(
type_cnt
==
1
)
{
if
(
cmp_type
==
STRING_RESULT
&&
agg_arg_charsets
(
cmp_collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
,
1
))
return
;
arg_types_compatible
=
TRUE
;
}
if
(
type_cnt
==
1
)
{
/*
When comparing rows create the row comparator object beforehand to ease
the DATETIME comparison detection procedure.
...
...
@@ -3263,7 +3287,7 @@ void Item_func_in::fix_length_and_dec()
{
if
(
!
(
cmp
=
new
cmp_item_row
))
return
;
in_item
=
cmp
;
cmp_items
[
ROW_RESULT
]
=
cmp
;
}
cmp
->
n
=
args
[
0
]
->
cols
();
cmp
->
alloc_comparators
();
...
...
@@ -3317,7 +3341,7 @@ void Item_func_in::fix_length_and_dec()
if
(
array
)
cmp
=
((
in_row
*
)
array
)
->
tmp
.
comparators
+
col
;
else
cmp
=
((
cmp_item_row
*
)
in_item
)
->
comparators
+
col
;
cmp
=
((
cmp_item_row
*
)
cmp_items
[
ROW_RESULT
]
)
->
comparators
+
col
;
*
cmp
=
new
cmp_item_datetime
(
date_arg
);
/* Reset variables for the next column. */
date_arg
=
0
;
...
...
@@ -3328,23 +3352,7 @@ void Item_func_in::fix_length_and_dec()
}
}
}
for
(
i
=
0
;
i
<=
(
uint
)
DECIMAL_RESULT
;
i
++
)
{
if
(
found_types
&
1
<<
i
)
{
(
type_cnt
)
++
;
cmp_type
=
(
Item_result
)
i
;
}
}
if
(
type_cnt
==
1
)
{
if
(
cmp_type
==
STRING_RESULT
&&
agg_arg_charsets
(
cmp_collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
,
1
))
return
;
arg_types_compatible
=
TRUE
;
}
/*
Row item with NULLs inside can return NULL or FALSE =>
they can't be processed as static
...
...
@@ -3424,17 +3432,8 @@ void Item_func_in::fix_length_and_dec()
}
else
{
if
(
in_item
)
{
/*
The row comparator was created at the beginning but only DATETIME
items comparators were initialized. Call store_value() to setup
others.
*/
in_item
->
store_value
(
args
[
0
]);
}
else
if
(
compare_as_datetime
)
in_item
=
new
cmp_item_datetime
(
date_arg
);
if
(
compare_as_datetime
)
cmp_items
[
STRING_RESULT
]
=
new
cmp_item_datetime
(
date_arg
);
else
{
for
(
i
=
0
;
i
<=
(
uint
)
DECIMAL_RESULT
;
i
++
)
...
...
@@ -3442,9 +3441,10 @@ void Item_func_in::fix_length_and_dec()
if
(
found_types
&
(
1
<<
i
)
&&
!
cmp_items
[
i
])
{
if
((
Item_result
)
i
==
STRING_RESULT
&&
agg_arg_charsets
(
cmp_collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
,
1
))
agg_arg_charsets
(
cmp_collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
,
1
))
return
;
if
(
!
(
cmp_items
[
i
]
=
if
(
!
cmp_items
[
i
]
&&
!
(
cmp_items
[
i
]
=
cmp_item
::
get_comparator
((
Item_result
)
i
,
cmp_collation
.
collation
)))
return
;
...
...
sql/item_cmpfunc.h
View file @
fea4af6d
...
...
@@ -1186,7 +1186,7 @@ public:
*/
bool
arg_types_compatible
;
Item_result
left_result_type
;
cmp_item
*
cmp_items
[
5
];
/* One cmp_item for each result type */
cmp_item
*
cmp_items
[
6
];
/* One cmp_item for each result type */
DTCollation
cmp_collation
;
Item_func_in
(
List
<
Item
>
&
list
)
...
...
@@ -1207,7 +1207,7 @@ public:
Item_int_func
::
cleanup
();
delete
array
;
array
=
0
;
for
(
i
=
0
;
i
<=
(
uint
)
DECIMAL_RESULT
;
i
++
)
for
(
i
=
0
;
i
<=
(
uint
)
DECIMAL_RESULT
+
1
;
i
++
)
{
delete
cmp_items
[
i
];
cmp_items
[
i
]
=
0
;
...
...
@@ -1251,35 +1251,7 @@ public:
void
set
(
uint
pos
,
Item
*
item
);
byte
*
get_value
(
Item
*
item
);
friend
void
Item_func_in
::
fix_length_and_dec
();
Item_resul
result_type
()
{
return
ROW_RESULT
;
};
};
class
cmp_item_row
:
public
cmp_item
{
cmp_item
**
comparators
;
uint
n
;
public:
cmp_item_row
()
:
comparators
(
0
),
n
(
0
)
{}
~
cmp_item_row
();
void
store_value
(
Item
*
item
);
inline
void
alloc_comparators
();
int
cmp
(
Item
*
arg
);
int
compare
(
cmp_item
*
arg
);
cmp_item
*
make_same
();
void
store_value_by_template
(
cmp_item
*
tmpl
,
Item
*
);
friend
void
Item_func_in
::
fix_length_and_dec
();
};
class
in_row
:
public
in_vector
{
cmp_item_row
tmp
;
public:
in_row
(
uint
elements
,
Item
*
);
~
in_row
();
void
set
(
uint
pos
,
Item
*
item
);
byte
*
get_value
(
Item
*
item
);
friend
void
Item_func_in
::
fix_length_and_dec
();
Item_result
result_type
()
{
return
ROW_RESULT
;
};
};
/* Functions used by where clause */
...
...
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