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
b9a4bf8c
Commit
b9a4bf8c
authored
Apr 23, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subselect in procedure argument list (Bug #302)
parent
cba91cce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
0 deletions
+51
-0
.bzrignore
.bzrignore
+3
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+17
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+20
-0
sql/sp_head.cc
sql/sp_head.cc
+6
-0
sql/sql_parse.cc
sql/sql_parse.cc
+5
-0
No files found.
.bzrignore
View file @
b9a4bf8c
...
...
@@ -605,3 +605,6 @@ vio/viotest-ssl
myisam/ftbench/var/*
myisam/ftbench/data
myisam/ftbench/t
libmysqld/sp_pcontext.cc
libmysqld/sp.cc
libmysqld/sp_head.cc
mysql-test/r/subselect.result
View file @
b9a4bf8c
...
...
@@ -887,6 +887,23 @@ do (SELECT a from t1);
Table 'test.t1' doesn't exist
set @a:=(SELECT a from t1);
Table 'test.t1' doesn't exist
create table t1 (a int);
create table t2 (a int);
insert into t2 values (1), (2), (3);
create procedure foo1(x int)
insert into test.t1 values (x);
create function foo2(i int) returns int
return i+1;
call foo1((select max(a) from t2));
select * from t1;
a
3
select foo2((select max(a) from t2));
foo2((select max(a) from t2))
4
drop table t1, t2;
drop procedure foo1;
drop function foo2;
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
...
...
mysql-test/t/subselect.test
View file @
b9a4bf8c
...
...
@@ -486,6 +486,9 @@ select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
select
ROW
(
1
,
1
,
'a'
)
IN
(
select
b
,
a
,
c
from
t1
limit
2
);
drop
table
t1
;
#
# DO & SET
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
);
do
@
a
:=
(
SELECT
a
from
t1
);
...
...
@@ -499,6 +502,23 @@ do (SELECT a from t1);
--
error
1146
set
@
a
:=
(
SELECT
a
from
t1
);
#
# CALL
#
create
table
t1
(
a
int
);
create
table
t2
(
a
int
);
insert
into
t2
values
(
1
),
(
2
),
(
3
);
create
procedure
foo1
(
x
int
)
insert
into
test
.
t1
values
(
x
);
create
function
foo2
(
i
int
)
returns
int
return
i
+
1
;
call
foo1
((
select
max
(
a
)
from
t2
));
select
*
from
t1
;
select
foo2
((
select
max
(
a
)
from
t2
));
drop
table
t1
,
t2
;
drop
procedure
foo1
;
drop
function
foo2
;
CREATE
TABLE
t1
(
a
int
,
KEY
(
a
));
HANDLER
t1
OPEN
;
--
error
1149
...
...
sql/sp_head.cc
View file @
b9a4bf8c
...
...
@@ -216,6 +216,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
nctx
->
push_item
(
eval_func_item
(
thd
,
*
argp
++
,
pvar
->
type
));
}
// Close tables opened for subselect in argument list
close_thread_tables
(
thd
);
// The rest of the frame are local variables which are all IN.
// QQ See comment in execute_procedure below.
for
(;
i
<
csize
;
i
++
)
...
...
@@ -283,6 +286,9 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
nctx
->
set_oindex
(
i
,
static_cast
<
Item_splocal
*>
(
it
)
->
get_offset
());
}
}
// Close tables opened for subselect in argument list
close_thread_tables
(
thd
);
// The rest of the frame are local variables which are all IN.
// QQ We haven't found any hint of what the value is when unassigned,
// so we set it to NULL for now. It's an error to refer to an
...
...
sql/sql_parse.cc
View file @
b9a4bf8c
...
...
@@ -3060,6 +3060,11 @@ mysql_execute_command(THD *thd)
uint
smrx
;
LINT_INIT
(
smrx
);
if
(
tables
&&
((
res
=
check_table_access
(
thd
,
SELECT_ACL
,
tables
))
||
(
res
=
open_and_lock_tables
(
thd
,
tables
))))
break
;
fix_tables_pointers
(
lex
->
all_selects_list
);
#ifndef EMBEDDED_LIBRARY
// When executing substatements, they're assumed to send_error when
// it happens, but not to send_ok.
...
...
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