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
7a41acfd
Commit
7a41acfd
authored
Nov 23, 2007
by
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/mysql-5.0-engines
into mysql.com:/home/ram/work/b32560/b32560.5.0
parents
a13b5e9d
51ca3235
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
13 deletions
+73
-13
mysql-test/r/func_set.result
mysql-test/r/func_set.result
+30
-0
mysql-test/t/func_set.test
mysql-test/t/func_set.test
+18
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+25
-12
No files found.
mysql-test/r/func_set.result
View file @
7a41acfd
...
...
@@ -73,3 +73,33 @@ find_in_set(binary 'a', 'A,B,C')
select find_in_set('1','3,1,');
find_in_set('1','3,1,')
2
End of 4.1 tests
SELECT INTERVAL(0.0, NULL);
INTERVAL(0.0, NULL)
1
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL))
1
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL))
1
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
8
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL))
8
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
8
End of 5.0 tests
mysql-test/t/func_set.test
View file @
7a41acfd
...
...
@@ -54,4 +54,21 @@ select find_in_set(binary 'a', 'A,B,C');
#
select
find_in_set
(
'1'
,
'3,1,'
);
# End of 4.1 tests
--
echo
End
of
4.1
tests
#
# Bug #32560: crash with interval function and count(*)
#
SELECT
INTERVAL
(
0.0
,
NULL
);
SELECT
INTERVAL
(
0.0
,
CAST
(
NULL
AS
DECIMAL
));
SELECT
INTERVAL
(
0.0
,
CAST
(
DATE
(
NULL
)
AS
DECIMAL
));
SELECT
INTERVAL
(
0.0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
SELECT
INTERVAL
(
0.0
,
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
),
CAST
(
NULL
AS
DECIMAL
));
SELECT
INTERVAL
(
0.0
,
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
),
CAST
(
DATE
(
NULL
)
AS
DECIMAL
));
--
echo
End
of
5.0
tests
sql/item_cmpfunc.cc
View file @
7a41acfd
...
...
@@ -1638,24 +1638,27 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
void
Item_func_interval
::
fix_length_and_dec
()
{
uint
rows
=
row
->
cols
();
use_decimal_comparison
=
(
row
->
element_index
(
0
)
->
result_type
()
==
DECIMAL_RESULT
)
||
(
row
->
element_index
(
0
)
->
result_type
()
==
INT_RESULT
);
if
(
row
->
cols
()
>
8
)
if
(
row
s
>
8
)
{
bool
consts
=
1
;
bool
not_null_consts
=
TRUE
;
for
(
uint
i
=
1
;
consts
&&
i
<
row
->
cols
()
;
i
++
)
for
(
uint
i
=
1
;
not_null_consts
&&
i
<
rows
;
i
++
)
{
consts
&=
row
->
element_index
(
i
)
->
const_item
();
Item
*
el
=
row
->
element_index
(
i
);
not_null_consts
&=
el
->
const_item
()
&
!
el
->
is_null
();
}
if
(
consts
&&
if
(
not_null_
consts
&&
(
intervals
=
(
interval_range
*
)
sql_alloc
(
sizeof
(
interval_range
)
*
(
row
->
cols
()
-
1
))))
(
interval_range
*
)
sql_alloc
(
sizeof
(
interval_range
)
*
(
rows
-
1
))))
{
if
(
use_decimal_comparison
)
{
for
(
uint
i
=
1
;
i
<
row
->
cols
()
;
i
++
)
for
(
uint
i
=
1
;
i
<
rows
;
i
++
)
{
Item
*
el
=
row
->
element_index
(
i
);
interval_range
*
range
=
intervals
+
(
i
-
1
);
...
...
@@ -1680,7 +1683,7 @@ void Item_func_interval::fix_length_and_dec()
}
else
{
for
(
uint
i
=
1
;
i
<
row
->
cols
()
;
i
++
)
for
(
uint
i
=
1
;
i
<
rows
;
i
++
)
{
intervals
[
i
-
1
].
dbl
=
row
->
element_index
(
i
)
->
val_real
();
}
...
...
@@ -1771,12 +1774,22 @@ longlong Item_func_interval::val_int()
((
el
->
result_type
()
==
DECIMAL_RESULT
)
||
(
el
->
result_type
()
==
INT_RESULT
)))
{
my_decimal
e_dec_buf
,
*
e_dec
=
row
->
element_index
(
i
)
->
val_decimal
(
&
e_dec_buf
);
my_decimal
e_dec_buf
,
*
e_dec
=
el
->
val_decimal
(
&
e_dec_buf
);
/* Skip NULL ranges. */
if
(
el
->
null_value
)
continue
;
if
(
my_decimal_cmp
(
e_dec
,
dec
)
>
0
)
return
i
-
1
;
return
i
-
1
;
}
else
{
double
val
=
el
->
val_real
();
/* Skip NULL ranges. */
if
(
el
->
null_value
)
continue
;
if
(
val
>
value
)
return
i
-
1
;
}
else
if
(
row
->
element_index
(
i
)
->
val_real
()
>
value
)
return
i
-
1
;
}
return
i
-
1
;
}
...
...
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