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
159bf883
Commit
159bf883
authored
Nov 18, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A test case for Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA
when COUNT(*) is 0". The bug itself cannot be repeated.
parent
385082ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
0 deletions
+84
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+19
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+21
-0
tests/mysql_client_test.c
tests/mysql_client_test.c
+44
-0
No files found.
mysql-test/r/sp.result
View file @
159bf883
...
@@ -3648,4 +3648,23 @@ call bug14723();;
...
@@ -3648,4 +3648,23 @@ call bug14723();;
42
42
drop function bug14723|
drop function bug14723|
drop procedure bug14723|
drop procedure bug14723|
create procedure bug14845()
begin
declare a char(255);
declare done int default 0;
declare c cursor for select count(*) from t1 where 1 = 0;
declare continue handler for sqlstate '02000' set done = 1;
open c;
repeat
fetch c into a;
if not done then
select a;
end if;
until done end repeat;
close c;
end|
call bug14845()|
a
0
drop procedure bug14845|
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
159bf883
...
@@ -4572,6 +4572,27 @@ delimiter |;;
...
@@ -4572,6 +4572,27 @@ delimiter |;;
drop
function
bug14723
|
drop
function
bug14723
|
drop
procedure
bug14723
|
drop
procedure
bug14723
|
#
# Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0"
# Check that when fetching from a cursor, COUNT(*) works properly.
#
create
procedure
bug14845
()
begin
declare
a
char
(
255
);
declare
done
int
default
0
;
declare
c
cursor
for
select
count
(
*
)
from
t1
where
1
=
0
;
declare
continue
handler
for
sqlstate
'02000'
set
done
=
1
;
open
c
;
repeat
fetch
c
into
a
;
if
not
done
then
select
a
;
end
if
;
until
done
end
repeat
;
close
c
;
end
|
call
bug14845
()
|
drop
procedure
bug14845
|
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
...
...
tests/mysql_client_test.c
View file @
159bf883
...
@@ -14546,6 +14546,49 @@ static void test_bug13524()
...
@@ -14546,6 +14546,49 @@ static void test_bug13524()
myquery
(
rc
);
myquery
(
rc
);
}
}
/*
Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0"
*/
static
void
test_bug14845
()
{
MYSQL_STMT
*
stmt
;
int
rc
;
const
ulong
type
=
CURSOR_TYPE_READ_ONLY
;
const
char
*
query
=
"select count(*) from t1 where 1 = 0"
;
myheader
(
"test_bug14845"
);
rc
=
mysql_query
(
mysql
,
"drop table if exists t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table t1 (id int(11) default null, "
"name varchar(20) default null)"
"engine=MyISAM DEFAULT CHARSET=utf8"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into t1 values (1,'abc'),(2,'def')"
);
myquery
(
rc
);
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_attr_set
(
stmt
,
STMT_ATTR_CURSOR_TYPE
,
(
const
void
*
)
&
type
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_prepare
(
stmt
,
query
,
strlen
(
query
));
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
rc
==
0
);
rc
=
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
rc
==
MYSQL_NO_DATA
);
/* Cleanup */
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
...
@@ -14805,6 +14848,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -14805,6 +14848,7 @@ static struct my_tests_st my_tests[]= {
{
"test_bug14210"
,
test_bug14210
},
{
"test_bug14210"
,
test_bug14210
},
{
"test_bug13488"
,
test_bug13488
},
{
"test_bug13488"
,
test_bug13488
},
{
"test_bug13524"
,
test_bug13524
},
{
"test_bug13524"
,
test_bug13524
},
{
"test_bug14845"
,
test_bug14845
},
{
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