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
ef5f15c3
Commit
ef5f15c3
authored
Apr 08, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed subquery in the FROM clause with parameter (BUG#3020)
parent
d4f5f1b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
29 deletions
+83
-29
sql/sql_derived.cc
sql/sql_derived.cc
+35
-29
tests/client_test.c
tests/client_test.c
+48
-0
No files found.
sql/sql_derived.cc
View file @
ef5f15c3
...
...
@@ -148,7 +148,12 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
}
derived_result
->
set_table
(
table
);
/*
if it is preparation PS only then we do not need real data and we
can skip execution (and parameters is not defined, too)
*/
if
(
!
thd
->
current_statement
)
{
if
(
is_union
)
{
// execute union without clean up
...
...
@@ -179,6 +184,7 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
SELECT_NO_UNLOCK
),
derived_result
,
unit
,
first_select
);
}
}
if
(
!
res
)
{
...
...
tests/client_test.c
View file @
ef5f15c3
...
...
@@ -8905,6 +8905,53 @@ static void test_bind_nagative()
myquery
(
rc
);
}
static
void
test_derived
()
{
MYSQL_STMT
*
stmt
;
int
rc
,
i
;
MYSQL_BIND
bind
[
1
];
long
my_val
=
0L
;
long
my_length
=
0L
;
long
my_null
=
0L
;
const
char
*
query
=
"select count(1) from (select f.id from t1 f where f.id=?) as x"
;
myheader
(
"test_derived"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table t1 (id int(8), primary key (id)) \
TYPE=InnoDB DEFAULT CHARSET=utf8"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into t1 values (1)"
);
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
mystmt_init
(
stmt
);
bind
[
0
].
buffer_type
=
FIELD_TYPE_LONG
;
bind
[
0
].
buffer
=
(
char
*
)
&
my_val
;
bind
[
0
].
length
=
&
my_length
;
bind
[
0
].
is_null
=
(
char
*
)
&
my_null
;
my_val
=
1
;
rc
=
mysql_bind_param
(
stmt
,
bind
);
mystmt
(
stmt
,
rc
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
assert
(
1
==
my_process_stmt_result
(
stmt
));
}
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE t1"
);
myquery
(
rc
);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
...
...
@@ -9172,6 +9219,7 @@ int main(int argc, char **argv)
test_multi
();
/* test of multi delete & update */
test_insert_select
();
/* test INSERT ... SELECT */
test_bind_nagative
();
/* bind negative to unsigned BUG#3223 */
test_derived
();
/* derived table with parameter BUG#3020 */
end_time
=
time
((
time_t
*
)
0
);
total_time
+=
difftime
(
end_time
,
start_time
);
...
...
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