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
b836d2dd
Commit
b836d2dd
authored
Aug 26, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed updateability VIEW detection (Bug#5146)
fixed other Item_ref methods where result_field involved
parent
8b01230e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
0 deletions
+72
-0
mysql-test/r/view.result
mysql-test/r/view.result
+17
-0
mysql-test/t/view.test
mysql-test/t/view.test
+13
-0
sql/item.cc
sql/item.cc
+38
-0
sql/item.h
sql/item.h
+3
-0
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
No files found.
mysql-test/r/view.result
View file @
b836d2dd
...
@@ -1132,5 +1132,22 @@ select distinct a from t1 limit 2;
...
@@ -1132,5 +1132,22 @@ select distinct a from t1 limit 2;
a
a
1
1
2
2
prepare stmt1 from "select distinct a from v1 limit 2";
execute stmt1;
a
1
2
execute stmt1;
a
1
2
deallocate prepare stmt1;
drop view v1;
drop table t1;
create table t1 (tg_column bigint);
create view v1 as select count(tg_column) as vg_column from t1;
select avg(vg_column) from v1;
avg(vg_column)
0.0000
drop view v1;
drop view v1;
drop table t1;
drop table t1;
mysql-test/t/view.test
View file @
b836d2dd
...
@@ -1076,5 +1076,18 @@ create view v1 as select a from t1;
...
@@ -1076,5 +1076,18 @@ create view v1 as select a from t1;
select
distinct
a
from
v1
;
select
distinct
a
from
v1
;
select
distinct
a
from
v1
limit
2
;
select
distinct
a
from
v1
limit
2
;
select
distinct
a
from
t1
limit
2
;
select
distinct
a
from
t1
limit
2
;
prepare
stmt1
from
"select distinct a from v1 limit 2"
;
execute
stmt1
;
execute
stmt1
;
deallocate
prepare
stmt1
;
drop
view
v1
;
drop
table
t1
;
#
# aggregate function of aggregate function
#
create
table
t1
(
tg_column
bigint
);
create
view
v1
as
select
count
(
tg_column
)
as
vg_column
from
t1
;
select
avg
(
vg_column
)
from
v1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
sql/item.cc
View file @
b836d2dd
...
@@ -2141,6 +2141,7 @@ void Item_ref::cleanup()
...
@@ -2141,6 +2141,7 @@ void Item_ref::cleanup()
{
{
DBUG_ENTER
(
"Item_ref::cleanup"
);
DBUG_ENTER
(
"Item_ref::cleanup"
);
Item_ident
::
cleanup
();
Item_ident
::
cleanup
();
result_field
=
0
;
if
(
hook_ptr
)
if
(
hook_ptr
)
*
hook_ptr
=
orig_item
;
*
hook_ptr
=
orig_item
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -2164,6 +2165,43 @@ bool Item_ref::send(Protocol *prot, String *tmp)
...
@@ -2164,6 +2165,43 @@ bool Item_ref::send(Protocol *prot, String *tmp)
}
}
double
Item_ref
::
val_result
()
{
if
(
result_field
)
{
if
((
null_value
=
result_field
->
is_null
()))
return
0.0
;
return
result_field
->
val_real
();
}
return
val
();
}
longlong
Item_ref
::
val_int_result
()
{
if
(
result_field
)
{
if
((
null_value
=
result_field
->
is_null
()))
return
0.0
;
return
result_field
->
val_int
();
}
return
val_int
();
}
String
*
Item_ref
::
str_result
(
String
*
str
)
{
if
(
result_field
)
{
if
((
null_value
=
result_field
->
is_null
()))
return
0
;
str
->
set_charset
(
str_value
.
charset
());
return
result_field
->
val_str
(
str
,
&
str_value
);
}
return
val_str
(
str
);
}
void
Item_ref_null_helper
::
print
(
String
*
str
)
void
Item_ref_null_helper
::
print
(
String
*
str
)
{
{
str
->
append
(
"<ref_null_helper>("
,
18
);
str
->
append
(
"<ref_null_helper>("
,
18
);
...
...
sql/item.h
View file @
b836d2dd
...
@@ -964,6 +964,9 @@ public:
...
@@ -964,6 +964,9 @@ public:
{
{
return
(
null_value
=
(
*
ref
)
->
get_date_result
(
ltime
,
fuzzydate
));
return
(
null_value
=
(
*
ref
)
->
get_date_result
(
ltime
,
fuzzydate
));
}
}
double
val_result
();
longlong
val_int_result
();
String
*
str_result
(
String
*
tmp
);
bool
send
(
Protocol
*
prot
,
String
*
tmp
);
bool
send
(
Protocol
*
prot
,
String
*
tmp
);
void
make_field
(
Send_field
*
field
)
{
(
*
ref
)
->
make_field
(
field
);
}
void
make_field
(
Send_field
*
field
)
{
(
*
ref
)
->
make_field
(
field
);
}
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
);
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
);
...
...
sql/sql_lex.cc
View file @
b836d2dd
...
@@ -1540,6 +1540,7 @@ bool st_lex::can_be_merged()
...
@@ -1540,6 +1540,7 @@ bool st_lex::can_be_merged()
select_lex
.
order_list
.
elements
==
0
&&
select_lex
.
order_list
.
elements
==
0
&&
select_lex
.
group_list
.
elements
==
0
&&
select_lex
.
group_list
.
elements
==
0
&&
select_lex
.
having
==
0
&&
select_lex
.
having
==
0
&&
select_lex
.
with_sum_func
==
0
&&
select_lex
.
table_list
.
elements
==
1
&&
select_lex
.
table_list
.
elements
==
1
&&
!
(
select_lex
.
options
&
SELECT_DISTINCT
)
&&
!
(
select_lex
.
options
&
SELECT_DISTINCT
)
&&
select_lex
.
select_limit
==
HA_POS_ERROR
);
select_lex
.
select_limit
==
HA_POS_ERROR
);
...
...
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