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
9c51a97e
Commit
9c51a97e
authored
Sep 07, 2005
by
aivanov@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge aivanov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/alexi/mysql-5.0
parents
d6398c1a
ff588b47
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
98 additions
and
8 deletions
+98
-8
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+21
-0
mysql-test/r/view.result
mysql-test/r/view.result
+9
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+30
-0
mysql-test/t/view.test
mysql-test/t/view.test
+8
-0
sql/examples/ha_tina.cc
sql/examples/ha_tina.cc
+2
-1
sql/item.cc
sql/item.cc
+9
-7
sql/item.h
sql/item.h
+4
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+15
-0
No files found.
mysql-test/r/sp-error.result
View file @
9c51a97e
...
...
@@ -765,3 +765,24 @@ OPTIMIZE TABLE t1;
RETURN 1;
END|
ERROR 0A000: OPTIMIZE TABLE is not allowed in stored procedures
DROP FUNCTION IF EXISTS bug12995|
CREATE FUNCTION bug12995() RETURNS INT
BEGIN
HANDLER t1 OPEN;
RETURN 1;
END|
ERROR 0A000: HANDLER is not allowed in stored procedures
CREATE FUNCTION bug12995() RETURNS INT
BEGIN
HANDLER t1 READ FIRST;
RETURN 1;
END|
ERROR 0A000: HANDLER is not allowed in stored procedures
CREATE FUNCTION bug12995() RETURNS INT
BEGIN
HANDLER t1 CLOSE;
RETURN 1;
END|
ERROR 0A000: HANDLER is not allowed in stored procedures
SELECT bug12995()|
ERROR 42000: FUNCTION test.bug12995 does not exist
mysql-test/r/view.result
View file @
9c51a97e
...
...
@@ -2151,6 +2151,15 @@ select * from v1;
strcmp(f1,'a')
drop view v1;
drop table t1;
create table t1 (f1 int, f2 int,f3 int);
insert into t1 values (1,10,20),(2,0,0);
create view v1 as select * from t1;
select if(sum(f1)>1,f2,f3) from v1 group by f1;
if(sum(f1)>1,f2,f3)
20
0
drop view v1;
drop table t1;
create table t1 (
r_object_id char(16) NOT NULL,
group_name varchar(32) NOT NULL
...
...
mysql-test/t/sp-error.test
View file @
9c51a97e
...
...
@@ -1099,6 +1099,36 @@ BEGIN
OPTIMIZE
TABLE
t1
;
RETURN
1
;
END
|
delimiter
;
|
#
# Bug##12995 "Inside function "Table 't4' was not locked with LOCK TABLES"
#
delimiter
|
;
--
disable_warnings
DROP
FUNCTION
IF
EXISTS
bug12995
|
--
enable_warnings
--
error
ER_SP_BADSTATEMENT
CREATE
FUNCTION
bug12995
()
RETURNS
INT
BEGIN
HANDLER
t1
OPEN
;
RETURN
1
;
END
|
--
error
ER_SP_BADSTATEMENT
CREATE
FUNCTION
bug12995
()
RETURNS
INT
BEGIN
HANDLER
t1
READ
FIRST
;
RETURN
1
;
END
|
--
error
ER_SP_BADSTATEMENT
CREATE
FUNCTION
bug12995
()
RETURNS
INT
BEGIN
HANDLER
t1
CLOSE
;
RETURN
1
;
END
|
--
error
1305
SELECT
bug12995
()
|
delimiter
;
|
#
# BUG#NNNN: New bug synopsis
...
...
mysql-test/t/view.test
View file @
9c51a97e
...
...
@@ -2020,6 +2020,14 @@ drop view v1;
drop
table
t1
;
#
# Bug #12922 if(sum(),...) with group from view returns wrong results
#
create
table
t1
(
f1
int
,
f2
int
,
f3
int
);
insert
into
t1
values
(
1
,
10
,
20
),(
2
,
0
,
0
);
create
view
v1
as
select
*
from
t1
;
select
if
(
sum
(
f1
)
>
1
,
f2
,
f3
)
from
v1
group
by
f1
;
drop
view
v1
;
drop
table
t1
;
# BUG#12941
#
create
table
t1
(
...
...
sql/examples/ha_tina.cc
View file @
9c51a97e
...
...
@@ -651,7 +651,8 @@ int ha_tina::rnd_init(bool scan)
records
=
0
;
chain_ptr
=
chain
;
#ifdef HAVE_MADVISE
(
void
)
madvise
(
share
->
mapped_file
,
share
->
file_stat
.
st_size
,
MADV_SEQUENTIAL
);
if
(
scan
)
(
void
)
madvise
(
share
->
mapped_file
,
share
->
file_stat
.
st_size
,
MADV_SEQUENTIAL
);
#endif
DBUG_RETURN
(
0
);
...
...
sql/item.cc
View file @
9c51a97e
...
...
@@ -1022,9 +1022,9 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
/* Will split complicated items and ignore simple ones */
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
}
else
if
((
type
()
==
SUM_FUNC_ITEM
||
(
used_tables
()
&
~
PARAM_TABLE_BIT
))
&&
type
()
!=
REF_ITEM
)
else
if
((
type
()
==
SUM_FUNC_ITEM
||
(
used_tables
()
&
~
PARAM_TABLE_BIT
))
&&
(
type
()
!=
REF_ITEM
||
((
Item_ref
*
)
this
)
->
ref_type
()
==
Item_ref
::
VIEW_REF
)
)
{
/*
Replace item with a reference so that we can easily calculate
...
...
@@ -1033,15 +1033,17 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
The test above is to ensure we don't do a reference for things
that are constants (PARAM_TABLE_BIT is in effect a constant)
or already referenced (for example an item in HAVING)
Exception is Item_direct_view_ref which we need to convert to
Item_ref to allow fields from view being stored in tmp table.
*/
uint
el
=
fields
.
elements
;
Item
*
new_item
;
ref_pointer_array
[
el
]
=
this
;
Item
*
new_item
,
*
real_itm
=
real_item
();
ref_pointer_array
[
el
]
=
real_itm
;
if
(
!
(
new_item
=
new
Item_ref
(
&
thd
->
lex
->
current_select
->
context
,
ref_pointer_array
+
el
,
0
,
name
)))
return
;
// fatal_error is set
fields
.
push_front
(
this
);
ref_pointer_array
[
el
]
=
this
;
fields
.
push_front
(
real_itm
);
thd
->
change_item_tree
(
ref
,
new_item
);
}
}
...
...
sql/item.h
View file @
9c51a97e
...
...
@@ -1537,6 +1537,7 @@ class Item_ref :public Item_ident
protected:
void
set_properties
();
public:
enum
Ref_Type
{
REF
,
DIRECT_REF
,
VIEW_REF
};
Field
*
result_field
;
/* Save result here */
Item
**
ref
;
Item_ref
(
Name_resolution_context
*
context_arg
,
...
...
@@ -1617,6 +1618,7 @@ class Item_ref :public Item_ident
void
cleanup
();
Item_field
*
filed_for_view_update
()
{
return
(
*
ref
)
->
filed_for_view_update
();
}
virtual
Ref_Type
ref_type
()
{
return
REF
;
}
};
...
...
@@ -1641,6 +1643,7 @@ class Item_direct_ref :public Item_ref
bool
val_bool
();
bool
is_null
();
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
virtual
Ref_Type
ref_type
()
{
return
DIRECT_REF
;
}
};
/*
...
...
@@ -1660,6 +1663,7 @@ class Item_direct_view_ref :public Item_direct_ref
bool
fix_fields
(
THD
*
,
Item
**
);
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
virtual
Ref_Type
ref_type
()
{
return
VIEW_REF
;
}
};
...
...
sql/sql_yacc.yy
View file @
9c51a97e
...
...
@@ -8163,6 +8163,11 @@ handler:
HANDLER_SYM table_ident OPEN_SYM opt_table_alias
{
LEX *lex= Lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT;
}
lex->sql_command = SQLCOM_HA_OPEN;
if (!lex->current_select->add_table_to_list(lex->thd, $2, $4, 0))
YYABORT;
...
...
@@ -8170,6 +8175,11 @@ handler:
| HANDLER_SYM table_ident_nodb CLOSE_SYM
{
LEX *lex= Lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT;
}
lex->sql_command = SQLCOM_HA_CLOSE;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
YYABORT;
...
...
@@ -8177,6 +8187,11 @@ handler:
| HANDLER_SYM table_ident_nodb READ_SYM
{
LEX *lex=Lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT;
}
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
lex->current_select->select_limit= new Item_int((int32) 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