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
05f61b24
Commit
05f61b24
authored
Dec 04, 2006
by
andrey@example.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into example.com:/work/bug22369-v2/my51
parents
44656a23
50222ce9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
57 deletions
+92
-57
mysql-test/t/distinct.test
mysql-test/t/distinct.test
+67
-0
sql/sql_class.cc
sql/sql_class.cc
+22
-54
sql/sql_class.h
sql/sql_class.h
+1
-3
storage/myisam/myisampack.c
storage/myisam/myisampack.c
+2
-0
No files found.
mysql-test/t/distinct.test
View file @
05f61b24
...
...
@@ -437,3 +437,70 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
SELECT
DISTINCT
a
,
a
FROM
t1
WHERE
b
<
12
ORDER
BY
a
;
DROP
TABLE
t1
;
# The test case for bug#20836 should be re-enabled when bug#16861 is resolved
# The results for the test should be the same as in 4.1.
#
#Bug #20836: Selecting into variables results in wrong results being returned
#
#--disable_warnings
#DROP TABLE IF EXISTS t1;
#--enable_warnings
#
#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#INSERT INTO t1 VALUES (1,1,'ORANGE');
#INSERT INTO t1 VALUES (2,2,'APPLE');
#INSERT INTO t1 VALUES (3,2,'APPLE');
#INSERT INTO t1 VALUES (4,3,'PEAR');
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v1, @v2;
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
#fruit_name HAVING fruit_name = 'APPLE';
#SELECT @v3, @v4;
#
#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
#fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8;
#
#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
#WHERE fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8, @v9, @v10;
#
#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v11, @v12, @v13, @v14;
#
#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v15, @v16;
#
#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v17, @v18;
#
#--disable_warnings
#DROP TABLE IF EXISTS t2;
#--enable_warnings
#
#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp
#
#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp
#
#SELECT @v19, @v20;
#SELECT * FROM t2;
#
#DROP TABLE t1;
#DROP TABLE t2;
sql/sql_class.cc
View file @
05f61b24
...
...
@@ -1613,53 +1613,21 @@ bool select_exists_subselect::send_data(List<Item> &items)
int
select_dumpvar
::
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
)
{
List_iterator_fast
<
Item
>
li
(
list
);
List_iterator_fast
<
my_var
>
gl
(
var_list
);
Item
*
item
;
local_vars
.
empty
();
// Clear list if SP
unit
=
u
;
row_count
=
0
;
if
(
var_list
.
elements
!=
list
.
elements
)
{
my_message
(
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
,
ER
(
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
),
MYF
(
0
));
return
1
;
}
while
((
item
=
li
++
))
{
my_var
*
mv
=
gl
++
;
if
(
mv
->
local
)
{
Item_splocal
*
var
=
new
Item_splocal
(
mv
->
s
,
mv
->
offset
,
mv
->
type
);
(
void
)
local_vars
.
push_back
(
var
);
#ifndef DBUG_OFF
var
->
m_sp
=
mv
->
sp
;
#endif
}
else
{
Item_func_set_user_var
*
var
=
new
Item_func_set_user_var
(
mv
->
s
,
item
);
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument (reference on item)
Item_func_set_user_var can't be fixed after creation, so we do not
check var->fixed
*/
var
->
fix_fields
(
thd
,
0
);
var
->
fix_length_and_dec
();
vars
.
push_back
(
var
);
}
}
}
return
0
;
}
void
select_dumpvar
::
cleanup
()
{
vars
.
empty
();
row_count
=
0
;
row_count
=
0
;
}
...
...
@@ -1968,13 +1936,10 @@ Statement_map::~Statement_map()
bool
select_dumpvar
::
send_data
(
List
<
Item
>
&
items
)
{
List_iterator_fast
<
Item_func_set_user_var
>
li
(
vars
);
List_iterator_fast
<
Item_splocal
>
var_li
(
local_vars
);
List_iterator_fast
<
my_var
>
my_li
(
var_list
);
List_iterator_fast
<
my_var
>
var_li
(
var_list
);
List_iterator
<
Item
>
it
(
items
);
Item_func_set_user_var
*
xx
;
Item_splocal
*
yy
;
my_var
*
zz
;
Item
*
item
;
my_var
*
mv
;
DBUG_ENTER
(
"select_dumpvar::send_data"
);
if
(
unit
->
offset_limit_cnt
)
...
...
@@ -1987,24 +1952,27 @@ bool select_dumpvar::send_data(List<Item> &items)
my_message
(
ER_TOO_MANY_ROWS
,
ER
(
ER_TOO_MANY_ROWS
),
MYF
(
0
));
DBUG_RETURN
(
1
);
}
while
((
zz
=
my_li
++
)
&&
(
it
++
))
while
((
mv
=
var_li
++
)
&&
(
item
=
it
++
))
{
if
(
zz
->
local
)
if
(
mv
->
local
)
{
if
((
yy
=
var_li
++
))
{
if
(
thd
->
spcont
->
set_variable
(
current_thd
,
yy
->
get_var_idx
(),
it
.
ref
()))
DBUG_RETURN
(
1
);
}
if
(
thd
->
spcont
->
set_variable
(
thd
,
mv
->
offset
,
&
item
))
DBUG_RETURN
(
1
);
}
else
{
if
((
xx
=
li
++
))
{
xx
->
check
(
0
);
xx
->
update
();
}
Item_func_set_user_var
*
suv
=
new
Item_func_set_user_var
(
mv
->
s
,
item
);
/*
Item_func_set_user_var can't substitute something else on its
place => NULL may be passed as last argument (reference on
item) Item_func_set_user_var can't be fixed after creation, so
we do not check var->fixed
*/
suv
->
fix_fields
(
thd
,
0
);
suv
->
check
(
0
);
suv
->
update
();
}
}
DBUG_RETURN
(
0
);
...
...
sql/sql_class.h
View file @
05f61b24
...
...
@@ -2181,9 +2181,7 @@ class select_dumpvar :public select_result_interceptor {
ha_rows
row_count
;
public:
List
<
my_var
>
var_list
;
List
<
Item_func_set_user_var
>
vars
;
List
<
Item_splocal
>
local_vars
;
select_dumpvar
(
void
)
{
var_list
.
empty
();
local_vars
.
empty
();
vars
.
empty
();
row_count
=
0
;}
select_dumpvar
()
{
var_list
.
empty
();
row_count
=
0
;}
~
select_dumpvar
()
{}
int
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
);
bool
send_data
(
List
<
Item
>
&
items
);
...
...
storage/myisam/myisampack.c
View file @
05f61b24
...
...
@@ -2923,6 +2923,8 @@ static void flush_bits(void)
bits
-=
8
;
*
file_buffer
.
pos
++=
(
uchar
)
(
bit_buffer
>>
bits
);
}
if
(
file_buffer
.
pos
>=
file_buffer
.
end
)
VOID
(
flush_buffer
(
~
(
ulong
)
0
));
file_buffer
.
bits
=
BITS_SAVED
;
file_buffer
.
bitbucket
=
0
;
}
...
...
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