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
e16985ba
Commit
e16985ba
authored
Apr 30, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
parents
c0e8a8d6
6040b0ab
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
452 additions
and
356 deletions
+452
-356
sql/sql_prepare.cc
sql/sql_prepare.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+381
-353
sql/sql_select.h
sql/sql_select.h
+16
-2
tests/mysql_client_test.c
tests/mysql_client_test.c
+54
-0
No files found.
sql/sql_prepare.cc
View file @
e16985ba
...
@@ -2223,7 +2223,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2223,7 +2223,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
thd
->
protocol
=
&
thd
->
protocol_prep
;
// Switch to binary protocol
thd
->
protocol
=
&
thd
->
protocol_prep
;
// Switch to binary protocol
(
void
)
stmt
->
cursor
->
fetch
(
num_rows
);
stmt
->
cursor
->
fetch
(
num_rows
);
thd
->
protocol
=
&
thd
->
protocol_simple
;
// Use normal protocol
thd
->
protocol
=
&
thd
->
protocol_simple
;
// Use normal protocol
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
...
...
sql/sql_select.cc
View file @
e16985ba
This diff is collapsed.
Click to expand it.
sql/sql_select.h
View file @
e16985ba
...
@@ -91,7 +91,15 @@ enum join_type { JT_UNKNOWN,JT_SYSTEM,JT_CONST,JT_EQ_REF,JT_REF,JT_MAYBE_REF,
...
@@ -91,7 +91,15 @@ enum join_type { JT_UNKNOWN,JT_SYSTEM,JT_CONST,JT_EQ_REF,JT_REF,JT_MAYBE_REF,
class
JOIN
;
class
JOIN
;
typedef
int
(
*
Next_select_func
)(
JOIN
*
,
struct
st_join_table
*
,
bool
);
enum
enum_nested_loop_state
{
NESTED_LOOP_KILLED
=
-
2
,
NESTED_LOOP_ERROR
=
-
1
,
NESTED_LOOP_OK
=
0
,
NESTED_LOOP_NO_MORE_ROWS
=
1
,
NESTED_LOOP_QUERY_LIMIT
=
3
,
NESTED_LOOP_CURSOR_LIMIT
=
4
};
typedef
enum_nested_loop_state
(
*
Next_select_func
)(
JOIN
*
,
struct
st_join_table
*
,
bool
);
typedef
int
(
*
Read_record_func
)(
struct
st_join_table
*
tab
);
typedef
int
(
*
Read_record_func
)(
struct
st_join_table
*
tab
);
...
@@ -162,6 +170,11 @@ class JOIN :public Sql_alloc
...
@@ -162,6 +170,11 @@ class JOIN :public Sql_alloc
uint
send_group_parts
;
uint
send_group_parts
;
bool
sort_and_group
,
first_record
,
full_join
,
group
,
no_field_update
;
bool
sort_and_group
,
first_record
,
full_join
,
group
,
no_field_update
;
bool
do_send_rows
;
bool
do_send_rows
;
/*
TRUE when we want to resume nested loop iterations when
fetching data from a cursor
*/
bool
resume_nested_loop
;
table_map
const_table_map
,
found_const_table_map
,
outer_join
;
table_map
const_table_map
,
found_const_table_map
,
outer_join
;
ha_rows
send_records
,
found_records
,
examined_rows
,
row_limit
,
select_limit
;
ha_rows
send_records
,
found_records
,
examined_rows
,
row_limit
,
select_limit
;
/*
/*
...
@@ -263,6 +276,7 @@ class JOIN :public Sql_alloc
...
@@ -263,6 +276,7 @@ class JOIN :public Sql_alloc
sort_and_group
=
0
;
sort_and_group
=
0
;
first_record
=
0
;
first_record
=
0
;
do_send_rows
=
1
;
do_send_rows
=
1
;
resume_nested_loop
=
FALSE
;
send_records
=
0
;
send_records
=
0
;
found_records
=
0
;
found_records
=
0
;
fetch_limit
=
HA_POS_ERROR
;
fetch_limit
=
HA_POS_ERROR
;
...
@@ -374,7 +388,7 @@ class Cursor: public Sql_alloc, public Item_arena
...
@@ -374,7 +388,7 @@ class Cursor: public Sql_alloc, public Item_arena
void
reset_thd
(
THD
*
thd
);
void
reset_thd
(
THD
*
thd
);
int
open
(
JOIN
*
join
);
int
open
(
JOIN
*
join
);
int
fetch
(
ulong
num_rows
);
void
fetch
(
ulong
num_rows
);
void
reset
()
{
join
=
0
;
}
void
reset
()
{
join
=
0
;
}
bool
is_open
()
const
{
return
join
!=
0
;
}
bool
is_open
()
const
{
return
join
!=
0
;
}
void
close
();
void
close
();
...
...
tests/mysql_client_test.c
View file @
e16985ba
...
@@ -12855,6 +12855,59 @@ static void test_bug9159()
...
@@ -12855,6 +12855,59 @@ static void test_bug9159()
myquery
(
rc
);
myquery
(
rc
);
}
}
/* Crash when opening a cursor to a query with DISTICNT and no key */
static
void
test_bug9520
()
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
1
];
char
a
[
6
];
ulong
a_len
;
int
rc
,
row_count
=
0
;
myheader
(
"test_bug9520"
);
mysql_query
(
mysql
,
"drop table if exists t1"
);
mysql_query
(
mysql
,
"create table t1 (a char(5), b char(5), c char(5),"
" primary key (a, b, c))"
);
rc
=
mysql_query
(
mysql
,
"insert into t1 values ('x', 'y', 'z'), "
" ('a', 'b', 'c'), ('k', 'l', 'm')"
);
myquery
(
rc
);
stmt
=
open_cursor
(
"select distinct b from t1"
);
/*
Not crashes with:
stmt= open_cursor("select distinct a from t1");
*/
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
bzero
(
bind
,
sizeof
(
bind
));
bind
[
0
].
buffer_type
=
MYSQL_TYPE_STRING
;
bind
[
0
].
buffer
=
(
char
*
)
a
;
bind
[
0
].
buffer_length
=
sizeof
(
a
);
bind
[
0
].
length
=
&
a_len
;
mysql_stmt_bind_result
(
stmt
,
bind
);
while
(
!
(
rc
=
mysql_stmt_fetch
(
stmt
)))
row_count
++
;
DIE_UNLESS
(
rc
==
MYSQL_NO_DATA
);
printf
(
"Fetched %d rows
\n
"
,
row_count
);
DBUG_ASSERT
(
row_count
==
3
);
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"drop table t1"
);
myquery
(
rc
);
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
*/
*/
...
@@ -13080,6 +13133,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -13080,6 +13133,7 @@ static struct my_tests_st my_tests[]= {
{
"test_bug8722"
,
test_bug8722
},
{
"test_bug8722"
,
test_bug8722
},
{
"test_bug8880"
,
test_bug8880
},
{
"test_bug8880"
,
test_bug8880
},
{
"test_bug9159"
,
test_bug9159
},
{
"test_bug9159"
,
test_bug9159
},
{
"test_bug9520"
,
test_bug9520
},
{
0
,
0
}
{
0
,
0
}
};
};
...
...
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