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
bb1f8160
Commit
bb1f8160
authored
Jul 12, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
e06e06ff
de016ca7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
mysql-test/r/view.result
mysql-test/r/view.result
+9
-0
mysql-test/t/view.test
mysql-test/t/view.test
+9
-0
sql/item.cc
sql/item.cc
+29
-0
sql/item.h
sql/item.h
+1
-0
No files found.
mysql-test/r/view.result
View file @
bb1f8160
...
...
@@ -1948,6 +1948,15 @@ s1 s2
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
create table t1 (f1 int, f2 int);
create view v1 as select f1 as f3, f2 as f1 from t1;
insert into t1 values (1,3),(2,1),(3,2);
select * from v1 order by f1;
f3 f1
2 1
3 2
1 3
drop table t1;
CREATE TABLE t1 (f1 char) ENGINE = innodb;
INSERT INTO t1 VALUES ('A');
CREATE VIEW v1 AS SELECT * FROM t1;
...
...
mysql-test/t/view.test
View file @
bb1f8160
...
...
@@ -1789,6 +1789,15 @@ DROP PROCEDURE p1;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
#
# Test for bug #11709 View was ordered by wrong column
#
create
table
t1
(
f1
int
,
f2
int
);
create
view
v1
as
select
f1
as
f3
,
f2
as
f1
from
t1
;
insert
into
t1
values
(
1
,
3
),(
2
,
1
),(
3
,
2
);
select
*
from
v1
order
by
f1
;
drop
table
t1
;
#
# Test for bug #11771: wrong query_id in SELECT * FROM <view>
#
...
...
sql/item.cc
View file @
bb1f8160
...
...
@@ -4499,6 +4499,35 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
return
Item_direct_ref
::
fix_fields
(
thd
,
reference
);
}
/*
Compare view field's name with item's name before call to referenced
item's eq()
SYNOPSIS
Item_direct_view_ref::eq()
item item to compare with
binary_cmp make binary comparison
DESCRIPTION
Consider queries:
create view v1 as select t1.f1 as f2, t1.f2 as f1 from t1;
select * from v1 order by f1;
In order to choose right field for sorting we need to compare
given item's name (f1) to view field's name prior to calling
referenced item's eq().
RETURN
TRUE Referenced item is equal to given item
FALSE otherwise
*/
bool
Item_direct_view_ref
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
Item
*
it
=
((
Item
*
)
item
)
->
real_item
();
return
(
!
it
->
name
||
!
my_strcasecmp
(
system_charset_info
,
it
->
name
,
field_name
))
&&
ref
&&
(
*
ref
)
->
real_item
()
->
eq
(
it
,
binary_cmp
);
}
void
Item_null_helper
::
print
(
String
*
str
)
{
...
...
sql/item.h
View file @
bb1f8160
...
...
@@ -1524,6 +1524,7 @@ class Item_direct_view_ref :public Item_direct_ref
:
Item_direct_ref
(
thd
,
item
)
{}
bool
fix_fields
(
THD
*
,
Item
**
);
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
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